aboutsummaryrefslogtreecommitdiff
path: root/repos/clang/firefox
diff options
context:
space:
mode:
Diffstat (limited to 'repos/clang/firefox')
-rw-r--r--repos/clang/firefox/.checksum21
-rw-r--r--repos/clang/firefox/.files54
-rw-r--r--repos/clang/firefox/abuild99
-rw-r--r--repos/clang/firefox/amdgpu-vaapi.patch19
-rw-r--r--repos/clang/firefox/atoi.patch13
-rw-r--r--repos/clang/firefox/clang-ias.patch289
-rw-r--r--repos/clang/firefox/clang-memory-throw-gcc.patch71
-rw-r--r--repos/clang/firefox/depends12
-rw-r--r--repos/clang/firefox/enable-elfhack-relr.patch11
-rw-r--r--repos/clang/firefox/fix-fortify-system-wrappers.patch13
-rw-r--r--repos/clang/firefox/fix-rust-target.patch30
-rw-r--r--repos/clang/firefox/fix-webrtc-glibcisms.patch20
-rw-r--r--repos/clang/firefox/lfs64.patch35
-rw-r--r--repos/clang/firefox/libcxx18.patch18
-rw-r--r--repos/clang/firefox/lolmalloc.patch44
-rw-r--r--repos/clang/firefox/no-ccache-stats.patch13
-rw-r--r--repos/clang/firefox/oldpatch/fix-target-detection.patch19
-rw-r--r--repos/clang/firefox/pgo-notimeout.patch26
-rw-r--r--repos/clang/firefox/ppc64-webrtc.patch19
-rw-r--r--repos/clang/firefox/riscv64-reduce-debug.patch23
-rw-r--r--repos/clang/firefox/rust-lto.patch27
-rw-r--r--repos/clang/firefox/sandbox-sched_setscheduler.patch22
-rw-r--r--repos/clang/firefox/sqlite-ppc.patch46
-rw-r--r--repos/clang/firefox/wasip1.patch11
-rw-r--r--repos/clang/firefox/xptcall-integrated-as.patch21
25 files changed, 976 insertions, 0 deletions
diff --git a/repos/clang/firefox/.checksum b/repos/clang/firefox/.checksum
new file mode 100644
index 00000000..d7415742
--- /dev/null
+++ b/repos/clang/firefox/.checksum
@@ -0,0 +1,21 @@
+2ec106d7ffb33efa1d35015d1dac40fa1ddfabc8f279b5271d1b59588187aac1 amdgpu-vaapi.patch
+30b6e034dcc7f4ce4422845fe9ecb5dbbdd3672f441896e8033a8b5fab4bca43 atoi.patch
+89b3e7dd7b39ba325cba9747cd6cef0d3bb286566b7567d129bb8806cc4b2f9a clang-ias.patch
+44c5d4ec0419600c25fc2a2ddc85fa69697863fd83acc9b0ff0c9e2c4e143563 clang-memory-throw-gcc.patch
+5df29d272a8189536ba609f0b4ab52d43100003e180fb88a8cf458bfc89711de enable-elfhack-relr.patch
+f2c12fabcea3c53e65b714c1fee3b56c47ea045a6afcbdf2d64137460546b61e firefox-136.0.source.tar.xz
+4b38873fc7ada6a3f0e6736e347d7ebb12b0c6848ee4bd92ad1fe4e2fdc69845 fix-fortify-system-wrappers.patch
+bfa4933968c1465e1edb01978b65ee09527bb4851507ed5cf7d5cc4634ec3537 fix-rust-target.patch
+f137d4af9cc5f821dd3755e64afb2aac4c2c7de1690a4fd95eb0289ae4f9f0e4 fix-webrtc-glibcisms.patch
+bc32dc4d3ea9ca366631840e6b5d196f13d49aae1c8f660fa07e8fe5ca338039 lfs64.patch
+ababe4f0e38e237cce6313103160b7f818cd01440e77742e8fdeb900587e248e libcxx18.patch
+13dd41b21fb22ae8dcba32bb4b2941d1bbc1996d124fd0c80e609eb2931f4621 lolmalloc.patch
+d0158e7aaaba84c9f2299d242fc646e43c4db417a49f4917bff049738d042d47 no-ccache-stats.patch
+9d0c01c79fd40741b78a4724d0d3a41641b8cff39065c05c5bce912bf8a20efb pgo-notimeout.patch
+e902e6c47fc883bbfb31e00906a449b53d9487f33111f80bc7fe6189166917f0 ppc64-webrtc.patch
+5a1dc879ddf2faf477b90d3ee06767bedae41fd4180c5cfcd8574dec535bfe24 riscv64-reduce-debug.patch
+1dcfa9174a7ef3cfe517ae243386a2b5165b108347fc40103d8e10f626c26b46 rust-lto.patch
+9c7362b2a747f01424e140a207dd1b31b7a7dddaa0bb955ca67c616a587ecf3b sandbox-sched_setscheduler.patch
+69fe5c6443b57f472b6a3aee57aa920d844dca70b8abc60ca57fdfe23546b431 sqlite-ppc.patch
+319c07024db2759bfeac2a1a4b101d600b07f1607154deccbfa99e8498750a45 wasip1.patch
+1252b63b07f0716d8f800031dd60a3c6e15b6be3d23ef4f513bdae2d93647ce8 xptcall-integrated-as.patch
diff --git a/repos/clang/firefox/.files b/repos/clang/firefox/.files
new file mode 100644
index 00000000..d5a92868
--- /dev/null
+++ b/repos/clang/firefox/.files
@@ -0,0 +1,54 @@
+drwxr-xr-x root/root usr/
+drwxr-xr-x root/root usr/bin/
+lrwxrwxrwx root/root usr/bin/firefox -> /usr/lib/firefox/firefox
+drwxr-xr-x root/root usr/lib/
+drwxr-xr-x root/root usr/lib/firefox/
+-rw-r--r-- root/root usr/lib/firefox/application.ini
+drwxr-xr-x root/root usr/lib/firefox/browser/
+drwxr-xr-x root/root usr/lib/firefox/browser/chrome/
+drwxr-xr-x root/root usr/lib/firefox/browser/chrome/icons/
+drwxr-xr-x root/root usr/lib/firefox/browser/chrome/icons/default/
+-rw-r--r-- root/root usr/lib/firefox/browser/chrome/icons/default/default128.png
+-rw-r--r-- root/root usr/lib/firefox/browser/chrome/icons/default/default16.png
+-rw-r--r-- root/root usr/lib/firefox/browser/chrome/icons/default/default32.png
+-rw-r--r-- root/root usr/lib/firefox/browser/chrome/icons/default/default48.png
+-rw-r--r-- root/root usr/lib/firefox/browser/chrome/icons/default/default64.png
+drwxr-xr-x root/root usr/lib/firefox/browser/features/
+-rw-r--r-- root/root usr/lib/firefox/browser/features/formautofill@mozilla.org.xpi
+-rw-r--r-- root/root usr/lib/firefox/browser/features/pictureinpicture@mozilla.org.xpi
+-rw-r--r-- root/root usr/lib/firefox/browser/features/screenshots@mozilla.org.xpi
+-rw-r--r-- root/root usr/lib/firefox/browser/features/webcompat-reporter@mozilla.org.xpi
+-rw-r--r-- root/root usr/lib/firefox/browser/features/webcompat@mozilla.org.xpi
+-rw-r--r-- root/root usr/lib/firefox/browser/omni.ja
+drwxr-xr-x root/root usr/lib/firefox/defaults/
+drwxr-xr-x root/root usr/lib/firefox/defaults/pref/
+-rw-r--r-- root/root usr/lib/firefox/defaults/pref/channel-prefs.js
+-rw-r--r-- root/root usr/lib/firefox/dependentlibs.list
+-rwxr-xr-x root/root usr/lib/firefox/firefox
+drwxr-xr-x root/root usr/lib/firefox/fonts/
+-rw-r--r-- root/root usr/lib/firefox/fonts/TwemojiMozilla.ttf
+-rwxr-xr-x root/root usr/lib/firefox/glxtest
+drwxr-xr-x root/root usr/lib/firefox/gmp-clearkey/
+drwxr-xr-x root/root usr/lib/firefox/gmp-clearkey/0.1/
+-rwxr-xr-x root/root usr/lib/firefox/gmp-clearkey/0.1/libclearkey.so
+-rw-r--r-- root/root usr/lib/firefox/gmp-clearkey/0.1/manifest.json
+-rwxr-xr-x root/root usr/lib/firefox/libgkcodecs.so
+-rwxr-xr-x root/root usr/lib/firefox/libipcclientcerts.so
+-rwxr-xr-x root/root usr/lib/firefox/liblgpllibs.so
+-rwxr-xr-x root/root usr/lib/firefox/libmozavcodec.so
+-rwxr-xr-x root/root usr/lib/firefox/libmozavutil.so
+-rwxr-xr-x root/root usr/lib/firefox/libmozgtk.so
+-rwxr-xr-x root/root usr/lib/firefox/libmozsandbox.so
+-rwxr-xr-x root/root usr/lib/firefox/libmozsqlite3.so
+-rwxr-xr-x root/root usr/lib/firefox/libmozwayland.so
+-rwxr-xr-x root/root usr/lib/firefox/libxul.so
+-rw-r--r-- root/root usr/lib/firefox/omni.ja
+-rwxr-xr-x root/root usr/lib/firefox/pingsender
+-rw-r--r-- root/root usr/lib/firefox/platform.ini
+-rw-r--r-- root/root usr/lib/firefox/removed-files
+-rwxr-xr-x root/root usr/lib/firefox/vaapitest
+drwxr-xr-x root/root usr/share/
+drwxr-xr-x root/root usr/share/applications/
+-rw-r--r-- root/root usr/share/applications/firefox.desktop
+drwxr-xr-x root/root usr/share/pixmaps/
+lrwxrwxrwx root/root usr/share/pixmaps/firefox.png -> /usr/lib/firefox/browser/chrome/icons/default/default128.png
diff --git a/repos/clang/firefox/abuild b/repos/clang/firefox/abuild
new file mode 100644
index 00000000..8990d0d4
--- /dev/null
+++ b/repos/clang/firefox/abuild
@@ -0,0 +1,99 @@
+name=firefox
+version=136.0
+release=1
+source="https://ftp.mozilla.org/pub/${name}/releases/${version}/source/${name}-${version}.source.tar.xz
+ amdgpu-vaapi.patch atoi.patch clang-ias.patch clang-memory-throw-gcc.patch enable-elfhack-relr.patch fix-fortify-system-wrappers.patch fix-rust-target.patch fix-webrtc-glibcisms.patch lfs64.patch libcxx18.patch lolmalloc.patch no-ccache-stats.patch pgo-notimeout.patch ppc64-webrtc.patch riscv64-reduce-debug.patch rust-lto.patch sandbox-sched_setscheduler.patch sqlite-ppc.patch wasip1.patch xptcall-integrated-as.patch"
+ #fix-target-detection.patch"
+
+build() {
+ cat > .mozconfig << EOF
+ac_add_options --prefix=/usr
+ac_add_options --libdir=/usr/lib
+ac_add_options --enable-strip
+ac_add_options --enable-release
+ac_add_options --enable-rust-simd
+ac_add_options --enable-audio-backends=alsa
+ac_add_options --enable-install-strip
+ac_add_options --enable-official-branding
+ac_add_options --enable-application=browser
+ac_add_options --enable-optimize
+ac_add_options --with-system-ffi
+ac_add_options --with-system-jpeg
+ac_add_options --with-system-libvpx
+ac_add_options --with-system-nspr
+ac_add_options --with-system-nss
+ac_add_options --with-system-pixman
+ac_add_options --with-system-png
+ac_add_options --with-system-webp
+ac_add_options --with-system-zlib
+ac_add_options --without-wasm-sandboxed-libraries
+ac_add_options --disable-eme
+#ac_add_options --disable-dbus
+ac_add_options --disable-tests
+ac_add_options --disable-vtune
+ac_add_options --disable-updater
+ac_add_options --disable-jemalloc
+ac_add_options --disable-elf-hack
+ac_add_options --disable-callgrind
+ac_add_options --disable-profiling
+ac_add_options --disable-necko-wifi
+ac_add_options --disable-crashreporter
+ac_add_options --disable-accessibility
+ac_add_options --disable-debug
+ac_add_options --disable-debug-symbols
+ac_add_options --disable-parental-controls
+ac_add_options --disable-system-extension-dirs
+ac_add_options --enable-linker=lld
+EOF
+
+ if [ -f $SPM_PKGDB/libx11 ] && [ ! -f $SPM_PKGDB/wayland ]; then
+ echo "ac_add_options --enable-default-toolkit=cairo-gtk3-x11-only" >> .mozconfig
+ elif [ -f $SPM_PKGDB/wayland ] && [ ! -f $SPM_PKGDB/libx11 ]; then
+ echo "ac_add_options --enable-default-toolkit=cairo-gtk3-wayland-only" >> .mozconfig
+ fi
+
+ if [ -e '/usr/bin/ccache' ]; then
+ echo 'ac_add_options --enable-ccache' >> .mozconfig
+ PATH=$(echo ${PATH} | awk -v RS=: -v ORS=: '/ccache/ {next} {print}' | sed 's/:*$//')
+ fi
+
+ export MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE=none
+ export MOZBUILD_STATE_PATH=${PWD}/mozbuild
+ export RUST_TARGET=x86_64-unknown-linux-musl
+ export CC=clang
+ export CXX=clang++
+
+ export CFLAGS="$CFLAGS -w"
+ export CXXFLAGS="$CXXFLAGS -w"
+ export LDFLAGS="$LDFLAGS -Wl,-rpath=/usr/lib/firefox,--enable-new-dtags"
+ export RUSTFLAGS="$RUSTFLAGS -Cdebuginfo=0 -C link-arg=-stdlib=libc++ -C link-arg=-lc++"
+ export MOZ_DEBUG_FLAGS=-g0
+ export MOZ_NOSPAM=1
+
+ ./mach build
+ ./mach install
+
+ mkdir -pv $PKG/usr/share/applications
+ mkdir -pv $PKG/usr/share/pixmaps
+
+ cat > $PKG/usr/share/applications/firefox.desktop << EOF
+[Desktop Entry]
+Encoding=UTF-8
+Name=Firefox Web Browser
+Comment=Browse the World Wide Web
+GenericName=Web Browser
+Exec=firefox %u
+Terminal=false
+Type=Application
+Icon=firefox
+Categories=GNOME;GTK;Network;WebBrowser;
+MimeType=text/xml;text/mml;text/html;application/xhtml+xml;application/vnd.mozilla.xul+xml;x-scheme-handler/http;x-scheme-handler/https
+StartupNotify=true
+EOF
+
+ mkdir -p $PKG/usr/share/pixmaps
+ ln -sfv /usr/lib/firefox/browser/chrome/icons/default/default128.png \
+ $PKG/usr/share/pixmaps/firefox.png
+
+ rm $PKG/usr/lib/firefox/firefox-bin
+}
diff --git a/repos/clang/firefox/amdgpu-vaapi.patch b/repos/clang/firefox/amdgpu-vaapi.patch
new file mode 100644
index 00000000..099e43c7
--- /dev/null
+++ b/repos/clang/firefox/amdgpu-vaapi.patch
@@ -0,0 +1,19 @@
+permit amdgpu vaapi in release
+--
+--- a/widget/gtk/GfxInfo.cpp
++++ b/widget/gtk/GfxInfo.cpp
+@@ -1086,14 +1086,6 @@ const nsTArray<GfxDriverInfo>& GfxInfo::GetGfxDriverInfo() {
+ nsIGfxInfo::FEATURE_BLOCKED_DEVICE, DRIVER_LESS_THAN, V(23, 1, 1, 0),
+ "FEATURE_HARDWARE_VIDEO_DECODING_AMD_DISABLE", "Mesa 23.1.1.0");
+
+- // Disable on Release/late Beta on AMD
+-#if !defined(EARLY_BETA_OR_EARLIER)
+- APPEND_TO_DRIVER_BLOCKLIST(OperatingSystem::Linux, DeviceFamily::AtiAll,
+- nsIGfxInfo::FEATURE_HARDWARE_VIDEO_DECODING,
+- nsIGfxInfo::FEATURE_BLOCKED_DEVICE,
+- DRIVER_COMPARISON_IGNORED, V(0, 0, 0, 0),
+- "FEATURE_HARDWARE_VIDEO_DECODING_DISABLE", "");
+-#endif
+ ////////////////////////////////////
+ // FEATURE_HW_DECODED_VIDEO_ZERO_COPY - ALLOWLIST
+ APPEND_TO_DRIVER_BLOCKLIST2(OperatingSystem::Linux, DeviceFamily::All,
diff --git a/repos/clang/firefox/atoi.patch b/repos/clang/firefox/atoi.patch
new file mode 100644
index 00000000..4a309e04
--- /dev/null
+++ b/repos/clang/firefox/atoi.patch
@@ -0,0 +1,13 @@
+https://crash-stats.mozilla.org/report/index/349c6eca-d2d3-49ed-ab1c-184cf0240815
+--
+--- a/netwerk/protocol/http/nsHttpResponseHead.cpp
++++ b/netwerk/protocol/http/nsHttpResponseHead.cpp
+@@ -851,7 +851,7 @@
+ const char* val = mHeaders.PeekHeader(nsHttp::Age);
+ if (!val) return NS_ERROR_NOT_AVAILABLE;
+
+- *result = (uint32_t)atoi(val);
++ *result = (uint32_t)strtol(val, NULL, 10);
+ return NS_OK;
+ }
+
diff --git a/repos/clang/firefox/clang-ias.patch b/repos/clang/firefox/clang-ias.patch
new file mode 100644
index 00000000..f0252391
--- /dev/null
+++ b/repos/clang/firefox/clang-ias.patch
@@ -0,0 +1,289 @@
+commit 972b828530565302ac62a8a8eddde4cf1d13b101
+Author: q66 <q66@chimera-linux.org>
+Date: Tue Aug 23 14:10:54 2022 +0200
+
+ fix xptcall assembly stuff to work with clang ias
+
+diff --git a/xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_ppc64_linux.S b/xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_ppc64_linux.S
+index d2cab6c..aa2fd2c 100644
+--- a/xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_ppc64_linux.S
++++ b/xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_ppc64_linux.S
+@@ -2,21 +2,6 @@
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+-.set r0,0; .set r1,1; .set r2,2; .set r3,3; .set r4,4
+-.set r5,5; .set r6,6; .set r7,7; .set r8,8; .set r9,9
+-.set r10,10; .set r11,11; .set r12,12; .set r13,13; .set r14,14
+-.set r15,15; .set r16,16; .set r17,17; .set r18,18; .set r19,19
+-.set r20,20; .set r21,21; .set r22,22; .set r23,23; .set r24,24
+-.set r25,25; .set r26,26; .set r27,27; .set r28,28; .set r29,29
+-.set r30,30; .set r31,31
+-.set f0,0; .set f1,1; .set f2,2; .set f3,3; .set f4,4
+-.set f5,5; .set f6,6; .set f7,7; .set f8,8; .set f9,9
+-.set f10,10; .set f11,11; .set f12,12; .set f13,13; .set f14,14
+-.set f15,15; .set f16,16; .set f17,17; .set f18,18; .set f19,19
+-.set f20,20; .set f21,21; .set f22,22; .set f23,23; .set f24,24
+-.set f25,25; .set f26,26; .set f27,27; .set f28,28; .set f29,29
+-.set f30,30; .set f31,31
+-
+ # The ABI defines a fixed stack frame area of 4 doublewords (ELFv2)
+ # or 6 doublewords (ELFv1); the last of these doublewords is used
+ # as TOC pointer save area. The fixed area is followed by a parameter
+@@ -62,15 +47,15 @@ NS_InvokeByIndex:
+ .NS_InvokeByIndex:
+ #endif
+ mflr 0
+- std 0,16(r1)
++ std 0,16(%r1)
+
+- std r29,-24(r1)
+- std r30,-16(r1)
+- std r31,-8(r1)
++ std %r29,-24(%r1)
++ std %r30,-16(%r1)
++ std %r31,-8(%r1)
+
+- mr r29,r3 # Save 'that' in r29
+- mr r30,r4 # Save 'methodIndex' in r30
+- mr r31,r1 # Save old frame
++ mr %r29,%r3 # Save 'that' in r29
++ mr %r30,%r4 # Save 'methodIndex' in r30
++ mr %r31,%r1 # Save old frame
+
+ # Allocate stack frame with space for params. Since at least the
+ # first 7 parameters (not including 'that') will be in registers,
+@@ -79,13 +64,13 @@ NS_InvokeByIndex:
+ #
+ # | (fixed area + | | 7 GP | 13 FP | 3 NV |
+ # | param. save) |(params)........| regs | regs | regs |
+- # (r1)......(+STACK_PARAMS)... (-23*8).(-16*8).(-3*8)..(r31)
++ # (r1)......(+STACK_PARAMS)... (-23*8).(-16*8).(-3*8)..(%r31)
+
+ # +stack frame, -unused stack params, +regs storage, +1 for alignment
+- addi r7,r5,((STACK_PARAMS/8)-7+7+13+3+1)
+- rldicr r7,r7,3,59 # multiply by 8 and mask with ~15
+- neg r7,r7
+- stdux r1,r1,r7
++ addi %r7,%r5,((STACK_PARAMS/8)-7+7+13+3+1)
++ rldicr %r7,%r7,3,59 # multiply by 8 and mask with ~15
++ neg %r7,%r7
++ stdux %r1,%r1,%r7
+
+
+ # Call invoke_copy_to_stack(uint64_t* gpregs, double* fpregs,
+@@ -95,66 +80,66 @@ NS_InvokeByIndex:
+ # r5, r6 are passed through intact (paramCount, params)
+ # r7 (d) has to be r1+STACK_PARAMS
+ # -- where parameters are passed on the stack.
+- # r3, r4 are above that, easier to address from r31 than from r1
++ # r3, r4 are above that, easier to address from %r31 than from r1
+
+- subi r3,r31,(23*8) # r3 --> GPRS
+- subi r4,r31,(16*8) # r4 --> FPRS
+- addi r7,r1,STACK_PARAMS # r7 --> params
++ subi %r3,%r31,(23*8) # r3 --> GPRS
++ subi %r4,%r31,(16*8) # r4 --> FPRS
++ addi %r7,%r1,STACK_PARAMS # r7 --> params
+ bl invoke_copy_to_stack
+ nop
+
+ # Set up to invoke function
+
+- ld r9,0(r29) # vtable (r29 is 'that')
+- mr r3,r29 # self is first arg, obviously
++ ld %r9,0(%r29) # vtable (r29 is 'that')
++ mr %r3,%r29 # self is first arg, obviously
+
+- sldi r30,r30,3 # Find function descriptor
+- add r9,r9,r30
+- ld r12,0(r9)
++ sldi %r30,%r30,3 # Find function descriptor
++ add %r9,%r9,%r30
++ ld %r12,0(%r9)
+
+- std r2,STACK_TOC(r1) # Save r2 (TOC pointer)
++ std %r2,STACK_TOC(%r1) # Save r2 (TOC pointer)
+
+ #if _CALL_ELF == 2
+- mtctr r12
++ mtctr %r12
+ #else
+- ld r0,0(r12) # Actual address from fd.
++ ld %r0,0(%r12) # Actual address from fd.
+ mtctr 0
+- ld r11,16(r12) # Environment pointer from fd.
+- ld r2,8(r12) # TOC pointer from fd.
++ ld %r11,16(%r12) # Environment pointer from fd.
++ ld %r2,8(%r12) # TOC pointer from fd.
+ #endif
+
+ # Load FP and GP registers as required
+- ld r4, -(23*8)(r31)
+- ld r5, -(22*8)(r31)
+- ld r6, -(21*8)(r31)
+- ld r7, -(20*8)(r31)
+- ld r8, -(19*8)(r31)
+- ld r9, -(18*8)(r31)
+- ld r10, -(17*8)(r31)
+-
+- lfd f1, -(16*8)(r31)
+- lfd f2, -(15*8)(r31)
+- lfd f3, -(14*8)(r31)
+- lfd f4, -(13*8)(r31)
+- lfd f5, -(12*8)(r31)
+- lfd f6, -(11*8)(r31)
+- lfd f7, -(10*8)(r31)
+- lfd f8, -(9*8)(r31)
+- lfd f9, -(8*8)(r31)
+- lfd f10, -(7*8)(r31)
+- lfd f11, -(6*8)(r31)
+- lfd f12, -(5*8)(r31)
+- lfd f13, -(4*8)(r31)
++ ld %r4, -(23*8)(%r31)
++ ld %r5, -(22*8)(%r31)
++ ld %r6, -(21*8)(%r31)
++ ld %r7, -(20*8)(%r31)
++ ld %r8, -(19*8)(%r31)
++ ld %r9, -(18*8)(%r31)
++ ld %r10, -(17*8)(%r31)
++
++ lfd %f1, -(16*8)(%r31)
++ lfd %f2, -(15*8)(%r31)
++ lfd %f3, -(14*8)(%r31)
++ lfd %f4, -(13*8)(%r31)
++ lfd %f5, -(12*8)(%r31)
++ lfd %f6, -(11*8)(%r31)
++ lfd %f7, -(10*8)(%r31)
++ lfd %f8, -(9*8)(%r31)
++ lfd %f9, -(8*8)(%r31)
++ lfd %f10, -(7*8)(%r31)
++ lfd %f11, -(6*8)(%r31)
++ lfd %f12, -(5*8)(%r31)
++ lfd %f13, -(4*8)(%r31)
+
+ bctrl # Do it
+
+- ld r2,STACK_TOC(r1) # Load our own TOC pointer
+- ld r1,0(r1) # Revert stack frame
+- ld 0,16(r1) # Reload lr
++ ld %r2,STACK_TOC(%r1) # Load our own TOC pointer
++ ld %r1,0(%r1) # Revert stack frame
++ ld 0,16(%r1) # Reload lr
+ mtlr 0
+- ld 29,-24(r1) # Restore NVGPRS
+- ld 30,-16(r1)
+- ld 31,-8(r1)
++ ld 29,-24(%r1) # Restore NVGPRS
++ ld 30,-16(%r1)
++ ld 31,-8(%r1)
+ blr
+
+ #if _CALL_ELF == 2
+diff --git a/xpcom/reflect/xptcall/md/unix/xptcstubs_asm_ppc64_linux.S b/xpcom/reflect/xptcall/md/unix/xptcstubs_asm_ppc64_linux.S
+index 0b884e1..4dddee1 100644
+--- a/xpcom/reflect/xptcall/md/unix/xptcstubs_asm_ppc64_linux.S
++++ b/xpcom/reflect/xptcall/md/unix/xptcstubs_asm_ppc64_linux.S
+@@ -2,21 +2,6 @@
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+-.set r0,0; .set r1,1; .set RTOC,2; .set r3,3; .set r4,4
+-.set r5,5; .set r6,6; .set r7,7; .set r8,8; .set r9,9
+-.set r10,10; .set r11,11; .set r12,12; .set r13,13; .set r14,14
+-.set r15,15; .set r16,16; .set r17,17; .set r18,18; .set r19,19
+-.set r20,20; .set r21,21; .set r22,22; .set r23,23; .set r24,24
+-.set r25,25; .set r26,26; .set r27,27; .set r28,28; .set r29,29
+-.set r30,30; .set r31,31
+-.set f0,0; .set f1,1; .set f2,2; .set f3,3; .set f4,4
+-.set f5,5; .set f6,6; .set f7,7; .set f8,8; .set f9,9
+-.set f10,10; .set f11,11; .set f12,12; .set f13,13; .set f14,14
+-.set f15,15; .set f16,16; .set f17,17; .set f18,18; .set f19,19
+-.set f20,20; .set f21,21; .set f22,22; .set f23,23; .set f24,24
+-.set f25,25; .set f26,26; .set f27,27; .set f28,28; .set f29,29
+-.set f30,30; .set f31,31
+-
+ #if _CALL_ELF == 2
+ #define STACK_PARAMS 96
+ #else
+@@ -56,50 +41,50 @@ SharedStub:
+
+ .SharedStub:
+ #endif
+- mflr r0
++ mflr %r0
+
+- std r4, -56(r1) # Save all GPRS
+- std r5, -48(r1)
+- std r6, -40(r1)
+- std r7, -32(r1)
+- std r8, -24(r1)
+- std r9, -16(r1)
+- std r10, -8(r1)
++ std %r4, -56(%r1) # Save all GPRS
++ std %r5, -48(%r1)
++ std %r6, -40(%r1)
++ std %r7, -32(%r1)
++ std %r8, -24(%r1)
++ std %r9, -16(%r1)
++ std %r10, -8(%r1)
+
+- stfd f13, -64(r1) # ... and FPRS
+- stfd f12, -72(r1)
+- stfd f11, -80(r1)
+- stfd f10, -88(r1)
+- stfd f9, -96(r1)
+- stfd f8, -104(r1)
+- stfd f7, -112(r1)
+- stfd f6, -120(r1)
+- stfd f5, -128(r1)
+- stfd f4, -136(r1)
+- stfd f3, -144(r1)
+- stfd f2, -152(r1)
+- stfd f1, -160(r1)
++ stfd %f13, -64(%r1) # ... and FPRS
++ stfd %f12, -72(%r1)
++ stfd %f11, -80(%r1)
++ stfd %f10, -88(%r1)
++ stfd %f9, -96(%r1)
++ stfd %f8, -104(%r1)
++ stfd %f7, -112(%r1)
++ stfd %f6, -120(%r1)
++ stfd %f5, -128(%r1)
++ stfd %f4, -136(%r1)
++ stfd %f3, -144(%r1)
++ stfd %f2, -152(%r1)
++ stfd %f1, -160(%r1)
+
+- subi r6,r1,56 # r6 --> gprData
+- subi r7,r1,160 # r7 --> fprData
+- addi r5,r1,STACK_PARAMS # r5 --> extra stack args
++ subi %r6,%r1,56 # r6 --> gprData
++ subi %r7,%r1,160 # r7 --> fprData
++ addi %r5,%r1,STACK_PARAMS # r5 --> extra stack args
+
+- std r0, 16(r1)
++ std %r0, 16(%r1)
+
+- stdu r1,-288(r1)
++ stdu %r1,-288(%r1)
+ # r3 has the 'self' pointer
+ # already
+
+- mr r4,r11 # r4 is methodIndex selector,
++ mr %r4,%r11 # r4 is methodIndex selector,
+ # passed via r11 in the
+ # nsNSStubBase::StubXX() call
+
+ bl PrepareAndDispatch
+ nop
+
+- ld 1,0(r1) # restore stack
+- ld r0,16(r1) # restore LR
+- mtlr r0
++ ld 1,0(%r1) # restore stack
++ ld %r0,16(%r1) # restore LR
++ mtlr %r0
+ blr
+
+ #if _CALL_ELF == 2
diff --git a/repos/clang/firefox/clang-memory-throw-gcc.patch b/repos/clang/firefox/clang-memory-throw-gcc.patch
new file mode 100644
index 00000000..7d9bf8d4
--- /dev/null
+++ b/repos/clang/firefox/clang-memory-throw-gcc.patch
@@ -0,0 +1,71 @@
+Taken from FreeBSD. Fixes build with Clang 14.
+
+--- a/memory/mozalloc/throw_gcc.h.orig 2022-02-02 17:33:38 UTC
++++ b/memory/mozalloc/throw_gcc.h
+@@ -74,50 +74,66 @@ __throw_bad_function_call(void) {
+ mozalloc_abort("fatal: STL threw bad_function_call");
+ }
+
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_logic_error(
+ const char* msg) {
+ mozalloc_abort(msg);
+ }
++#endif // _LIBCPP_VERSION
+
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_domain_error(
+ const char* msg) {
+ mozalloc_abort(msg);
+ }
++#endif // _LIBCPP_VERSION
+
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
+ __throw_invalid_argument(const char* msg) {
+ mozalloc_abort(msg);
+ }
++#endif // _LIBCPP_VERSION
+
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_length_error(
+ const char* msg) {
+ mozalloc_abort(msg);
+ }
++#endif // _LIBCPP_VERSION
+
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_out_of_range(
+ const char* msg) {
+ mozalloc_abort(msg);
+ }
++#endif // _LIBCPP_VERSION
+
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_runtime_error(
+ const char* msg) {
+ mozalloc_abort(msg);
+ }
+
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_range_error(
+ const char* msg) {
+ mozalloc_abort(msg);
+ }
++#endif // _LIBCPP_VERSION
+
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
+ __throw_overflow_error(const char* msg) {
+ mozalloc_abort(msg);
+ }
++#endif // _LIBCPP_VERSION
+
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
+ __throw_underflow_error(const char* msg) {
+ mozalloc_abort(msg);
+ }
++#endif // _LIBCPP_VERSION
+
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void __throw_ios_failure(
+ const char* msg) {
diff --git a/repos/clang/firefox/depends b/repos/clang/firefox/depends
new file mode 100644
index 00000000..5779e9b1
--- /dev/null
+++ b/repos/clang/firefox/depends
@@ -0,0 +1,12 @@
+alsa-utils
+cbindgen
+nodejs
+gtk3
+libwebp
+libvpx
+nss
+libevent
+libxcomposite
+libxcursor
+libxdamage
+libsm
diff --git a/repos/clang/firefox/enable-elfhack-relr.patch b/repos/clang/firefox/enable-elfhack-relr.patch
new file mode 100644
index 00000000..b1161080
--- /dev/null
+++ b/repos/clang/firefox/enable-elfhack-relr.patch
@@ -0,0 +1,11 @@
+--- a/toolkit/moz.configure
++++ b/toolkit/moz.configure
+@@ -1517,7 +1517,7 @@ with only_when("--enable-compile-environ
+ # packed relative relocations rather than elfhack.
+ if android_version:
+ return android_version >= 30
+- return have_arc4random
++ return have_arc4random or True
+
+ @depends(
+ c_compiler,
diff --git a/repos/clang/firefox/fix-fortify-system-wrappers.patch b/repos/clang/firefox/fix-fortify-system-wrappers.patch
new file mode 100644
index 00000000..0ca30527
--- /dev/null
+++ b/repos/clang/firefox/fix-fortify-system-wrappers.patch
@@ -0,0 +1,13 @@
+The wrapper features.h gets pulled in by system headers causing thigns to
+break. We work around it by simply not wrap features.h
+
+--- a/config/system-headers.mozbuild
++++ b/config/system-headers.mozbuild
+@@ -225,7 +225,6 @@
+ "execinfo.h",
+ "extras.h",
+ "fcntl.h",
+- "features.h",
+ "fenv.h",
+ "ffi.h",
+ "fibdef.h",
diff --git a/repos/clang/firefox/fix-rust-target.patch b/repos/clang/firefox/fix-rust-target.patch
new file mode 100644
index 00000000..33319e85
--- /dev/null
+++ b/repos/clang/firefox/fix-rust-target.patch
@@ -0,0 +1,30 @@
+Allow us to just set RUST_TARGET ourselves instead of hacking around in mozilla's
+weird custom build system...
+
+--- a/build/moz.configure/rust.configure
++++ b/build/moz.configure/rust.configure
+@@ -280,6 +280,9 @@
+ return data
+
+
++@imports('os')
++@imports(_from='mozbuild.util', _import='ensure_unicode')
++@imports(_from='mozbuild.util', _import='system_encoding')
+ def detect_rustc_target(
+ host_or_target, compiler_info, arm_target, rust_supported_targets
+ ):
+@@ -411,12 +414,12 @@
+
+ return None
+
+- rustc_target = find_candidate(candidates)
++ rustc_target = os.environ['RUST_TARGET']
+
+ if rustc_target is None:
+ die("Don't know how to translate {} for rustc".format(host_or_target.alias))
+
+- return rustc_target
++ return ensure_unicode(rustc_target, system_encoding)
+
+
+ @imports("os")
diff --git a/repos/clang/firefox/fix-webrtc-glibcisms.patch b/repos/clang/firefox/fix-webrtc-glibcisms.patch
new file mode 100644
index 00000000..4f9043b5
--- /dev/null
+++ b/repos/clang/firefox/fix-webrtc-glibcisms.patch
@@ -0,0 +1,20 @@
+--- a/third_party/libwebrtc/system_wrappers/source/cpu_features_linux.cc
++++ b/third_party/libwebrtc/system_wrappers/source/cpu_features_linux.cc
+@@ -18,7 +18,7 @@
+ #define WEBRTC_GLIBC_PREREQ(a, b) 0
+ #endif
+
+-#if WEBRTC_GLIBC_PREREQ(2, 16)
++#if !__GLIBC__ || WEBRTC_GLIBC_PREREQ(2, 16)
+ #include <sys/auxv.h>
+ #else
+ #include <errno.h>
+@@ -40,7 +40,7 @@
+ int architecture = 0;
+ uint64_t hwcap = 0;
+ const char* platform = NULL;
+-#if WEBRTC_GLIBC_PREREQ(2, 16)
++#if !__GLIBC__ || WEBRTC_GLIBC_PREREQ(2, 16)
+ hwcap = getauxval(AT_HWCAP);
+ platform = (const char*)getauxval(AT_PLATFORM);
+ #else
diff --git a/repos/clang/firefox/lfs64.patch b/repos/clang/firefox/lfs64.patch
new file mode 100644
index 00000000..0d18b10b
--- /dev/null
+++ b/repos/clang/firefox/lfs64.patch
@@ -0,0 +1,35 @@
+force stat() instead of stat64() on 32-bit
+--
+--- a/xpcom/io/nsLocalFileUnix.h
++++ b/xpcom/io/nsLocalFileUnix.h
+@@ -21,7 +21,7 @@
+
+ // stat64 and lstat64 are deprecated on OS X. Normal stat and lstat are
+ // 64-bit by default on OS X 10.6+.
+-#if defined(HAVE_STAT64) && defined(HAVE_LSTAT64) && !defined(XP_DARWIN)
++#if 0 && defined(HAVE_STAT64) && defined(HAVE_LSTAT64) && !defined(XP_DARWIN)
+ # define STAT stat64
+ # define LSTAT lstat64
+ # define HAVE_STATS64 1
+--- a/mozglue/baseprofiler/core/shared-libraries-linux.cc
++++ b/mozglue/baseprofiler/core/shared-libraries-linux.cc
+@@ -178,7 +178,7 @@
+ return false;
+ }
+
+-#if defined(__x86_64__) || defined(__aarch64__) || \
++#if 1 || defined(__x86_64__) || defined(__aarch64__) || \
+ (defined(__mips__) && _MIPS_SIM == _ABI64) || \
+ !(defined(GP_OS_linux) || defined(GP_OS_android))
+
+--- a/security/sandbox/linux/broker/SandboxBrokerUtils.h
++++ b/security/sandbox/linux/broker/SandboxBrokerUtils.h
+@@ -15,7 +15,7 @@
+ // calls. We'll intercept those and handle them in the stat functions
+ // but must be sure to use the right structure layout.
+
+-#if defined(__NR_stat64) || defined(__NR_fstatat64)
++#if 0 && (defined(__NR_stat64) || defined(__NR_fstatat64) )
+ typedef struct stat64 statstruct;
+ # define statsyscall stat64
+ # define lstatsyscall lstat64
diff --git a/repos/clang/firefox/libcxx18.patch b/repos/clang/firefox/libcxx18.patch
new file mode 100644
index 00000000..96994d14
--- /dev/null
+++ b/repos/clang/firefox/libcxx18.patch
@@ -0,0 +1,18 @@
+Patch-Source: https://dev.gentoo.org/~juippis/mozilla/patchsets/firefox-124-patches-04.tar.xz
+--
+--- a/build/moz.configure/toolchain.configure 2024-03-16 22:53:15.409390707 +0000
++++ b/build/moz.configure/toolchain.configure 2024-03-16 22:57:02.661805132 +0000
+@@ -2282,10 +2282,10 @@
+ set_define("_LIBCPP_HIDE_FROM_ABI", libcxx_override_visibility.hide_from_abi)
+
+
+-@depends(target, build_environment)
+-def visibility_flags(target, env):
++@depends(target, build_environment, c_compiler)
++def visibility_flags(target, env, c_compiler):
+ if target.os != "WINNT":
+- if target.kernel == "Darwin":
++ if target.kernel == "Darwin" or (c_compiler.type == "clang" and c_compiler.version >= "17.0.0"):
+ return ("-fvisibility=hidden", "-fvisibility-inlines-hidden")
+ return (
+ "-I%s/system_wrappers" % os.path.join(env.dist),
diff --git a/repos/clang/firefox/lolmalloc.patch b/repos/clang/firefox/lolmalloc.patch
new file mode 100644
index 00000000..41a62918
--- /dev/null
+++ b/repos/clang/firefox/lolmalloc.patch
@@ -0,0 +1,44 @@
+14:02.77 In file included from Unified_cpp_gfx_graphite2_src0.cpp:29:
+14:02.77 In file included from /builddir/thunderbird-115.4.2/gfx/graphite2/src/Collider.cpp:31:
+14:02.77 In file included from ../../../dist/stl_wrappers/functional:62:
+14:02.77 In file included from ../../../dist/system_wrappers/functional:3:
+14:02.77 In file included from /usr/bin/../include/c++/v1/functional:526:
+14:02.77 In file included from /usr/bin/../include/c++/v1/__functional/boyer_moore_searcher.h:27:
+14:02.77 In file included from ../../../dist/stl_wrappers/vector:62:
+14:02.77 In file included from ../../../dist/system_wrappers/vector:3:
+14:02.77 In file included from /usr/bin/../include/c++/v1/vector:321:
+14:02.77 In file included from /usr/bin/../include/c++/v1/__format/formatter_bool.h:20:
+14:02.77 In file included from /usr/bin/../include/c++/v1/__format/formatter_integral.h:32:
+14:02.77 In file included from ../../../dist/system_wrappers/locale:3:
+14:02.77 /usr/bin/../include/c++/v1/locale:2830:22: error: no member named 'moz_xrealloc' in namespace 'std'; did you mean simply 'moz_xrealloc'?
+14:02.77 2830 | _Tp* __t = (_Tp*)std::realloc(__owns ? __b.get() : 0, __new_cap);
+14:02.77 | ^~~~~
+14:02.77 ../../../dist/include/mozilla/mozalloc.h:82:16: note: 'moz_xrealloc' declared here
+14:02.77 82 | MFBT_API void* moz_xrealloc(void* ptr, size_t size) MOZ_INFALLIBLE_ALLOCATOR;
+14:02.77 | ^
+14:02.77 In file included from Unified_cpp_gfx_graphite2_src0.cpp:74:
+14:02.77 /builddir/thunderbird-115.4.2/gfx/graphite2/src/GlyphCache.cpp:47:40: warning: 'iterator<std::input_iterator_tag, std::pair<unsigned short, unsigned short>>' is deprecated [-Wdeprecated-declarations]
+14:02.77 47 | class _glat_iterator : public std::iterator<std::input_iterator_tag, std::pair<sparse::key_type, sparse::mapped_type> >
+14:02.77 | ^
+14:02.77 /usr/bin/../include/c++/v1/__iterator/iterator.h:24:29: note: 'iterator<std::input_iterator_tag, std::pair<unsigned short, unsigned short>>' has been explicitly marked deprecated here
+14:02.77 24 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 iterator
+14:02.77 | ^
+14:02.77 /usr/bin/../include/c++/v1/__config:983:41: note: expanded from macro '_LIBCPP_DEPRECATED_IN_CXX17'
+14:02.77 983 | # define _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_DEPRECATED
+14:02.77 | ^
+14:02.77 /usr/bin/../include/c++/v1/__config:956:49: note: expanded from macro '_LIBCPP_DEPRECATED'
+14:02.77 956 | # define _LIBCPP_DEPRECATED __attribute__((__deprecated__))
+14:02.77 | ^
+14:02.77 1 warning and 1 error generated.
+
+--- a/gfx/graphite2/src/MozGrMalloc.h
++++ b/gfx/graphite2/src/MozGrMalloc.h
+@@ -12,7 +12,7 @@
+
+ #include "mozilla/mozalloc.h"
+
+-#if defined(XP_LINUX) && !defined(ANDROID)
++#if 0
+
+ #define malloc moz_xmalloc
+ #define calloc moz_xcalloc
diff --git a/repos/clang/firefox/no-ccache-stats.patch b/repos/clang/firefox/no-ccache-stats.patch
new file mode 100644
index 00000000..4d557a01
--- /dev/null
+++ b/repos/clang/firefox/no-ccache-stats.patch
@@ -0,0 +1,13 @@
+prevents a call to ccache
+diff --git a/python/mozbuild/mozbuild/controller/building.py b/python/mozbuild/mozbuild/controller/building.py
+index bf7009a..011c012 100644
+--- a/python/mozbuild/mozbuild/controller/building.py
++++ b/python/mozbuild/mozbuild/controller/building.py
+@@ -570,6 +570,7 @@ class BuildMonitor(MozbuildObject):
+ )
+
+ def ccache_stats(self, ccache=None):
++ return None
+ ccache_stats = None
+
+ if ccache is None:
diff --git a/repos/clang/firefox/oldpatch/fix-target-detection.patch b/repos/clang/firefox/oldpatch/fix-target-detection.patch
new file mode 100644
index 00000000..8e115a3d
--- /dev/null
+++ b/repos/clang/firefox/oldpatch/fix-target-detection.patch
@@ -0,0 +1,19 @@
+diff --git a/build/moz.configure/rust.configure b/build/moz.configure/rust.configure
+index 7a2fd1a..ba5ba62 100644
+--- a/build/moz.configure/rust.configure
++++ b/build/moz.configure/rust.configure
+@@ -403,9 +403,13 @@ def detect_rustc_target(
+ ]
+ if len(narrowed) == 1:
+ return narrowed[0].rust_target
++ elif narrowed:
++ candidates = narrowed
++
++ aliased_vendor = "unknown" if host_or_target.vendor == "pc" else host_or_target.vendor
+
+ # Finally, see if the vendor can be used to disambiguate.
+- narrowed = [c for c in candidates if c.target.vendor == host_or_target.vendor]
++ narrowed = [c for c in candidates if c.target.vendor == aliased_vendor]
+ if len(narrowed) == 1:
+ return narrowed[0].rust_target
+
diff --git a/repos/clang/firefox/pgo-notimeout.patch b/repos/clang/firefox/pgo-notimeout.patch
new file mode 100644
index 00000000..f6d83ed4
--- /dev/null
+++ b/repos/clang/firefox/pgo-notimeout.patch
@@ -0,0 +1,26 @@
+Patch-Source: https://gist.github.com/classilla/1202f8d467749c029325278a87a068c8
+--
+--- a/toolkit/components/terminator/nsTerminator.cpp
++++ b/toolkit/components/terminator/nsTerminator.cpp
+@@ -455,16 +455,21 @@
+ // Defend against overflow
+ crashAfterMS = INT32_MAX;
+ } else {
+ crashAfterMS *= scaleUp;
+ }
+ }
+ #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());
+ // crashAfterTicks is guaranteed to be > 0 as
+ // crashAfterMS >= ADDITIONAL_WAIT_BEFORE_CRASH_MS >> HEARTBEAT_INTERVAL_MS
+ options->crashAfterTicks = crashAfterMS / HEARTBEAT_INTERVAL_MS;
+
+ DebugOnly<PRThread*> watchdogThread =
+ CreateSystemThread(RunWatchdog, options.release());
+ MOZ_ASSERT(watchdogThread);
diff --git a/repos/clang/firefox/ppc64-webrtc.patch b/repos/clang/firefox/ppc64-webrtc.patch
new file mode 100644
index 00000000..98a1301c
--- /dev/null
+++ b/repos/clang/firefox/ppc64-webrtc.patch
@@ -0,0 +1,19 @@
+--- a/third_party/libwebrtc/moz.build
++++ b/third_party/libwebrtc/moz.build
+@@ -637,6 +637,16 @@
+ "/third_party/libwebrtc/third_party/pipewire/pipewire_gn"
+ ]
+
++if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "ppc64":
++
++ DIRS += [
++ "/third_party/libwebrtc/modules/portal/portal_gn",
++ "/third_party/libwebrtc/third_party/drm/drm_gn",
++ "/third_party/libwebrtc/third_party/gbm/gbm_gn",
++ "/third_party/libwebrtc/third_party/libepoxy/libepoxy_gn",
++ "/third_party/libwebrtc/third_party/pipewire/pipewire_gn"
++ ]
++
+ if CONFIG["OS_TARGET"] == "OpenBSD" and CONFIG["TARGET_CPU"] == "aarch64":
+
+ DIRS += [
diff --git a/repos/clang/firefox/riscv64-reduce-debug.patch b/repos/clang/firefox/riscv64-reduce-debug.patch
new file mode 100644
index 00000000..e1f780d7
--- /dev/null
+++ b/repos/clang/firefox/riscv64-reduce-debug.patch
@@ -0,0 +1,23 @@
+commit 29ff842dfe33d172d115a90ab69cc240426dad04
+Author: q66 <q66@chimera-linux.org>
+Date: Tue Oct 4 10:45:28 2022 +0200
+
+ reduce debug_info on riscv
+
+diff --git a/build/moz.configure/rust.configure b/build/moz.configure/rust.configure
+index e64dc5d..e3e1fbd 100644
+--- a/build/moz.configure/rust.configure
++++ b/build/moz.configure/rust.configure
+@@ -653,7 +653,11 @@ def rust_compile_flags(
+ debug_assertions = False
+
+ if debug_symbols:
+- debug_info = "2"
++ # linking fails with full debug info on riscv
++ if target.cpu == "riscv64":
++ debug_info = "1"
++ else:
++ debug_info = "2"
+
+ opts = []
+
diff --git a/repos/clang/firefox/rust-lto.patch b/repos/clang/firefox/rust-lto.patch
new file mode 100644
index 00000000..df84f2a8
--- /dev/null
+++ b/repos/clang/firefox/rust-lto.patch
@@ -0,0 +1,27 @@
+set rust crate lto to thin to not use fatlto for gkrust which ooms on 32-bit.
+also a lot faster
+also no lto on riscv for now
+--
+diff --git a/config/makefiles/rust.mk b/config/makefiles/rust.mk
+index 524bc436fd..cdc8d6089c 100644
+--- a/config/makefiles/rust.mk
++++ b/config/makefiles/rust.mk
+@@ -91,8 +91,9 @@ ifndef MOZ_LTO_RUST_CROSS
+ ifndef rustflags_sancov
+ # Never enable when coverage is enabled to work around https://github.com/rust-lang/rust/issues/90045.
+ ifndef MOZ_CODE_COVERAGE
++ifeq (,$(findstring riscv64,$(RUST_TARGET)))
+ ifeq (,$(findstring gkrust_gtest,$(RUST_LIBRARY_FILE)))
+-cargo_rustc_flags += -Clto$(if $(filter full,$(MOZ_LTO_RUST_CROSS)),=fat)
++cargo_rustc_flags += -Clto=thin
+ endif
+ # We need -Cembed-bitcode=yes for all crates when using -Clto.
+ RUSTFLAGS += -Cembed-bitcode=yes
+@@ -101,6 +102,7 @@ endif
+ endif
+ endif
+ endif
++endif
+
+ ifdef CARGO_INCREMENTAL
+ export CARGO_INCREMENTAL
diff --git a/repos/clang/firefox/sandbox-sched_setscheduler.patch b/repos/clang/firefox/sandbox-sched_setscheduler.patch
new file mode 100644
index 00000000..d003de8c
--- /dev/null
+++ b/repos/clang/firefox/sandbox-sched_setscheduler.patch
@@ -0,0 +1,22 @@
+upstream bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1657849
+--- a/security/sandbox/linux/SandboxFilter.cpp
++++ b/security/sandbox/linux/SandboxFilter.cpp
+@@ -1751,6 +1751,6 @@ class GMPSandboxPolicy : public SandboxPolicyCommon {
+ case __NR_sched_get_priority_max:
++ case __NR_sched_setscheduler:
+ return Allow();
+ case __NR_sched_getparam:
+- case __NR_sched_getscheduler:
+- case __NR_sched_setscheduler: {
++ case __NR_sched_getscheduler: {
+ Arg<pid_t> pid(0);
+@@ -1926,3 +1926,2 @@ class RDDSandboxPolicy final : public SandboxPolicyCommon {
+ case __NR_sched_getscheduler:
+- case __NR_sched_setscheduler:
+ case __NR_sched_getattr:
+@@ -1932,2 +1931,5 @@ class RDDSandboxPolicy final : public SandboxPolicyCommon {
+ }
++ // sched_setscheduler gets special treatment here (bug 1657849):
++ case __NR_sched_setscheduler:
++ return Allow();
+
diff --git a/repos/clang/firefox/sqlite-ppc.patch b/repos/clang/firefox/sqlite-ppc.patch
new file mode 100644
index 00000000..6314b729
--- /dev/null
+++ b/repos/clang/firefox/sqlite-ppc.patch
@@ -0,0 +1,46 @@
+From f6546e3e0cadd98764ad85f80e771dca043cb77d Mon Sep 17 00:00:00 2001
+From: q66 <q66@chimera-linux.org>
+Date: Fri, 23 Sep 2022 02:38:29 +0200
+Subject: [PATCH] fix sqlite3 on ppc with clang
+
+The __ppc__ macro is always defined on clang but not gcc, which
+results in sqlite mistakenly thinking that ppc64le with clang
+is big endian.
+
+Also disable some inline assembly stuff on ppc that is never used
+with gcc and probably was never tested with modern machines.
+---
+ third_party/sqlite3/src/sqlite3.c | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/third_party/sqlite3/src/sqlite3.c b/third_party/sqlite3/src/sqlite3.c
+index dd3b5c5757..73398934f0 100644
+--- a/third_party/sqlite3/src/sqlite3.c
++++ b/third_party/sqlite3/src/sqlite3.c
+@@ -14875,7 +14875,7 @@
+ # elif defined(i386) || defined(__i386__) || defined(_M_IX86) || \
+ defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
+ defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
+- defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64)
++ defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64) || defined(__LITTLE_ENDIAN__)
+ # define SQLITE_BYTEORDER 1234
+ # elif defined(sparc) || defined(__ARMEB__) || defined(__AARCH64EB__)
+ # define SQLITE_BYTEORDER 4321
+@@ -35670,7 +35670,7 @@ SQLITE_PRIVATE int sqlite3VListNameToNum(VList *pIn, const char *zName, int nNam
+ return (sqlite_uint64)hi << 32 | lo;
+ }
+
+-#elif !defined(__STRICT_ANSI__) && (defined(__GNUC__) && defined(__ppc__))
++#elif 0
+
+ __inline__ sqlite_uint64 sqlite3Hwtime(void){
+ unsigned long long retval;
+@@ -207003,7 +207003,7 @@
+ # elif defined(i386) || defined(__i386__) || defined(_M_IX86) || \
+ defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
+ defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
+- defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64)
++ defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64) || defined(__LITTLE_ENDIAN__)
+ # define SQLITE_BYTEORDER 1234
+ # elif defined(sparc) || defined(__ARMEB__) || defined(__AARCH64EB__)
+ # define SQLITE_BYTEORDER 4321
diff --git a/repos/clang/firefox/wasip1.patch b/repos/clang/firefox/wasip1.patch
new file mode 100644
index 00000000..c8a5aca1
--- /dev/null
+++ b/repos/clang/firefox/wasip1.patch
@@ -0,0 +1,11 @@
+--- a/build/moz.configure/toolchain.configure
++++ b/build/moz.configure/toolchain.configure
+@@ -979,7 +979,7 @@
+
+ @dependable
+ def wasm():
+- return split_triplet("wasm32-wasi", allow_wasi=True)
++ return split_triplet("wasm32-wasip1", allow_wasi=True)
+
+
+ @template
diff --git a/repos/clang/firefox/xptcall-integrated-as.patch b/repos/clang/firefox/xptcall-integrated-as.patch
new file mode 100644
index 00000000..5faa7100
--- /dev/null
+++ b/repos/clang/firefox/xptcall-integrated-as.patch
@@ -0,0 +1,21 @@
+commit 026a5feb719d69a44f984048cb9cdf296fb15801
+Author: q66 <q66@chimera-linux.org>
+Date: Mon Aug 22 23:42:54 2022 +0200
+
+ use integrated-as on ppc64
+
+diff --git a/xpcom/reflect/xptcall/md/unix/moz.build b/xpcom/reflect/xptcall/md/unix/moz.build
+index 1779c14..cd4595c 100644
+--- a/xpcom/reflect/xptcall/md/unix/moz.build
++++ b/xpcom/reflect/xptcall/md/unix/moz.build
+@@ -143,10 +143,6 @@
+ "xptcstubs_asm_ppc64_linux.S",
+ "xptcstubs_ppc64_linux.cpp",
+ ]
+- if CONFIG["CC_TYPE"] == "clang":
+- ASFLAGS += [
+- "-fno-integrated-as",
+- ]
+
+ if CONFIG["OS_ARCH"] == "OpenBSD" and CONFIG["TARGET_CPU"] == "ppc":
+ SOURCES += [