Date: Wednesday, September 8, 2021 @ 03:16:45 Author: heftig Revision: 423535
archrelease: copy trunk to extra-x86_64 Added: js78/repos/extra-x86_64/0001-Fixes-for-LTO-PGO-support.patch (from rev 423534, js78/trunk/0001-Fixes-for-LTO-PGO-support.patch) js78/repos/extra-x86_64/PKGBUILD (from rev 423534, js78/trunk/PKGBUILD) Deleted: js78/repos/extra-x86_64/0001-Fixes-for-LTO-PGO-support.patch js78/repos/extra-x86_64/PKGBUILD --------------------------------------+ 0001-Fixes-for-LTO-PGO-support.patch | 206 +++++++++++++-------------- PKGBUILD | 246 ++++++++++++++++----------------- 2 files changed, 226 insertions(+), 226 deletions(-) Deleted: 0001-Fixes-for-LTO-PGO-support.patch =================================================================== --- 0001-Fixes-for-LTO-PGO-support.patch 2021-09-08 03:16:25 UTC (rev 423534) +++ 0001-Fixes-for-LTO-PGO-support.patch 2021-09-08 03:16:45 UTC (rev 423535) @@ -1,103 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: "Jan Alexander Steffens (heftig)" <jan.steff...@gmail.com> -Date: Tue, 17 Nov 2020 22:45:47 +0100 -Subject: [PATCH] Fixes for LTO+PGO support - -Cherry-picked from Firefox Nightly. ---- - build/moz.configure/lto-pgo.configure | 7 +++++-- - config/makefiles/rust.mk | 21 +++++++++++++++++---- - 2 files changed, 22 insertions(+), 6 deletions(-) - -diff --git a/build/moz.configure/lto-pgo.configure b/build/moz.configure/lto-pgo.configure -index 366c6691f7d11..e5342a037ee92 100644 ---- a/build/moz.configure/lto-pgo.configure -+++ b/build/moz.configure/lto-pgo.configure -@@ -229,7 +229,10 @@ def lto(value, c_compiler, ld64_known_good, target, instrumented_build): - # instruction sets. - else: - num_cores = multiprocessing.cpu_count() -- cflags.append("-flto") -+ if len(value) and value[0].lower() == 'full': -+ cflags.append("-flto") -+ else: -+ cflags.append("-flto=thin") - cflags.append("-flifetime-dse=1") - - ldflags.append("-flto=%s" % num_cores) -@@ -258,6 +261,6 @@ set_config('MOZ_LTO', lto.enabled) - set_define('MOZ_LTO', lto.enabled) - set_config('MOZ_LTO_CFLAGS', lto.cflags) - set_config('MOZ_LTO_LDFLAGS', lto.ldflags) --set_config('MOZ_LTO_RUST', lto.rust_lto) -+set_config('MOZ_LTO_RUST_CROSS', lto.rust_lto) - add_old_configure_assignment('MOZ_LTO_CFLAGS', lto.cflags) - add_old_configure_assignment('MOZ_LTO_LDFLAGS', lto.ldflags) -diff --git a/config/makefiles/rust.mk b/config/makefiles/rust.mk -index f4475054f8979..f19dfbc72fad0 100644 ---- a/config/makefiles/rust.mk -+++ b/config/makefiles/rust.mk -@@ -59,17 +59,19 @@ cargo_rustc_flags = $(CARGO_RUSTCFLAGS) - ifndef DEVELOPER_OPTIONS - ifndef MOZ_DEBUG_RUST - # Enable link-time optimization for release builds, but not when linking --# gkrust_gtest. -+# gkrust_gtest. And not when doing cross-language LTO. -+ifndef MOZ_LTO_RUST_CROSS - ifeq (,$(findstring gkrust_gtest,$(RUST_LIBRARY_FILE))) - cargo_rustc_flags += -Clto - endif - # Versions of rust >= 1.45 need -Cembed-bitcode=yes for all crates when - # using -Clto. - ifeq (,$(filter 1.38.% 1.39.% 1.40.% 1.41.% 1.42.% 1.43.% 1.44.%,$(RUSTC_VERSION))) - RUSTFLAGS += -Cembed-bitcode=yes - endif - endif - endif -+endif - - ifdef CARGO_INCREMENTAL - export CARGO_INCREMENTAL -@@ -195,10 +197,19 @@ target_rust_ltoable := force-cargo-library-build - target_rust_nonltoable := force-cargo-test-run force-cargo-library-check $(foreach b,build check,force-cargo-program-$(b)) - - ifdef MOZ_PGO_RUST --rust_pgo_flags := $(if $(MOZ_PROFILE_GENERATE),-C profile-generate=$(topobjdir)) $(if $(MOZ_PROFILE_USE),-C profile-use=$(PGO_PROFILE_PATH)) -+ifdef MOZ_PROFILE_GENERATE -+rust_pgo_flags := -C profile-generate=$(topobjdir) -+# The C compiler may be passed extra llvm flags for PGO that we also want to pass to rust as well. -+# In PROFILE_GEN_CFLAGS, they look like "-mllvm foo", and we want "-C llvm-args=foo", so first turn -+# "-mllvm foo" into "-mllvm:foo" so that it becomes a unique argument, that we can then filter for, -+# excluding other flags, and then turn into the right string. -+rust_pgo_flags += $(patsubst -mllvm:%,-C llvm-args=%,$(filter -mllvm:%,$(subst -mllvm ,-mllvm:,$(PROFILE_GEN_CFLAGS)))) -+else # MOZ_PROFILE_USE -+rust_pgo_flags := -C profile-use=$(PGO_PROFILE_PATH) -+endif - endif - --$(target_rust_ltoable): RUSTFLAGS:=$(rustflags_override) $(rustflags_sancov) $(RUSTFLAGS) $(if $(MOZ_LTO_RUST),-Clinker-plugin-lto) $(rust_pgo_flags) -+$(target_rust_ltoable): RUSTFLAGS:=$(rustflags_override) $(rustflags_sancov) $(RUSTFLAGS) $(if $(MOZ_LTO_RUST_CROSS),-Clinker-plugin-lto) $(rust_pgo_flags) - $(target_rust_nonltoable): RUSTFLAGS:=$(rustflags_override) $(rustflags_sancov) $(RUSTFLAGS) - - TARGET_RECIPES := $(target_rust_ltoable) $(target_rust_nonltoable) -@@ -312,17 +323,19 @@ $(RUST_LIBRARY_FILE): force-cargo-library-build - # When we are building in --enable-release mode; we add an additional check to confirm - # that we are not importing any networking-related functions in rust code. This reduces - # the chance of proxy bypasses originating from rust code. --# The check only works when rust code is built with -Clto. -+# The check only works when rust code is built with -Clto but without MOZ_LTO_RUST_CROSS. - # Sanitizers and sancov also fail because compiler-rt hooks network functions. - ifndef MOZ_PROFILE_GENERATE - ifeq ($(OS_ARCH), Linux) - ifeq (,$(rustflags_sancov)$(MOZ_ASAN)$(MOZ_TSAN)$(MOZ_UBSAN)) -+ifndef MOZ_LTO_RUST_CROSS - ifneq (,$(filter -Clto,$(cargo_rustc_flags))) - $(call py_action,check_binary,--target --networking $@) - endif - endif - endif - endif -+endif - - force-cargo-library-check: - $(call CARGO_CHECK) --lib $(cargo_target_flag) $(rust_features_flag) Copied: js78/repos/extra-x86_64/0001-Fixes-for-LTO-PGO-support.patch (from rev 423534, js78/trunk/0001-Fixes-for-LTO-PGO-support.patch) =================================================================== --- 0001-Fixes-for-LTO-PGO-support.patch (rev 0) +++ 0001-Fixes-for-LTO-PGO-support.patch 2021-09-08 03:16:45 UTC (rev 423535) @@ -0,0 +1,103 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: "Jan Alexander Steffens (heftig)" <jan.steff...@gmail.com> +Date: Tue, 17 Nov 2020 22:45:47 +0100 +Subject: [PATCH] Fixes for LTO+PGO support + +Cherry-picked from Firefox Nightly. +--- + build/moz.configure/lto-pgo.configure | 7 +++++-- + config/makefiles/rust.mk | 21 +++++++++++++++++---- + 2 files changed, 22 insertions(+), 6 deletions(-) + +diff --git a/build/moz.configure/lto-pgo.configure b/build/moz.configure/lto-pgo.configure +index 366c6691f7d11..e5342a037ee92 100644 +--- a/build/moz.configure/lto-pgo.configure ++++ b/build/moz.configure/lto-pgo.configure +@@ -229,7 +229,10 @@ def lto(value, c_compiler, ld64_known_good, target, instrumented_build): + # instruction sets. + else: + num_cores = multiprocessing.cpu_count() +- cflags.append("-flto") ++ if len(value) and value[0].lower() == 'full': ++ cflags.append("-flto") ++ else: ++ cflags.append("-flto=thin") + cflags.append("-flifetime-dse=1") + + ldflags.append("-flto=%s" % num_cores) +@@ -258,6 +261,6 @@ set_config('MOZ_LTO', lto.enabled) + set_define('MOZ_LTO', lto.enabled) + set_config('MOZ_LTO_CFLAGS', lto.cflags) + set_config('MOZ_LTO_LDFLAGS', lto.ldflags) +-set_config('MOZ_LTO_RUST', lto.rust_lto) ++set_config('MOZ_LTO_RUST_CROSS', lto.rust_lto) + add_old_configure_assignment('MOZ_LTO_CFLAGS', lto.cflags) + add_old_configure_assignment('MOZ_LTO_LDFLAGS', lto.ldflags) +diff --git a/config/makefiles/rust.mk b/config/makefiles/rust.mk +index f4475054f8979..f19dfbc72fad0 100644 +--- a/config/makefiles/rust.mk ++++ b/config/makefiles/rust.mk +@@ -59,17 +59,19 @@ cargo_rustc_flags = $(CARGO_RUSTCFLAGS) + ifndef DEVELOPER_OPTIONS + ifndef MOZ_DEBUG_RUST + # Enable link-time optimization for release builds, but not when linking +-# gkrust_gtest. ++# gkrust_gtest. And not when doing cross-language LTO. ++ifndef MOZ_LTO_RUST_CROSS + ifeq (,$(findstring gkrust_gtest,$(RUST_LIBRARY_FILE))) + cargo_rustc_flags += -Clto + endif + # Versions of rust >= 1.45 need -Cembed-bitcode=yes for all crates when + # using -Clto. + ifeq (,$(filter 1.38.% 1.39.% 1.40.% 1.41.% 1.42.% 1.43.% 1.44.%,$(RUSTC_VERSION))) + RUSTFLAGS += -Cembed-bitcode=yes + endif + endif + endif ++endif + + ifdef CARGO_INCREMENTAL + export CARGO_INCREMENTAL +@@ -195,10 +197,19 @@ target_rust_ltoable := force-cargo-library-build + target_rust_nonltoable := force-cargo-test-run force-cargo-library-check $(foreach b,build check,force-cargo-program-$(b)) + + ifdef MOZ_PGO_RUST +-rust_pgo_flags := $(if $(MOZ_PROFILE_GENERATE),-C profile-generate=$(topobjdir)) $(if $(MOZ_PROFILE_USE),-C profile-use=$(PGO_PROFILE_PATH)) ++ifdef MOZ_PROFILE_GENERATE ++rust_pgo_flags := -C profile-generate=$(topobjdir) ++# The C compiler may be passed extra llvm flags for PGO that we also want to pass to rust as well. ++# In PROFILE_GEN_CFLAGS, they look like "-mllvm foo", and we want "-C llvm-args=foo", so first turn ++# "-mllvm foo" into "-mllvm:foo" so that it becomes a unique argument, that we can then filter for, ++# excluding other flags, and then turn into the right string. ++rust_pgo_flags += $(patsubst -mllvm:%,-C llvm-args=%,$(filter -mllvm:%,$(subst -mllvm ,-mllvm:,$(PROFILE_GEN_CFLAGS)))) ++else # MOZ_PROFILE_USE ++rust_pgo_flags := -C profile-use=$(PGO_PROFILE_PATH) ++endif + endif + +-$(target_rust_ltoable): RUSTFLAGS:=$(rustflags_override) $(rustflags_sancov) $(RUSTFLAGS) $(if $(MOZ_LTO_RUST),-Clinker-plugin-lto) $(rust_pgo_flags) ++$(target_rust_ltoable): RUSTFLAGS:=$(rustflags_override) $(rustflags_sancov) $(RUSTFLAGS) $(if $(MOZ_LTO_RUST_CROSS),-Clinker-plugin-lto) $(rust_pgo_flags) + $(target_rust_nonltoable): RUSTFLAGS:=$(rustflags_override) $(rustflags_sancov) $(RUSTFLAGS) + + TARGET_RECIPES := $(target_rust_ltoable) $(target_rust_nonltoable) +@@ -312,17 +323,19 @@ $(RUST_LIBRARY_FILE): force-cargo-library-build + # When we are building in --enable-release mode; we add an additional check to confirm + # that we are not importing any networking-related functions in rust code. This reduces + # the chance of proxy bypasses originating from rust code. +-# The check only works when rust code is built with -Clto. ++# The check only works when rust code is built with -Clto but without MOZ_LTO_RUST_CROSS. + # Sanitizers and sancov also fail because compiler-rt hooks network functions. + ifndef MOZ_PROFILE_GENERATE + ifeq ($(OS_ARCH), Linux) + ifeq (,$(rustflags_sancov)$(MOZ_ASAN)$(MOZ_TSAN)$(MOZ_UBSAN)) ++ifndef MOZ_LTO_RUST_CROSS + ifneq (,$(filter -Clto,$(cargo_rustc_flags))) + $(call py_action,check_binary,--target --networking $@) + endif + endif + endif + endif ++endif + + force-cargo-library-check: + $(call CARGO_CHECK) --lib $(cargo_target_flag) $(rust_features_flag) Deleted: PKGBUILD =================================================================== --- PKGBUILD 2021-09-08 03:16:25 UTC (rev 423534) +++ PKGBUILD 2021-09-08 03:16:45 UTC (rev 423535) @@ -1,123 +0,0 @@ -# Maintainer: Jan Alexander Steffens (heftig) <hef...@archlinux.org> - -pkgname=js78 -pkgver=78.13.0 -pkgrel=1 -pkgdesc="JavaScript interpreter and libraries - Version 78" -arch=(x86_64) -url="https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey" -license=(MPL) -depends=(gcc-libs readline zlib sh) -makedepends=(zip autoconf2.13 python-setuptools python-psutil rust llvm clang lld) -checkdepends=(mercurial git) -_relver=${pkgver}esr -source=(https://archive.mozilla.org/pub/firefox/releases/$_relver/source/firefox-$_relver.source.tar.xz{,.asc} - 0001-Fixes-for-LTO-PGO-support.patch) -sha256sums=('19f9a9e2c2473cb37d57a49a1b2661a8236c4930df9b251d5e9ae274292b4f6c' - 'SKIP' - '926a573eabe3b6177363b795ed5e5641b4a4ebc6d7cfa093f11e1779ac0f897c') -validpgpkeys=('14F26682D0916CDD81E37B6D61B7B526D98F0353') # Mozilla Software Releases <rele...@mozilla.com> - -# Make sure the duplication between bin and lib is found -COMPRESSZST+=(--long) - -prepare() { - cd firefox-$pkgver - mkdir obj - - # Post-78 fixes to fix LTO with LLVM 11 - patch -Np1 -i ../0001-Fixes-for-LTO-PGO-support.patch -} - -build() { - local configure_args=( - --prefix=/usr - --disable-debug - --disable-debug-symbols - --disable-jemalloc - --disable-strip - --enable-hardening - --enable-linker=lld - --enable-optimize - --enable-readline - --enable-release - --enable-rust-simd - --enable-shared-js - --enable-tests - --with-intl-api - --with-system-zlib - --without-system-icu - ) - - export CC=clang - export CXX=clang++ - export AR=llvm-ar - export NM=llvm-nm - export RANLIB=llvm-ranlib - - cd firefox-$pkgver/obj - - # Do 3-tier PGO - echo "Building instrumented JS..." - sh ../js/src/configure "${configure_args[@]}" \ - --enable-profile-generate=cross - make - - echo "Profiling instrumented JS..." - ( - local js="$PWD/dist/bin/js" - export LLVM_PROFILE_FILE="$PWD/js-%p-%m.profraw" - - cd ../js/src/octane - "$js" run.js - - cd ../../../third_party/webkit/PerformanceTests/ARES-6 - "$js" cli.js - - cd ../SunSpider/sunspider-0.9.1 - "$js" sunspider-standalone-driver.js - ) - - llvm-profdata merge -o merged.profdata *.profraw - - stat -c "Profile data found (%s bytes)" merged.profdata - test -s merged.profdata - - echo "Removing instrumented JS..." - make clobber - - echo "Building optimized JS..." - sh ../js/src/configure "${configure_args[@]}" \ - --enable-lto=cross \ - --enable-profile-use=cross \ - --with-pgo-profile-path="$PWD/merged.profdata" - make -} - -check() { - local jstests_extra_args=( - --format=none - --exclude-random - --wpt=disabled - ) jittest_extra_args=( - --format=none - --timeout 300 - ) jittest_test_args=( - basic - ) - - cd firefox-$pkgver/obj - make -C js/src check-jstests check-jit-test \ - JSTESTS_EXTRA_ARGS="${jstests_extra_args[*]}" \ - JITTEST_EXTRA_ARGS="${jittest_extra_args[*]}" \ - JITTEST_TEST_ARGS="${jittest_test_args[*]}" -} - -package() { - cd firefox-$pkgver/obj - make DESTDIR="$pkgdir" install - rm "$pkgdir"/usr/lib/*.ajs - find "$pkgdir"/usr/{lib/pkgconfig,include} -type f -exec chmod -c a-x {} + -} - -# vim:set ts=2 sw=2 et: Copied: js78/repos/extra-x86_64/PKGBUILD (from rev 423534, js78/trunk/PKGBUILD) =================================================================== --- PKGBUILD (rev 0) +++ PKGBUILD 2021-09-08 03:16:45 UTC (rev 423535) @@ -0,0 +1,123 @@ +# Maintainer: Jan Alexander Steffens (heftig) <hef...@archlinux.org> + +pkgname=js78 +pkgver=78.14.0 +pkgrel=1 +pkgdesc="JavaScript interpreter and libraries - Version 78" +arch=(x86_64) +url="https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey" +license=(MPL) +depends=(gcc-libs readline zlib sh) +makedepends=(zip autoconf2.13 python-setuptools python-psutil rust llvm clang lld) +checkdepends=(mercurial git) +_relver=${pkgver}esr +source=(https://archive.mozilla.org/pub/firefox/releases/$_relver/source/firefox-$_relver.source.tar.xz{,.asc} + 0001-Fixes-for-LTO-PGO-support.patch) +sha256sums=('aa0e28a4150c33a165120a24f20e0373e74635c9f812732a08850d71cda3b2fa' + 'SKIP' + '926a573eabe3b6177363b795ed5e5641b4a4ebc6d7cfa093f11e1779ac0f897c') +validpgpkeys=('14F26682D0916CDD81E37B6D61B7B526D98F0353') # Mozilla Software Releases <rele...@mozilla.com> + +# Make sure the duplication between bin and lib is found +COMPRESSZST+=(--long) + +prepare() { + cd firefox-$pkgver + mkdir obj + + # Post-78 fixes to fix LTO with LLVM 11 + patch -Np1 -i ../0001-Fixes-for-LTO-PGO-support.patch +} + +build() { + local configure_args=( + --prefix=/usr + --disable-debug + --disable-debug-symbols + --disable-jemalloc + --disable-strip + --enable-hardening + --enable-linker=lld + --enable-optimize + --enable-readline + --enable-release + --enable-rust-simd + --enable-shared-js + --enable-tests + --with-intl-api + --with-system-zlib + --without-system-icu + ) + + export CC=clang + export CXX=clang++ + export AR=llvm-ar + export NM=llvm-nm + export RANLIB=llvm-ranlib + + cd firefox-$pkgver/obj + + # Do 3-tier PGO + echo "Building instrumented JS..." + sh ../js/src/configure "${configure_args[@]}" \ + --enable-profile-generate=cross + make + + echo "Profiling instrumented JS..." + ( + local js="$PWD/dist/bin/js" + export LLVM_PROFILE_FILE="$PWD/js-%p-%m.profraw" + + cd ../js/src/octane + "$js" run.js + + cd ../../../third_party/webkit/PerformanceTests/ARES-6 + "$js" cli.js + + cd ../SunSpider/sunspider-0.9.1 + "$js" sunspider-standalone-driver.js + ) + + llvm-profdata merge -o merged.profdata *.profraw + + stat -c "Profile data found (%s bytes)" merged.profdata + test -s merged.profdata + + echo "Removing instrumented JS..." + make clobber + + echo "Building optimized JS..." + sh ../js/src/configure "${configure_args[@]}" \ + --enable-lto=cross \ + --enable-profile-use=cross \ + --with-pgo-profile-path="$PWD/merged.profdata" + make +} + +check() { + local jstests_extra_args=( + --format=none + --exclude-random + --wpt=disabled + ) jittest_extra_args=( + --format=none + --timeout 300 + ) jittest_test_args=( + basic + ) + + cd firefox-$pkgver/obj + make -C js/src check-jstests check-jit-test \ + JSTESTS_EXTRA_ARGS="${jstests_extra_args[*]}" \ + JITTEST_EXTRA_ARGS="${jittest_extra_args[*]}" \ + JITTEST_TEST_ARGS="${jittest_test_args[*]}" +} + +package() { + cd firefox-$pkgver/obj + make DESTDIR="$pkgdir" install + rm "$pkgdir"/usr/lib/*.ajs + find "$pkgdir"/usr/{lib/pkgconfig,include} -type f -exec chmod -c a-x {} + +} + +# vim:set ts=2 sw=2 et: