Fixed PGO/LTO builds
This commit is contained in:
parent
2e8349261d
commit
18fd042dec
@ -1,5 +1,5 @@
|
||||
# Set to true if it's going to be submitted as update.
|
||||
%global release_build 0
|
||||
%global release_build 1
|
||||
%global debug_build 0
|
||||
%global build_with_clang 0
|
||||
%global build_with_asan 0
|
||||
@ -118,7 +118,7 @@ ExcludeArch: s390x
|
||||
Summary: Mozilla Firefox Web browser
|
||||
Name: firefox
|
||||
Version: 77.0.1
|
||||
Release: 2%{?nss_tag}%{?dist}
|
||||
Release: 3%{?nss_tag}%{?dist}
|
||||
URL: https://www.mozilla.org/firefox/
|
||||
License: MPLv1.1 or GPLv2+ or LGPLv2+
|
||||
Source0: https://archive.mozilla.org/pub/firefox/releases/%{version}%{?pre_version}/source/firefox-%{version}%{?pre_version}.source.tar.xz
|
||||
@ -983,6 +983,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
|
||||
#---------------------------------------------------------------------
|
||||
|
||||
%changelog
|
||||
* Tue Jun 23 2020 Martin Stransky <stransky@redhat.com> - 77.0.1-3
|
||||
- Build with PGO/LTO again.
|
||||
|
||||
* Wed Jun 03 2020 Jan Horak <jhorak@redhat.com> - 77.0.1-2
|
||||
- Update to 77.0.1 build1
|
||||
|
||||
|
97
pgo.patch
97
pgo.patch
@ -1,7 +1,76 @@
|
||||
diff -up firefox-70.0/build/mozconfig.pgo firefox-70.0/build/mozconfig
|
||||
diff -up firefox-70.0/build/unix/mozconfig.unix.pgo firefox-70.0/build/unix/mozconfig.unix
|
||||
--- firefox-70.0/build/unix/mozconfig.unix.pgo 2019-10-18 18:05:36.461701704 +0200
|
||||
+++ firefox-70.0/build/unix/mozconfig.unix 2019-10-18 20:25:48.036037912 +0200
|
||||
diff -up firefox-77.0.1/build/moz.configure/lto-pgo.configure.pgo firefox-77.0.1/build/moz.configure/lto-pgo.configure
|
||||
--- firefox-77.0.1/build/moz.configure/lto-pgo.configure.pgo 2020-06-03 01:35:41.000000000 +0200
|
||||
+++ firefox-77.0.1/build/moz.configure/lto-pgo.configure 2020-06-23 14:39:38.716560329 +0200
|
||||
@@ -69,12 +69,14 @@ set_config('PGO_PROFILE_PATH', pgo_profi
|
||||
@imports(_from='__builtin__', _import='min')
|
||||
def pgo_flags(compiler, profdata, target_is_windows):
|
||||
if compiler.type == 'gcc':
|
||||
+ #profile_use = '-fprofile-use=$(topobjdir)'
|
||||
+ profile_use = '-fprofile-use'
|
||||
return namespace(
|
||||
gen_cflags=['-fprofile-generate'],
|
||||
gen_ldflags=['-fprofile-generate'],
|
||||
- use_cflags=['-fprofile-use', '-fprofile-correction',
|
||||
+ use_cflags=[profile_use, '-fprofile-correction',
|
||||
'-Wcoverage-mismatch'],
|
||||
- use_ldflags=['-fprofile-use'],
|
||||
+ use_ldflags=[profile_use],
|
||||
)
|
||||
|
||||
if compiler.type in ('clang-cl', 'clang'):
|
||||
diff -up firefox-77.0.1/build/pgo/profileserver.py.pgo firefox-77.0.1/build/pgo/profileserver.py
|
||||
--- firefox-77.0.1/build/pgo/profileserver.py.pgo 2020-06-03 03:04:50.000000000 +0200
|
||||
+++ firefox-77.0.1/build/pgo/profileserver.py 2020-06-23 14:53:56.877736235 +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
|
||||
@@ -84,9 +84,22 @@ if __name__ == '__main__':
|
||||
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
|
||||
@@ -191,6 +204,11 @@ 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-77.0.1/build/unix/mozconfig.unix.pgo firefox-77.0.1/build/unix/mozconfig.unix
|
||||
--- firefox-77.0.1/build/unix/mozconfig.unix.pgo 2020-06-03 01:35:41.000000000 +0200
|
||||
+++ firefox-77.0.1/build/unix/mozconfig.unix 2020-06-23 14:39:38.716560329 +0200
|
||||
@@ -6,6 +6,15 @@ if [ -n "$FORCE_GCC" ]; then
|
||||
CC="$MOZ_FETCHES_DIR/gcc/bin/gcc"
|
||||
CXX="$MOZ_FETCHES_DIR/gcc/bin/g++"
|
||||
@ -18,9 +87,10 @@ diff -up firefox-70.0/build/unix/mozconfig.unix.pgo firefox-70.0/build/unix/mozc
|
||||
# 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-70.0/extensions/spellcheck/src/moz.build.pgo firefox-70.0/extensions/spellcheck/src/moz.build
|
||||
--- firefox-70.0/extensions/spellcheck/src/moz.build.pgo 2019-10-16 23:20:18.000000000 +0200
|
||||
+++ firefox-70.0/extensions/spellcheck/src/moz.build 2019-10-18 18:05:36.461701704 +0200
|
||||
diff -up firefox-77.0.1/config/config.mk.pgo firefox-77.0.1/config/config.mk
|
||||
diff -up firefox-77.0.1/extensions/spellcheck/src/moz.build.pgo firefox-77.0.1/extensions/spellcheck/src/moz.build
|
||||
--- firefox-77.0.1/extensions/spellcheck/src/moz.build.pgo 2020-06-03 01:35:48.000000000 +0200
|
||||
+++ firefox-77.0.1/extensions/spellcheck/src/moz.build 2020-06-23 14:39:38.717560324 +0200
|
||||
@@ -31,3 +31,5 @@ EXPORTS.mozilla += [
|
||||
|
||||
if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
|
||||
@ -28,3 +98,16 @@ diff -up firefox-70.0/extensions/spellcheck/src/moz.build.pgo firefox-70.0/exten
|
||||
+
|
||||
+CXXFLAGS += ['-fno-devirtualize']
|
||||
\ No newline at end of file
|
||||
diff -up firefox-77.0.1/python/mozbuild/mozbuild/build_commands.py.pgo firefox-77.0.1/python/mozbuild/mozbuild/build_commands.py
|
||||
--- firefox-77.0.1/python/mozbuild/mozbuild/build_commands.py.pgo 2020-06-03 01:36:46.000000000 +0200
|
||||
+++ firefox-77.0.1/python/mozbuild/mozbuild/build_commands.py 2020-06-23 14:39:38.717560324 +0200
|
||||
@@ -114,7 +114,8 @@ class Build(MachCommandBase):
|
||||
return status
|
||||
|
||||
pgo_env = os.environ.copy()
|
||||
- pgo_env['LLVM_PROFDATA'] = instr.config_environment.substs.get('LLVM_PROFDATA')
|
||||
+ if instr.config_environment.substs.get('CC_TYPE') != 'gcc':
|
||||
+ pgo_env['LLVM_PROFDATA'] = instr.config_environment.substs.get('LLVM_PROFDATA')
|
||||
pgo_env['JARLOG_FILE'] = mozpath.join(orig_topobjdir, 'jarlog/en-US.log')
|
||||
pgo_cmd = [
|
||||
instr.virtualenv_manager.python_path,
|
||||
|
Loading…
Reference in New Issue
Block a user