diff options
author | bill-auger <mr.j.spam.me@gmail.com> | 2023-09-05 06:17:35 -0400 |
---|---|---|
committer | bill-auger <mr.j.spam.me@gmail.com> | 2023-09-07 01:51:41 -0400 |
commit | 8b2f7d7824ef82c258101e19cc8453ed2d34ffaf (patch) | |
tree | 1d3ea17429a76c88dc47f07c7d815f3ce2d8a17f /libre/iceweasel/PKGBUILD | |
parent | a0029418814a6e9e5ea7fd0cdcbca7e7106de054 (diff) |
[iceweasel]: disable LTO and related housekeeping
Diffstat (limited to 'libre/iceweasel/PKGBUILD')
-rw-r--r-- | libre/iceweasel/PKGBUILD | 87 |
1 files changed, 45 insertions, 42 deletions
diff --git a/libre/iceweasel/PKGBUILD b/libre/iceweasel/PKGBUILD index 523d830ef..38b5f9156 100644 --- a/libre/iceweasel/PKGBUILD +++ b/libre/iceweasel/PKGBUILD @@ -40,7 +40,7 @@ # technical: # - build 32-bit arches with GCC instead of clang # - disable rust-SIMD, LTO, PGO, and skip profiling build for armv7h and i686 -# - allow skipping profiling build for x86_64 (_SHOULD_SKIP_PGO). +# - allow skipping profiling build for x86_64 (_SKIP_PGO). # this is to avoid OOM problems, and occasional deadlocks in some versions, # which expect active netwokring or internet access at build time. # - prefer as many system libs as possible, over their vendored couterparts @@ -235,15 +235,25 @@ b2sums_i686=('97035e44cd1deae7bb2422c81eec7294feb51f43f460b4d7ddba083e1d8a48d265 ## compiler and optimization tweaks ## -# disable PGO for 32-bit arches, 64-bit optionally -# try '1' if the build hangs indefinitely - known past causes: +# disable PGO +# try this if the build hangs indefinitely - known past causes: # * resource exhaustion # * a test which misbehaves in environments without networking -readonly _SHOULD_SKIP_PGO=$(case "${CARCH}" in armv7h|i686) echo 1 ;; *) echo 0 ;; esac) +readonly _SKIP_PGO=$(case "${CARCH}" in armv7h|i686) echo 1 ;; *) echo 0 ;; esac) -# use GCC vs LLVM for 32-bit arches, 64-bit optionally -# trying one or the other, may resolve rolling compiler/linker discrepancies -readonly _SHOULD_USE_GCC=$(case "${CARCH}" in armv7h) echo 1 ;; *) echo 0 ;; esac) +# use GCC vs LLVM +# trying one or the other, may resolve sporadic compiler/linker discrepancies +readonly _USE_ALT_COMPILER=$(case "${CARCH}" in armv7h) echo 1 ;; *) echo 0 ;; esac) + +# use 'bfd' linker vs 'lld' +# most significantly, this also disables LTO and debugging +# try this if the build freezes or crashes due to resource exhaustion +# FIXME: x86_64 FTBS with LTO due to resource exhaustion +# luke added a swapfile to beefcake, because this build crashed the server +# apparently, a measly 32GB RAM is no longer sufficient to contain this beast +# the system no longer crashes now; but the build process gets killed instead +# > clang-15: error: unable to execute command: Killed +readonly _USE_ALT_LINKER=$(case "${CARCH}" in i686|x86_64) echo 1 ;; *) echo 0 ;; esac) ## dependency tweaks ## @@ -445,18 +455,31 @@ END ## [ARCH-SPECIFIC CONFIG] ## - case ${CARCH} in - aarch64|armv7h) - # experimental/version-specific hacks # - - (( ! _SHOULD_USE_GCC )) || - cat >> ../mozconfig <<EOF + if (( _USE_ALT_COMPILER )) + then cat >> ../mozconfig <<END export CC=gcc export CXX=g++ export AR=gcc-ar export NM=gcc-nm export RANLIB=gcc-ranlib -EOF +END + fi + + if (( _USE_ALT_LINKER )) + then sed -i '/cargo_rustc_flags += -Clto/d' config/makefiles/rust.mk + cat >> ../mozconfig <<END +ac_add_options --disable-linker=lld +ac_add_options --enable-linker=bfd +ac_add_options --disable-lto +ac_add_options --disable-rust-simd +ac_add_options --disable-debug +ac_add_options --disable-debug-symbols +END + fi + + case ${CARCH} in + aarch64|armv7h) + # experimental/version-specific hacks # # ld.lld: error: undefined hidden symbol: std::type_info::operator==(std::type_info const&) const echo 'ac_add_options --with-system-icu' >> ../mozconfig @@ -464,7 +487,7 @@ EOF # archarm configuration # - # archarm has these over-rides in ## general configuration ## above + # archarm recipe has mozconfig over-rides under the 'general configuration' section # NOTE: '--disable-eme' is currently an invalid option for armv7h. # It must be deleted in order to compile. # If ever it becomes valid, it should not be deleted below. @@ -499,8 +522,8 @@ EOF # archarm patching is under the 'technical patching' section - # At this point in the recipe (this `case` block), the arch, arch32, and parabola - # PKGBUILDs have prepared a temporary ${srcdir}/mozconfig; but the archarm PKGBUILD + # NOTE: At this point in the recipe, the arch, arch32, and parabola PKGBUILDs + # have prepared a temporary ${srcdir}/mozconfig; but the archarm PKGBUILD # writes directly to the final firefox-$pkgver/.mozconfig. # We allowed .mozconfig to be written above, only to minimize the diff against archarm. # For consistency across arches, we append those changes to ${srcdir}/mozconfig now. @@ -510,37 +533,17 @@ EOF i686) # experimental/version-specific hacks # - (( ! _SHOULD_USE_GCC )) || - cat >>../mozconfig <<END -export CC=gcc -export CXX=g++ -export AR=gcc-ar -export NM=gcc-nm -export RANLIB=gcc-ranlib -END - # arch32 configuration # # arch32 `export` commands are under the '[ARCH-SPECIFIC BUILD ENV]' section - # NOTE: arch32 has these over-rides and the compiler flags above, in mozconfig-i686.patch - # disable LTO as it has little benefit and uses too many resources - # don't compile with clang, use gcc toolchain (clang has issues on IA32) - # disable SIMD (SSE2 for i686) - # set correct compiler and toochain tools + # arch32 recipe has mozconfig over-rides in mozconfig-i686.patch + # in this recipe, the '_USE_ALT_LINKER' block includes most of them cat >>../mozconfig <<END -ac_add_options --disable-linker=lld -ac_add_options --enable-linker=bfd -ac_add_options --disable-lto -ac_add_options --disable-rust-simd -ac_add_options --disable-debug -ac_add_options --disable-debug-symbols ac_add_options --disable-webrtc END - sed -i '/cargo_rustc_flags += -Clto/d' config/makefiles/rust.mk # FIXME: is this needed? - # arch32 patching is under the 'technical patching' section ;; x86_64) @@ -759,7 +762,7 @@ build() { ## PGO build ## - if (( _SHOULD_SKIP_PGO )) + if (( _SKIP_PGO )) then # skipping "3-tier PGO" "instrumented browser"; so the final .mozconfig is ready now cp ../mozconfig .mozconfig @@ -795,7 +798,7 @@ ac_add_options --enable-profile-use=cross ac_add_options --with-pgo-profile-path=${PWD@Q}/merged.profdata ac_add_options --with-pgo-jarlog=${PWD@Q}/jarlog END - fi # _SHOULD_SKIP_PGO + fi # _SKIP_PGO ## sanity checks ## @@ -805,7 +808,7 @@ END ## main build ## - (( ! _SHOULD_SKIP_PGO )) || echo "Building optimized browser..." + (( ! _SKIP_PGO )) || echo "Building optimized browser..." ./mach build # echo "Building symbol archive..." # anti-feature |