diff options
author | Ismael Luceno | 2019-09-24 01:53:57 +0200 |
---|---|---|
committer | Ismael Luceno | 2019-09-24 02:22:11 +0200 |
commit | e375b003e0d630c9ada6ec79142ca9d9122a0eb7 (patch) | |
tree | 6fab32f8da5d82ffa6932c8c6c0c56e3c2025df4 /http | |
parent | 819bcf79c8342fee0f0937d90a1a7840ac587451 (diff) |
firefox: Import patches from Gentoo
Miscellaneous and musl-related build fixes.
Diffstat (limited to 'http')
16 files changed, 627 insertions, 0 deletions
diff --git a/http/firefox/HISTORY b/http/firefox/HISTORY index 2d0d5e869b..e35c0ba66f 100644 --- a/http/firefox/HISTORY +++ b/http/firefox/HISTORY @@ -1,6 +1,22 @@ 2019-09-23 Ismael Luceno <ismael@sourcemage.org> * DEPENDS, patches/7002_system_av1_support.patch: Added patch to use system dav1d + * patches/2003_blessings_TERM.patch, + patches/2004_fix_sandbox_lto.patch, + patches/2012_allow-non-ascii-chars.patch, + patches/2013_fix-audio-thread-priority.patch, + patches/3000_use_the_Mozilla_location_service_when_no_Google_key_is_available.patch, + patches/6001_add_missing_header_for_basename.patch, + patches/6002_add_alternate_name_for_private_siginfo_struct_member.patch, + patches/6003_fix_syscall_wrappers_on_musl.patch, + patches/6004_musl_memory_report.patch, + patches/6005_musl_pthread_setname.patch, + patches/6006_musl_fix_tools.patch, + patches/6007_musl_fix_toolkit.patch, + patches/6008_musl_sandbox_membarrier.patch, + patches/7000_sys_auxv_non_glibc.patch, + patches/7001_make-pgo-use-toolchain.patch: Imported build fixes and + other patches from Gentoo 2019-09-18 Pavel Vinogradov <public@sourcemage.org> * DETAILS: version 69.0.1, SECURITY_PATCH++, (CVE-2019-11754) diff --git a/http/firefox/patches/2003_blessings_TERM.patch b/http/firefox/patches/2003_blessings_TERM.patch new file mode 100644 index 0000000000..838aa05f24 --- /dev/null +++ b/http/firefox/patches/2003_blessings_TERM.patch @@ -0,0 +1,29 @@ +https://github.com/erikrose/blessings/pull/137 + +Fixes: https://bugs.gentoo.org/654316 + +From 5fefc65c306cf9ec492e7b422d6bb4842385afbc +[PATCH 1/2] Fix error when TERM is unset or improperly set + +From d885df78c6f931abf3259343aaaa897e16c8cba1 +[PATCH 2/2] Explicitly catch curses.error + + +--- a/third_party/python/blessings/blessings/__init__.py ++++ b/third_party/python/blessings/blessings/__init__.py +@@ -94,8 +94,13 @@ class Terminal(object): + # init sequences to the stream if it has a file descriptor, and + # send them to stdout as a fallback, since they have to go + # somewhere. +- setupterm(kind or environ.get('TERM', 'unknown'), +- self._init_descriptor) ++ try: ++ setupterm(kind or environ.get('TERM', 'dumb') or 'dumb', ++ self._init_descriptor) ++ except curses.error: ++ # There was an error setting up the terminal, either curses is ++ # not supported or TERM is incorrectly set. Fall back to dumb. ++ self._does_styling = False + + self.stream = stream + diff --git a/http/firefox/patches/2004_fix_sandbox_lto.patch b/http/firefox/patches/2004_fix_sandbox_lto.patch new file mode 100644 index 0000000000..ed1f8c9d92 --- /dev/null +++ b/http/firefox/patches/2004_fix_sandbox_lto.patch @@ -0,0 +1,26 @@ +# HG changeset patch +# Parent b8e6418f771de6a3a183d0bb37d313512b61bbab +https://bugs.gentoo.org/666580 + +diff --git a/security/sandbox/linux/moz.build b/security/sandbox/linux/moz.build +--- a/security/sandbox/linux/moz.build ++++ b/security/sandbox/linux/moz.build +@@ -96,17 +96,17 @@ if CONFIG['CC_TYPE'] in ('clang', 'gcc') + '-Wno-empty-body', + ] + + # 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'] ++ LDFLAGS += ['--param', 'lto-partitions=1'] + + DEFINES['NS_NO_XPCOM'] = True + DisableStlWrapping() + + LOCAL_INCLUDES += ['/security/sandbox/linux'] + LOCAL_INCLUDES += ['/security/sandbox/chromium-shim'] + LOCAL_INCLUDES += ['/security/sandbox/chromium'] + LOCAL_INCLUDES += ['/nsprpub'] diff --git a/http/firefox/patches/2012_allow-non-ascii-chars.patch b/http/firefox/patches/2012_allow-non-ascii-chars.patch new file mode 100644 index 0000000000..59937dd550 --- /dev/null +++ b/http/firefox/patches/2012_allow-non-ascii-chars.patch @@ -0,0 +1,15 @@ +https://bugs.gentoo.org/666948 + +and required for rust-1.33 patch + +--- a/python/mozbuild/mozbuild/controller/building.py ++++ b/python/mozbuild/mozbuild/controller/building.py +@@ -571,7 +571,7 @@ class TerminalLoggingHandler(logging.Handler): + if self.footer: + self.footer.clear() + +- self.fh.write(msg) ++ self.fh.write(msg.encode("utf-8")) + self.fh.write('\n') + + if self.footer: diff --git a/http/firefox/patches/2013_fix-audio-thread-priority.patch b/http/firefox/patches/2013_fix-audio-thread-priority.patch new file mode 100644 index 0000000000..d612d256c4 --- /dev/null +++ b/http/firefox/patches/2013_fix-audio-thread-priority.patch @@ -0,0 +1,34 @@ +# HG changeset patch +# Parent 641754fe8ddf9c077d0fab58c1451ea9f6949230 +Fix builds that are not using GLIBC + +diff --git a/third_party/rust/audio_thread_priority/.cargo-checksum.json b/third_party/rust/audio_thread_priority/.cargo-checksum.json +--- a/third_party/rust/audio_thread_priority/.cargo-checksum.json ++++ b/third_party/rust/audio_thread_priority/.cargo-checksum.json +@@ -1,1 +1,1 @@ +-{"files":{"Cargo.toml":"4c85ca3ce6ee93571667a430f548a1c9e73cfa621b2dac9fffa35bf280a90d9e","Makefile":"8c6b9e8afffb14ae03f9cd95bc7d6011c8b4fe01c474aef17360e3f0c4d202ad","README.md":"bcfa4948edf52fdacd485200a0c1c886a92232cc1931eeb4e1044050f46ec253","audio_thread_priority.h":"880889a154283a87cf84218cc4d6b2b9dd2c8fd09adc6d38f527b08ccd0c6168","generate_osx_bindings.sh":"06e4e03450f788ced18d31fff5660919e6f6ec1119ddace363ffeb82f0518a71","src/lib.rs":"d1e04bc2901472ce98be1a79b6844b49e38598eda3e4f8c0e7b08c5b33247375","src/mach_sys.rs":"352560fcb9b41d877cff92e5b3b04d6dc68b1f30508ce4b9aed78940120a883e","src/rt_linux.rs":"238264f4a3e010743ea2f44b3b13cb912f2b57786cd97e583575415d7e84b6b2","src/rt_mach.rs":"381f709a59d21031caf70e1bf4e9c26cd25fd3d2618ae0d91c1fbc236ce519ca","src/rt_win.rs":"f8f5b7af21cadd686cf7d8099d1972d3265c3889574020bd4ea088b832fbfa51"},"package":"047460864ea9f62fbdfb80fc04a2e5d844aef9e50727e6e9730ca58d9f1a9267"} +\ No newline at end of file ++{"files":{"Cargo.toml":"4c85ca3ce6ee93571667a430f548a1c9e73cfa621b2dac9fffa35bf280a90d9e","Makefile":"8c6b9e8afffb14ae03f9cd95bc7d6011c8b4fe01c474aef17360e3f0c4d202ad","README.md":"bcfa4948edf52fdacd485200a0c1c886a92232cc1931eeb4e1044050f46ec253","audio_thread_priority.h":"880889a154283a87cf84218cc4d6b2b9dd2c8fd09adc6d38f527b08ccd0c6168","generate_osx_bindings.sh":"06e4e03450f788ced18d31fff5660919e6f6ec1119ddace363ffeb82f0518a71","src/lib.rs":"d1e04bc2901472ce98be1a79b6844b49e38598eda3e4f8c0e7b08c5b33247375","src/mach_sys.rs":"352560fcb9b41d877cff92e5b3b04d6dc68b1f30508ce4b9aed78940120a883e","src/rt_linux.rs":"e1e7d80663eb29ec3a88ce8e9ac9b5f7849ff544eacc5652807de2a60f9f2ed1","src/rt_mach.rs":"381f709a59d21031caf70e1bf4e9c26cd25fd3d2618ae0d91c1fbc236ce519ca","src/rt_win.rs":"f8f5b7af21cadd686cf7d8099d1972d3265c3889574020bd4ea088b832fbfa51"},"package":"047460864ea9f62fbdfb80fc04a2e5d844aef9e50727e6e9730ca58d9f1a9267"} +diff --git a/third_party/rust/audio_thread_priority/src/rt_linux.rs b/third_party/rust/audio_thread_priority/src/rt_linux.rs +--- a/third_party/rust/audio_thread_priority/src/rt_linux.rs ++++ b/third_party/rust/audio_thread_priority/src/rt_linux.rs +@@ -88,18 +88,18 @@ fn make_realtime(tid: kernel_pid_t, max_ + Ok(prio) + } + + pub fn promote_current_thread_to_real_time_internal(audio_buffer_frames: u32, + audio_samplerate_hz: u32) -> Result<RtPriorityHandleInternal, ()> + { + let thread_id = unsafe { libc::syscall(libc::SYS_gettid) }; + let pthread_id = unsafe { libc::pthread_self() }; ++ let mut param = unsafe { std::mem::zeroed::<libc::sched_param>() }; + let mut policy = 0; +- let mut param = libc::sched_param { sched_priority: 0 }; + + if unsafe { libc::pthread_getschedparam(pthread_id, &mut policy, &mut param) } < 0 { + error!("pthread_getschedparam error {}", pthread_id); + return Err(()); + } + + let buffer_frames = if audio_buffer_frames > 0 { + audio_buffer_frames diff --git a/http/firefox/patches/3000_use_the_Mozilla_location_service_when_no_Google_key_is_available.patch b/http/firefox/patches/3000_use_the_Mozilla_location_service_when_no_Google_key_is_available.patch new file mode 100644 index 0000000000..b496a9f8c4 --- /dev/null +++ b/http/firefox/patches/3000_use_the_Mozilla_location_service_when_no_Google_key_is_available.patch @@ -0,0 +1,21 @@ +From: Mike Hommey <mh@glandium.org> +Date: Sun, 2 Apr 2017 06:33:19 +0900 +Subject: Use the Mozilla Location Service key when the Google Key is not there + +--- + browser/app/profile/firefox.js | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js +index f57e2a7cc9f8..bb1ed4352c66 100644 +--- a/browser/app/profile/firefox.js ++++ b/browser/app/profile/firefox.js +@@ -1372,7 +1372,7 @@ pref("dom.debug.propagate_gesture_events_through_content", false); + + // All the Geolocation preferences are here. + // +-#ifndef EARLY_BETA_OR_EARLIER ++#if !defined(EARLY_BETA_OR_EARLIER) && defined(GOOGLE_LOCATION_SERVICE_API_KEY) + pref("geo.wifi.uri", "https://www.googleapis.com/geolocation/v1/geolocate?key=%GOOGLE_LOCATION_SERVICE_API_KEY%"); + #else + // Use MLS on Nightly and early Beta. diff --git a/http/firefox/patches/6001_add_missing_header_for_basename.patch b/http/firefox/patches/6001_add_missing_header_for_basename.patch new file mode 100644 index 0000000000..74544d30b2 --- /dev/null +++ b/http/firefox/patches/6001_add_missing_header_for_basename.patch @@ -0,0 +1,28 @@ +>From 81a3915aa040f3f6a9684d67f754a0f7f4867987 Mon Sep 17 00:00:00 2001 +From: Samuel Holland <samuel@sholland.org> +Date: Sun, 8 Jan 2017 19:14:15 -0600 +Subject: [PATCH 2/4] Add missing header for basename() + +While it may be transitively included on some systems, libgen.h should +be included explicitly for portability. + +Signed-off-by: Samuel Holland <samuel@sholland.org> +--- + tools/profiler/lul/LulElf.cpp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/tools/profiler/lul/LulElf.cpp b/tools/profiler/lul/LulElf.cpp +index 6f90d5f13..7a2dd98e7 100644 +--- a/tools/profiler/lul/LulElf.cpp ++++ b/tools/profiler/lul/LulElf.cpp +@@ -47,6 +47,7 @@ + + #include <errno.h> + #include <fcntl.h> ++#include <libgen.h> + #include <stdio.h> + #include <string.h> + #include <sys/mman.h> +-- +2.11.0 + diff --git a/http/firefox/patches/6002_add_alternate_name_for_private_siginfo_struct_member.patch b/http/firefox/patches/6002_add_alternate_name_for_private_siginfo_struct_member.patch new file mode 100644 index 0000000000..32aeecae79 --- /dev/null +++ b/http/firefox/patches/6002_add_alternate_name_for_private_siginfo_struct_member.patch @@ -0,0 +1,32 @@ +>From 9b622d94ffb1e6e0013a61e9bf368256fdd7e767 Mon Sep 17 00:00:00 2001 +From: Samuel Holland <samuel@sholland.org> +Date: Sun, 8 Jan 2017 19:16:38 -0600 +Subject: [PATCH 3/4] Add alternate name for private siginfo struct member + +musl does not provide a macro for detecting its presence. For now, +assume that it is the only non-glibc-based libc on Linux systems. + +Signed-off-by: Samuel Holland <samuel@sholland.org> +--- + security/sandbox/chromium/sandbox/linux/seccomp-bpf/trap.cc | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/security/sandbox/chromium/sandbox/linux/seccomp-bpf/trap.cc b/security/sandbox/chromium/sandbox/linux/seccomp-bpf/trap.cc +index 003708d2c..2103251c0 100644 +--- a/security/sandbox/chromium/sandbox/linux/seccomp-bpf/trap.cc ++++ b/security/sandbox/chromium/sandbox/linux/seccomp-bpf/trap.cc +@@ -168,7 +168,11 @@ void Trap::SigSys(int nr, LinuxSigInfo* info, ucontext_t* ctx) { + // most versions of glibc don't include this information in siginfo_t. So, + // we need to explicitly copy it into a arch_sigsys structure. + struct arch_sigsys sigsys; ++#if defined(__GLIBC__) + memcpy(&sigsys, &info->_sifields, sizeof(sigsys)); ++#else ++ memcpy(&sigsys, &info->__si_fields, sizeof(sigsys)); ++#endif + + #if defined(__mips__) + // When indirect syscall (syscall(__NR_foo, ...)) is made on Mips, the +-- +2.11.0 + diff --git a/http/firefox/patches/6003_fix_syscall_wrappers_on_musl.patch b/http/firefox/patches/6003_fix_syscall_wrappers_on_musl.patch new file mode 100644 index 0000000000..3fbea01ca8 --- /dev/null +++ b/http/firefox/patches/6003_fix_syscall_wrappers_on_musl.patch @@ -0,0 +1,47 @@ +>From 0b1e174fa3acdde982a051ee0a030566ea8368cb Mon Sep 17 00:00:00 2001 +From: Samuel Holland <samuel@sholland.org> +Date: Sun, 8 Jan 2017 19:19:23 -0600 +Subject: [PATCH 4/4] Fix syscall wrappers on musl + +musl defines p{read,write}64 to their non-suffixed equivalents to avoid +duplication in its syscall wrappers. This breaks macro expansion here, +leading to errors such as: + +In function size_t sys_pread64(int, void*, size_t, off_t): + error: '__NR_pread' was not declared in this scope + +The fix here is to undefine the p{read,write}64 macros, so the syscall +expands to (e.g.) __NR_pread64 instead. + +Signed-off-by: Samuel Holland <samuel@sholland.org> +--- + .../google-breakpad/src/third_party/lss/linux_syscall_support.h | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/toolkit/crashreporter/google-breakpad/src/third_party/lss/linux_syscall_support.h b/toolkit/crashreporter/google-breakpad/src/third_party/lss/linux_syscall_support.h +--- a/toolkit/crashreporter/google-breakpad/src/third_party/lss/linux_syscall_support.h ++++ b/toolkit/crashreporter/google-breakpad/src/third_party/lss/linux_syscall_support.h +@@ -161,16 +161,23 @@ extern "C" { + # undef __NR_pipe + #endif + + #if defined(__ANDROID__) + // waitpid is blocked by seccomp on all architectures on recent Android. + # undef __NR_waitpid + #endif + ++#ifdef pread64 ++#undef pread64 ++#endif ++#ifdef pwrite64 ++#undef pwrite64 ++#endif ++ + /* As glibc often provides subtly incompatible data structures (and implicit + * wrapper functions that convert them), we provide our own kernel data + * structures for use by the system calls. + * These structures have been developed by using Linux 2.6.23 headers for + * reference. Note though, we do not care about exact API compatibility + * with the kernel, and in fact the kernel often does not have a single + * API that works across architectures. Instead, we try to mimic the glibc + * API where reasonable, and only guarantee ABI compatibility with the diff --git a/http/firefox/patches/6004_musl_memory_report.patch b/http/firefox/patches/6004_musl_memory_report.patch new file mode 100644 index 0000000000..cebaa9990d --- /dev/null +++ b/http/firefox/patches/6004_musl_memory_report.patch @@ -0,0 +1,22 @@ +From: Jory A. Pratt <anarchy@gentoo.org> + +Only use system heap reporter with glibc + +--- a/xpcom/base/nsMemoryReporterManager.cpp ++++ b/xpcom/base/nsMemoryReporterManager.cpp +@@ -642,6 +642,7 @@ static MOZ_MUST_USE nsresult PrivateDistinguishedAmount(int64_t* aN) { + return NS_OK; + } + ++#ifdef __GLIBC__ + # define HAVE_SYSTEM_HEAP_REPORTER 1 + // Windows can have multiple separate heaps. During testing there were multiple + // heaps present but the non-default ones had sizes no more than a few 10s of +@@ -698,6 +699,7 @@ static MOZ_MUST_USE nsresult SystemHeapSize(int64_t* aSizeOut) { + *aSizeOut = heapsSize; + return NS_OK; + } ++#endif + + struct SegmentKind { + DWORD mState; diff --git a/http/firefox/patches/6005_musl_pthread_setname.patch b/http/firefox/patches/6005_musl_pthread_setname.patch new file mode 100644 index 0000000000..7942a5b0c6 --- /dev/null +++ b/http/firefox/patches/6005_musl_pthread_setname.patch @@ -0,0 +1,29 @@ +From: Jory A. Pratt <anarchy@gentoo.org> + +set pthread name for non glibc systems + +diff --git a/js/src/threading/posix/Thread.cpp b/js/src/threading/posix/Thread.cpp +--- a/js/src/threading/posix/Thread.cpp ++++ b/js/src/threading/posix/Thread.cpp +@@ -155,18 +155,20 @@ void js::ThisThread::SetName(const char* + int rv; + #ifdef XP_DARWIN + rv = pthread_setname_np(name); + #elif defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__) + pthread_set_name_np(pthread_self(), name); + rv = 0; + #elif defined(__NetBSD__) + rv = pthread_setname_np(pthread_self(), "%s", (void*)name); ++#elif defined(__GLIBC__) ++ rv = pthread_setname_np(pthread_self(), name); + #else +- rv = pthread_setname_np(pthread_self(), name); ++ rv = 0; + #endif + MOZ_RELEASE_ASSERT(!rv || mozilla::recordreplay::IsRecordingOrReplaying()); + } + + void js::ThisThread::GetName(char* nameBuffer, size_t len) { + MOZ_RELEASE_ASSERT(len >= 16); + + int rv = -1; diff --git a/http/firefox/patches/6006_musl_fix_tools.patch b/http/firefox/patches/6006_musl_fix_tools.patch new file mode 100644 index 0000000000..26293a8a2e --- /dev/null +++ b/http/firefox/patches/6006_musl_fix_tools.patch @@ -0,0 +1,17 @@ +From: Jory A. Pratt <anarchy@gentoo.org> + +getcontext is only avaliable on glibc systems + +--- a/tools/profiler/core/platform-linux-android.cpp ++++ b/tools/profiler/core/platform-linux-android.cpp +@@ -497,8 +497,10 @@ static void PlatformInit(PSLockRef aLock) {} + ucontext_t sSyncUContext; + + void Registers::SyncPopulate() { ++#if defined(__GLIBC__) + if (!getcontext(&sSyncUContext)) { + PopulateRegsFromContext(*this, &sSyncUContext); + } ++#endif + } + #endif diff --git a/http/firefox/patches/6007_musl_fix_toolkit.patch b/http/firefox/patches/6007_musl_fix_toolkit.patch new file mode 100644 index 0000000000..eb2532144f --- /dev/null +++ b/http/firefox/patches/6007_musl_fix_toolkit.patch @@ -0,0 +1,140 @@ +From: Jory Pratt <anarchy@gentoo.org> +Date: Tue, 19 Mar 2019 10:58:57 -0500 +Subject: Fix toolkit for musl support + +--- + .../google-breakpad/src/common/linux/dump_symbols.cc | 1 + + .../crashreporter/google-breakpad/src/common/stabs_reader.cc | 4 ++++ + .../crashreporter/google-breakpad/src/common/stabs_reader.h | 2 +- + toolkit/mozapps/update/common/updatedefines.h | 2 +- + toolkit/mozapps/update/updater/updater.cpp | 2 ++ + 5 files changed, 9 insertions(+), 2 deletions(-) + +diff --git a/toolkit/crashreporter/google-breakpad/src/common/linux/dump_symbols.cc b/toolkit/crashreporter/google-breakpad/src/common/linux/dump_symbols.cc +--- a/toolkit/crashreporter/google-breakpad/src/common/linux/dump_symbols.cc ++++ b/toolkit/crashreporter/google-breakpad/src/common/linux/dump_symbols.cc +@@ -41,16 +41,17 @@ + #include <link.h> + #include <stdint.h> + #include <stdio.h> + #include <stdlib.h> + #include <string.h> + #include <sys/mman.h> + #include <sys/stat.h> + #include <unistd.h> ++#include <libgen.h> + + #include <iostream> + #include <set> + #include <string> + #include <utility> + #include <vector> + + #include "common/arm_ex_reader.h" +diff --git a/toolkit/crashreporter/google-breakpad/src/common/stabs_reader.cc b/toolkit/crashreporter/google-breakpad/src/common/stabs_reader.cc +--- a/toolkit/crashreporter/google-breakpad/src/common/stabs_reader.cc ++++ b/toolkit/crashreporter/google-breakpad/src/common/stabs_reader.cc +@@ -36,16 +36,20 @@ + #include <assert.h> + #include <stab.h> + #include <string.h> + + #include <string> + + #include "common/using_std_string.h" + ++#ifndef N_UNDF ++#define N_UNDF 0 ++#endif ++ + using std::vector; + + namespace google_breakpad { + + StabsReader::EntryIterator::EntryIterator(const ByteBuffer *buffer, + bool big_endian, size_t value_size) + : value_size_(value_size), cursor_(buffer, big_endian) { + // Actually, we could handle weird sizes just fine, but they're +diff --git a/toolkit/crashreporter/google-breakpad/src/common/stabs_reader.h b/toolkit/crashreporter/google-breakpad/src/common/stabs_reader.h +--- a/toolkit/crashreporter/google-breakpad/src/common/stabs_reader.h ++++ b/toolkit/crashreporter/google-breakpad/src/common/stabs_reader.h +@@ -50,17 +50,17 @@ + #include <stdint.h> + + #ifdef HAVE_CONFIG_H + #include <config.h> + #endif + + #ifdef HAVE_MACH_O_NLIST_H + #include <mach-o/nlist.h> +-#elif defined(HAVE_A_OUT_H) ++#elif 0 + #include <a.out.h> + #endif + + #include <string> + #include <vector> + + #include "common/byte_cursor.h" + #include "common/using_std_string.h" +diff --git a/toolkit/mozapps/update/common/updatedefines.h b/toolkit/mozapps/update/common/updatedefines.h +--- a/toolkit/mozapps/update/common/updatedefines.h ++++ b/toolkit/mozapps/update/common/updatedefines.h +@@ -82,17 +82,17 @@ static inline int mywcsprintf(WCHAR* des + # define NS_tclosedir closedir + # define NS_treaddir readdir + #else + # include <sys/wait.h> + # include <unistd.h> + + # ifdef SOLARIS + # include <sys/stat.h> +-# else ++#elif !defined(__linux__) || defined(__GLIBC__) + # include <fts.h> + # endif + # include <dirent.h> + + # ifdef XP_MACOSX + # include <sys/time.h> + # endif + +diff --git a/toolkit/mozapps/update/updater/updater.cpp b/toolkit/mozapps/update/updater/updater.cpp +--- a/toolkit/mozapps/update/updater/updater.cpp ++++ b/toolkit/mozapps/update/updater/updater.cpp +@@ -3950,16 +3950,17 @@ int add_dir_entries(const NS_tchar* dirp + + return rv; + } + + #else + + int add_dir_entries(const NS_tchar* dirpath, ActionList* list) { + int rv = OK; ++#if !defined(__linux__) || defined(__GLIBC__) + FTS* ftsdir; + FTSENT* ftsdirEntry; + mozilla::UniquePtr<NS_tchar[]> searchpath(get_full_path(dirpath)); + + // Remove the trailing slash so the paths don't contain double slashes. The + // existence of the slash has already been checked in DoUpdate. + searchpath[NS_tstrlen(searchpath.get()) - 1] = NS_T('\0'); + char* const pathargv[] = {searchpath.get(), nullptr}; +@@ -4057,16 +4058,17 @@ int add_dir_entries(const NS_tchar* dirp + } + + if (rv != OK) { + break; + } + } + + fts_close(ftsdir); ++#endif + + return rv; + } + #endif + + /* + * Gets the contents of an update manifest file. The return value is malloc'd + * and it is the responsibility of the caller to free it. diff --git a/http/firefox/patches/6008_musl_sandbox_membarrier.patch b/http/firefox/patches/6008_musl_sandbox_membarrier.patch new file mode 100644 index 0000000000..c139fe83da --- /dev/null +++ b/http/firefox/patches/6008_musl_sandbox_membarrier.patch @@ -0,0 +1,86 @@ +# HG changeset patch +# Parent 3ff47ffc0d011be2a27c83f8a64fc71d5ed65d52 +Allow the usage of SYS_membarrier for musl-1.1.22 + +diff --git a/security/sandbox/chromium/sandbox/linux/system_headers/arm_linux_syscalls.h b/security/sandbox/chromium/sandbox/linux/system_headers/arm_linux_syscalls.h +--- a/security/sandbox/chromium/sandbox/linux/system_headers/arm_linux_syscalls.h ++++ b/security/sandbox/chromium/sandbox/linux/system_headers/arm_linux_syscalls.h +@@ -1380,16 +1380,20 @@ + #if !defined(__NR_getrandom) + #define __NR_getrandom (__NR_SYSCALL_BASE+384) + #endif + + #if !defined(__NR_memfd_create) + #define __NR_memfd_create (__NR_SYSCALL_BASE+385) + #endif + ++#if !defined(__NR_membarrier) ++#define __NR_membarrier (__NR_SYSCALL_BASE+389) ++#endif ++ + // ARM private syscalls. + #if !defined(__ARM_NR_BASE) + #define __ARM_NR_BASE (__NR_SYSCALL_BASE + 0xF0000) + #endif + + #if !defined(__ARM_NR_breakpoint) + #define __ARM_NR_breakpoint (__ARM_NR_BASE+1) + #endif +diff --git a/security/sandbox/chromium/sandbox/linux/system_headers/x86_32_linux_syscalls.h b/security/sandbox/chromium/sandbox/linux/system_headers/x86_32_linux_syscalls.h +--- a/security/sandbox/chromium/sandbox/linux/system_headers/x86_32_linux_syscalls.h ++++ b/security/sandbox/chromium/sandbox/linux/system_headers/x86_32_linux_syscalls.h +@@ -1485,10 +1485,14 @@ + #if !defined(__NR_recvmsg) + #define __NR_recvmsg 372 + #endif + + #if !defined(__NR_shutdown) + #define __NR_shutdown 373 + #endif + ++#if !defined(__NR_membarrier) ++#define __NR_membarrier 375 ++#endif ++ + #endif // SANDBOX_LINUX_SYSTEM_HEADERS_X86_32_LINUX_SYSCALLS_H_ + +diff --git a/security/sandbox/chromium/sandbox/linux/system_headers/x86_64_linux_syscalls.h b/security/sandbox/chromium/sandbox/linux/system_headers/x86_64_linux_syscalls.h +--- a/security/sandbox/chromium/sandbox/linux/system_headers/x86_64_linux_syscalls.h ++++ b/security/sandbox/chromium/sandbox/linux/system_headers/x86_64_linux_syscalls.h +@@ -1285,10 +1285,14 @@ + #if !defined(__NR_getrandom) + #define __NR_getrandom 318 + #endif + + #if !defined(__NR_memfd_create) + #define __NR_memfd_create 319 + #endif + ++#if !defined(__NR_membarrier) ++#define __NR_membarrier 324 ++#endif ++ + #endif // SANDBOX_LINUX_SYSTEM_HEADERS_X86_64_LINUX_SYSCALLS_H_ + +diff --git a/security/sandbox/linux/SandboxFilter.cpp b/security/sandbox/linux/SandboxFilter.cpp +--- a/security/sandbox/linux/SandboxFilter.cpp ++++ b/security/sandbox/linux/SandboxFilter.cpp +@@ -569,16 +569,18 @@ class SandboxPolicyCommon : public Sandb + #ifdef __NR_set_robust_list + case __NR_set_robust_list: + return Allow(); + #endif + #ifdef ANDROID + case __NR_set_tid_address: + return Allow(); + #endif ++ case __NR_membarrier: ++ return Allow(); + + // prctl + case __NR_prctl: { + if (SandboxInfo::Get().Test(SandboxInfo::kHasSeccompTSync)) { + return PrctlPolicy(); + } + + Arg<int> option(0); diff --git a/http/firefox/patches/7000_sys_auxv_non_glibc.patch b/http/firefox/patches/7000_sys_auxv_non_glibc.patch new file mode 100644 index 0000000000..ffc6b85f4a --- /dev/null +++ b/http/firefox/patches/7000_sys_auxv_non_glibc.patch @@ -0,0 +1,67 @@ +From: Jory A. Pratt <anarchy@gentoo.org> + +sys/auvx.h avaliable on more then just glibc systems + +diff --git a/media/webrtc/trunk/webrtc/system_wrappers/source/cpu_features_linux.c b/media/webrtc/trunk/webrtc/system_wrappers/source/cpu_features_linux.c +--- a/media/webrtc/trunk/webrtc/system_wrappers/source/cpu_features_linux.c ++++ b/media/webrtc/trunk/webrtc/system_wrappers/source/cpu_features_linux.c +@@ -6,20 +6,17 @@ + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + + #include <stdlib.h> + #include <string.h> + #include <features.h> +-#ifndef __GLIBC_PREREQ +-#define __GLIBC_PREREQ(a, b) 0 +-#endif +-#if __GLIBC_PREREQ(2, 16) ++#if defined(__linux__) + #include <sys/auxv.h> + #else + #include <fcntl.h> + #include <unistd.h> + #include <errno.h> + #include <link.h> + #endif + #include "system_wrappers/include/cpu_features_wrapper.h" +@@ -27,17 +24,17 @@ + #if defined(WEBRTC_ARCH_ARM_FAMILY) + #include <asm/hwcap.h> + + uint64_t WebRtc_GetCPUFeaturesARM(void) { + uint64_t result = 0; + int architecture = 0; + unsigned long hwcap = 0; + const char* platform = NULL; +-#if __GLIBC_PREREQ(2, 16) ++#if defined(__linux__) + hwcap = getauxval(AT_HWCAP); + platform = (const char*)getauxval(AT_PLATFORM); + #else + ElfW(auxv_t) auxv; + int fd = open("/proc/self/auxv", O_RDONLY); + if (fd >= 0) { + while (hwcap == 0 || platform == NULL) { + if (read(fd, &auxv, sizeof(auxv)) < (ssize_t)sizeof(auxv)) { +@@ -51,17 +48,17 @@ uint64_t WebRtc_GetCPUFeaturesARM(void) + break; + case AT_PLATFORM: + platform = (const char*)auxv.a_un.a_val; + break; + } + } + close(fd); + } +-#endif // __GLIBC_PREREQ(2,16) ++#endif // (__linux__) + #if defined(__aarch64__) + architecture = 8; + if ((hwcap & HWCAP_FP) != 0) + result |= kCPUFeatureVFPv3; + if ((hwcap & HWCAP_ASIMD) != 0) + result |= kCPUFeatureNEON; + #else + if (platform != NULL) { diff --git a/http/firefox/patches/7001_make-pgo-use-toolchain.patch b/http/firefox/patches/7001_make-pgo-use-toolchain.patch new file mode 100644 index 0000000000..e7afcf4824 --- /dev/null +++ b/http/firefox/patches/7001_make-pgo-use-toolchain.patch @@ -0,0 +1,18 @@ +--- a/build/unix/mozconfig.unix ++++ b/build/unix/mozconfig.unix +@@ -6,6 +6,15 @@ if [ -n "$FORCE_GCC" ]; then + CC="$TOOLTOOL_DIR/gcc/bin/gcc" + CXX="$TOOLTOOL_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=$TOOLTOOL_DIR/gcc/bin:$PATH" |