summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjc_gargma <jc_gargma@iserlohn-fortress.net>2021-11-14 13:45:57 -0800
committerjc_gargma <jc_gargma@iserlohn-fortress.net>2021-11-14 13:45:57 -0800
commit39b1e4c62637e49676c47380c7fe5a41d92b3c77 (patch)
tree8c900e0ae7bb248bdd0dd5cf90c017afc61f8a66
parentUpdated to 91.3.0 (diff)
downloadfirefox-esr-39b1e4c62637e49676c47380c7fe5a41d92b3c77.tar.xz
Archive some old patches before I delete them.
-rw-r--r--arc4_enable-lto-for-gcc.patch14
-rw-r--r--firefox-gcc-build.patch38
-rw-r--r--mozconfig.in.gcc74
-rw-r--r--pgo.patch112
4 files changed, 238 insertions, 0 deletions
diff --git a/arc4_enable-lto-for-gcc.patch b/arc4_enable-lto-for-gcc.patch
new file mode 100644
index 0000000..982f68a
--- /dev/null
+++ b/arc4_enable-lto-for-gcc.patch
@@ -0,0 +1,14 @@
+--- a/security/sandbox/linux/moz.build
++++ b/security/sandbox/linux/moz.build
+@@ -99,9 +99,8 @@ if CONFIG['CC_TYPE'] in ('clang', 'gcc')
+ # gcc lto likes to put the top level asm in syscall.cc in a different partition
+ # from the function using it which breaks the build. Work around that by
+ # forcing there to be only one partition.
+-for f in CONFIG["OS_CXXFLAGS"]:
+- if f.startswith("-flto") and CONFIG["CC_TYPE"] != "clang":
+- LDFLAGS += ["--param lto-partitions=1"]
++if CONFIG['CC_TYPE'] != 'clang':
++ LDFLAGS += ['--param', 'lto-partitions=1']
+
+ DEFINES["NS_NO_XPCOM"] = True
+ DisableStlWrapping()
diff --git a/firefox-gcc-build.patch b/firefox-gcc-build.patch
new file mode 100644
index 0000000..55017ad
--- /dev/null
+++ b/firefox-gcc-build.patch
@@ -0,0 +1,38 @@
+--- firefox-80.0.1/toolkit/crashreporter/google-breakpad/src/third_party/lss/linux_syscall_support.h 2020-08-31 10:04:19.000000000 -0400
++++ firefox-80.0.1/toolkit/crashreporter/google-breakpad/src/third_party/lss/linux_syscall_support.h 2020-09-12 07:24:35.298931628 -0400
+@@ -1962,7 +1962,7 @@ struct kernel_statfs {
+ LSS_ENTRYPOINT \
+ "pop %%ebx" \
+ args \
+- : "esp", "memory"); \
++ : "memory"); \
+ LSS_RETURN(type,__res)
+ #undef _syscall0
+ #define _syscall0(type,name) \
+@@ -2019,7 +2019,7 @@ struct kernel_statfs {
+ : "i" (__NR_##name), "ri" ((long)(arg1)), \
+ "c" ((long)(arg2)), "d" ((long)(arg3)), \
+ "S" ((long)(arg4)), "D" ((long)(arg5)) \
+- : "esp", "memory"); \
++ : "memory"); \
+ LSS_RETURN(type,__res); \
+ }
+ #undef _syscall6
+@@ -2041,7 +2041,7 @@ struct kernel_statfs {
+ : "i" (__NR_##name), "0" ((long)(&__s)), \
+ "c" ((long)(arg2)), "d" ((long)(arg3)), \
+ "S" ((long)(arg4)), "D" ((long)(arg5)) \
+- : "esp", "memory"); \
++ : "memory"); \
+ LSS_RETURN(type,__res); \
+ }
+ LSS_INLINE int LSS_NAME(clone)(int (*fn)(void *), void *child_stack,
+@@ -2127,7 +2127,7 @@ struct kernel_statfs {
+ : "0"(-EINVAL), "i"(__NR_clone),
+ "m"(fn), "m"(child_stack), "m"(flags), "m"(arg),
+ "m"(parent_tidptr), "m"(newtls), "m"(child_tidptr)
+- : "esp", "memory", "ecx", "edx", "esi", "edi");
++ : "memory", "ecx", "edx", "esi", "edi");
+ LSS_RETURN(int, __res);
+ }
+
diff --git a/mozconfig.in.gcc b/mozconfig.in.gcc
new file mode 100644
index 0000000..b7abe2b
--- /dev/null
+++ b/mozconfig.in.gcc
@@ -0,0 +1,74 @@
+ac_add_options --enable-application=browser
+export MOZ_APP_REMOTINGNAME=${pkgname//-/}
+
+# Compiler and Linker
+ac_add_options --prefix=/usr
+ac_add_options --enable-release
+ac_add_options --disable-hardening
+ac_add_options --enable-optimize
+ac_add_options --enable-rust-simd
+# ac_add_options --enable-linker=gold
+ac_add_options --disable-elf-hack
+ac_add_options --enable-lto=full
+# # pacman can handle stripping
+# ac_add_options --enable-strip
+# ac_add_options --enable-install-strip
+export CC=gcc
+export CXX=g++
+export AR=gcc-ar
+export NM=gcc-nm
+export RANLIB=gcc-ranlib
+
+# Branding
+ac_add_options --enable-official-branding
+ac_add_options --enable-update-channel=release
+ac_add_options --with-distribution-id=org.artixlinux
+ac_add_options --with-unsigned-addon-scopes=app,system
+ac_add_options --allow-addon-sideload
+ac_add_options MOZ_TELEMETRY_REPORTING=
+export MOZILLA_OFFICIAL=1
+export MOZ_REQUIRE_SIGNING=0
+export MOZ_ADDON_SIGNING=0
+
+# System libraries
+# # system-bz2 does not work with gcc builds
+# ac_add_options --with-system-bz2
+ac_add_options --with-system-ffi
+ac_add_options --with-system-icu
+ac_add_options --with-system-jpeg
+ac_add_options --with-system-libevent
+ac_add_options --with-system-libvpx
+ac_add_options --with-system-nspr
+ac_add_options --with-system-nss
+ac_add_options --enable-system-pixman
+# # system-png does not work with gcc builds
+# ac_add_options --with-system-png
+# # system-sqlite does not work with gcc builds
+# ac_add_options --enable-system-sqlite
+ac_add_options --with-system-webp
+ac_add_options --with-system-zlib
+
+# Features
+ac_add_options --enable-alsa
+ac_add_options --enable-av1
+ac_add_options --enable-jack
+
+# Disables
+ac_add_options --disable-accessibility
+ac_add_options --disable-bootstrap
+ac_add_options --disable-cdp
+ac_add_options --disable-crashreporter
+ac_add_options --disable-debug
+ac_add_options --disable-debug-symbols
+ac_add_options --disable-eme
+# # marionette required for the xorg tests
+# ac_add_options --disable-marionette
+ac_add_options --disable-necko-wifi
+ac_add_options --disable-parental-controls
+# # precompiled-startupcache must be disabled to optimize for a newer
+# # instruction set target
+# ac_add_options --disable-precompiled-startupcache
+ac_add_options --disable-synth-speechd
+ac_add_options --disable-tests
+ac_add_options --disable-updater
+ac_add_options --disable-webspeech
diff --git a/pgo.patch b/pgo.patch
new file mode 100644
index 0000000..13a445b
--- /dev/null
+++ b/pgo.patch
@@ -0,0 +1,112 @@
+diff -up firefox-88.0/build/moz.configure/lto-pgo.configure.pgo firefox-88.0/build/moz.configure/lto-pgo.configure
+--- firefox-88.0/build/moz.configure/lto-pgo.configure.pgo 2021-04-15 21:44:26.000000000 +0200
++++ firefox-88.0/build/moz.configure/lto-pgo.configure 2021-04-19 13:45:00.240696430 +0200
+@@ -240,13 +240,13 @@ def lto(
+ cflags.append("-flto")
+ ldflags.append("-flto")
+ else:
+- cflags.append("-flto=thin")
+- ldflags.append("-flto=thin")
++ cflags.append("-flto")
++ ldflags.append("-flto")
+ elif c_compiler.type == "clang-cl":
+ if len(value) and value[0].lower() == "full":
+ cflags.append("-flto")
+ else:
+- cflags.append("-flto=thin")
++ cflags.append("-flto")
+ # With clang-cl, -flto can only be used with -c or -fuse-ld=lld.
+ # AC_TRY_LINKs during configure don't have -c, so pass -fuse-ld=lld.
+ cflags.append("-fuse-ld=lld")
+diff -up firefox-88.0/build/pgo/profileserver.py.pgo firefox-88.0/build/pgo/profileserver.py
+--- firefox-88.0/build/pgo/profileserver.py.pgo 2021-04-15 21:44:26.000000000 +0200
++++ firefox-88.0/build/pgo/profileserver.py 2021-04-19 13:45:00.240696430 +0200
+@@ -11,7 +11,7 @@ import glob
+ import subprocess
+
+ import mozcrash
+-from mozbuild.base import MozbuildObject, BinaryNotFoundException
++from mozbuild.base import MozbuildObject, BinaryNotFoundException, BuildEnvironmentNotFoundException
+ from mozfile import TemporaryDirectory
+ from mozhttpd import MozHttpd
+ from mozprofile import FirefoxProfile, Preferences
+@@ -87,9 +87,22 @@ if __name__ == "__main__":
+ locations = ServerLocations()
+ locations.add_host(host="127.0.0.1", port=PORT, options="primary,privileged")
+
+- old_profraw_files = glob.glob("*.profraw")
+- for f in old_profraw_files:
+- os.remove(f)
++ using_gcc = False
++ try:
++ if build.config_environment.substs.get('CC_TYPE') == 'gcc':
++ using_gcc = True
++ except BuildEnvironmentNotFoundException:
++ pass
++
++ if using_gcc:
++ for dirpath, _, filenames in os.walk('.'):
++ for f in filenames:
++ if f.endswith('.gcda'):
++ os.remove(os.path.join(dirpath, f))
++ else:
++ old_profraw_files = glob.glob('*.profraw')
++ for f in old_profraw_files:
++ os.remove(f)
+
+ with TemporaryDirectory() as profilePath:
+ # TODO: refactor this into mozprofile
+@@ -212,6 +225,10 @@ if __name__ == "__main__":
+ print("Firefox exited successfully, but produced a crashreport")
+ sys.exit(1)
+
++ print('Copying profile data....')
++ os.system('pwd');
++ os.system('tar cf profdata.tar.gz `find . -name "*.gcda"`; cd ..; tar xf instrumented/profdata.tar.gz;');
++
+ llvm_profdata = env.get("LLVM_PROFDATA")
+ if llvm_profdata:
+ profraw_files = glob.glob("*.profraw")
+diff -up firefox-88.0/build/unix/mozconfig.unix.pgo firefox-88.0/build/unix/mozconfig.unix
+--- firefox-88.0/build/unix/mozconfig.unix.pgo 2021-04-15 21:44:26.000000000 +0200
++++ firefox-88.0/build/unix/mozconfig.unix 2021-04-19 13:45:00.240696430 +0200
+@@ -4,6 +4,15 @@ if [ -n "$FORCE_GCC" ]; then
+ CC="$MOZ_FETCHES_DIR/gcc/bin/gcc"
+ CXX="$MOZ_FETCHES_DIR/gcc/bin/g++"
+
++ if [ -n "$MOZ_PGO" ]; then
++ if [ -z "$USE_ARTIFACT" ]; then
++ ac_add_options --enable-lto
++ fi
++ export AR="$topsrcdir/gcc/bin/gcc-ar"
++ export NM="$topsrcdir/gcc/bin/gcc-nm"
++ export RANLIB="$topsrcdir/gcc/bin/gcc-ranlib"
++ fi
++
+ # We want to make sure we use binutils and other binaries in the tooltool
+ # package.
+ mk_add_options "export PATH=$MOZ_FETCHES_DIR/gcc/bin:$PATH"
+diff -up firefox-88.0/extensions/spellcheck/src/moz.build.pgo firefox-88.0/extensions/spellcheck/src/moz.build
+--- firefox-88.0/extensions/spellcheck/src/moz.build.pgo 2021-04-15 21:44:28.000000000 +0200
++++ firefox-88.0/extensions/spellcheck/src/moz.build 2021-04-19 13:45:00.240696430 +0200
+@@ -31,3 +31,5 @@ EXPORTS.mozilla += [
+
+ if CONFIG["CC_TYPE"] in ("clang", "gcc"):
+ CXXFLAGS += ["-Wno-error=shadow"]
++
++CXXFLAGS += ['-fno-devirtualize']
+diff -up firefox-88.0/toolkit/components/terminator/nsTerminator.cpp.pgo firefox-88.0/toolkit/components/terminator/nsTerminator.cpp
+--- firefox-88.0/toolkit/components/terminator/nsTerminator.cpp.pgo 2021-04-19 13:45:00.240696430 +0200
++++ firefox-88.0/toolkit/components/terminator/nsTerminator.cpp 2021-04-19 13:46:01.144530790 +0200
+@@ -456,6 +456,11 @@ void nsTerminator::StartWatchdog() {
+ }
+ #endif
+
++ // Disable watchdog for PGO train builds - writting profile information at
++ // exit may take time and it is better to make build hang rather than
++ // silently produce poorly performing binary.
++ crashAfterMS = INT32_MAX;
++
+ UniquePtr<Options> options(new Options());
+ const PRIntervalTime ticksDuration =
+ PR_MillisecondsToInterval(HEARTBEAT_INTERVAL_MS);