From 9c497fa68472a5efa3e66d138917b91e1f01b03e Mon Sep 17 00:00:00 2001 From: psykose Date: Sat, 3 Jun 2023 18:01:38 +0000 Subject: [PATCH] main/abuild: add -fno-plt for x86* per https://lists.alpinelinux.org/~alpine/devel/%3C1628515011.zujvcn248v.none%40localhost%3E this is a safe for-x86-only optimisation that decreases code size and increases speed by around 1-3% a small gain, but a 'free' one. the only incompatibility is it must be disabled when -Wl,-z,lazy is set. however, we generally force -z,now (immediate binding), so this is not a fundamental incompatibility, and is usable for us (if this seriously breaks something, then shoot me, but this will most likely be fine :) ) --- main/abuild/APKBUILD | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/main/abuild/APKBUILD b/main/abuild/APKBUILD index ce32869ae54..212171fad2a 100644 --- a/main/abuild/APKBUILD +++ b/main/abuild/APKBUILD @@ -2,7 +2,7 @@ pkgname=abuild pkgver=3.11.6 _ver=${pkgver%_git*} -pkgrel=0 +pkgrel=1 pkgdesc="Script to build Alpine Packages" url="https://git.alpinelinux.org/cgit/abuild/" arch="all" @@ -47,11 +47,27 @@ package() { # binutils only supports it here cat >>"$pkgdir"/usr/share/abuild/default.conf <<-EOF - export RUSTFLAGS="-Clink-arg=-Wl,-z,pack-relative-relocs" + # binutils ld.bfd supports this on this architecture; default to it + export RUSTFLAGS="\$RUSTFLAGS -Clink-arg=-Wl,-z,pack-relative-relocs" export LDFLAGS="\$LDFLAGS -Wl,-z,pack-relative-relocs" EOF esac + case "$CARCH" in + x86*) + # https://lists.alpinelinux.org/~alpine/devel/%3C1628515011.zujvcn248v.none%40localhost%3E + # note that this is x86-exclusive. on other architectures, this is pretty much always bad + # https://github.com/rust-lang/rust/pull/106380 + cat >>"$pkgdir"/usr/share/abuild/default.conf <<-EOF + + # -fno-plt has very slight improvements to general code size and speed on x86-only, + # for the common system dynamic linking case + export CFLAGS="\$CFLAGS -fno-plt" + export CXXFLAGS="\$CXXFLAGS -fno-plt" + EOF + ;; + esac + install -d -m 775 -g abuild "$pkgdir"/var/cache/distfiles } @@ -60,16 +76,14 @@ cpan() { depends="perl perl-libwww perl-json perl-module-build perl-module-build-tiny perl-lwp-protocol-https" - mkdir -p "$subpkgdir"/usr/bin - mv "$pkgdir"/usr/bin/apkbuild-cpan "$subpkgdir"/usr/bin/ + amove usr/bin/apkbuild-cpan } gems() { pkgdesc="APKBUILD dependency resolver for RubyGems" depends="ruby ruby-augeas" - mkdir -p "$subpkgdir"/usr/bin - mv "$pkgdir"/usr/bin/apkbuild-gem-resolver "$subpkgdir"/usr/bin/ + amove usr/bin/apkbuild-gem-resolver } pypi() { @@ -77,8 +91,7 @@ pypi() { depends="perl perl-libwww perl-json perl-module-build-tiny perl-lwp-protocol-https perl-ipc-system-simple" - mkdir -p "$subpkgdir"/usr/bin - mv "$pkgdir"/usr/bin/apkbuild-pypi "$subpkgdir"/usr/bin/ + amove usr/bin/apkbuild-pypi } _rootbld() {