From 8b1357c1f79c1e1d4b59bb4ff81d600a38350c5b Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Tue, 3 Oct 2023 22:22:35 -0500 Subject: user/{firefox-esr,thunderbird}: Fix x86 asm in avc Required for binutils-2.41 upgrade. See patch for details. Fixes: #1074 --- user/firefox-esr/APKBUILD | 4 ++- user/firefox-esr/BTS-1074.patch | 62 +++++++++++++++++++++++++++++++++++++++++ user/thunderbird/APKBUILD | 2 ++ user/thunderbird/BTS-1074.patch | 62 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 129 insertions(+), 1 deletion(-) create mode 100644 user/firefox-esr/BTS-1074.patch create mode 100644 user/thunderbird/BTS-1074.patch diff --git a/user/firefox-esr/APKBUILD b/user/firefox-esr/APKBUILD index 4ab23307c..c4b881eaf 100644 --- a/user/firefox-esr/APKBUILD +++ b/user/firefox-esr/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: A. Wilcox pkgname=firefox-esr pkgver=91.13.0 -pkgrel=2 +pkgrel=3 pkgdesc="Firefox web browser (extended support release)" url="https://www.mozilla.org/firefox/" arch="all !ppc !armv7" # #837, #1015 @@ -32,6 +32,7 @@ source="https://ftp.mozilla.org/pub/firefox/releases/$_ffxver/source/firefox-$_f mozconfig bad-google-code.patch + BTS-1074.patch fix-mutex-build.patch fix-seccomp-bpf.patch gcc89074.patch @@ -153,6 +154,7 @@ package() { sha512sums="38b4cc52de21e76d6061e6ba175e1cbfd888a16070aa951f5a44283f2db9d7e94f2504621f0da78feac6e71491a6d0e7038f63dd0ae112dcad700eb02e9aa516 firefox-91.13.0esr.source.tar.xz 86168a5e5b8aa3ea7cc0d40174baa97595c82b8e599937155fbd7761e7df7220980c74f75e96c34e5f660423e42ad67761f57b2923389be363253868bac033a9 mozconfig ace7492f4fb0523c7340fdc09c831906f74fddad93822aff367135538dacd3f56288b907f5a04f53f94c76e722ba0bab73e28d83ec12d3e672554712e6b08613 bad-google-code.patch +57410e4b9199f3c7db1cd4a0cf3e67cd962b585730c073edb1cadc3bcac5b0aec4e6f7efe24f3eadd1020aefef475e08e97f13dc6b6534e639f33cc6fb1abe04 BTS-1074.patch c0b2bf43206c2a5154e560ef30189a1062ae856861b39f52ce69002390ff9972d43e387bfd2bf8d2ab3cac621987bc042c8c0a8b4cf90ae05717ca7705271880 fix-mutex-build.patch 70863b985427b9653ce5e28d6064f078fb6d4ccf43dd1b68e72f97f44868fc0ce063161c39a4e77a0a1a207b7365d5dc7a7ca5e68c726825eba814f2b93e2f5d fix-seccomp-bpf.patch 6eb7fb134760f5d232710c56f18f14de4f533e41e269531edd01f5650f6d641513e34a8d2294af5ad6fd184736f674c734efb4cc003636a75e14a8fdba2fe3b0 gcc89074.patch diff --git a/user/firefox-esr/BTS-1074.patch b/user/firefox-esr/BTS-1074.patch new file mode 100644 index 000000000..fdc5478b4 --- /dev/null +++ b/user/firefox-esr/BTS-1074.patch @@ -0,0 +1,62 @@ +gas(1) under binutils-2.41 no longer allows invalid negative shifts. + +This patch fixes the bundled FFmpeg in Firefox to not use them. + +--- a/media/ffvpx/libavcodec/x86/mathops.h.old 2023-10-03 22:15:24.440738743 -0500 ++++ b/media/ffvpx/libavcodec/x86/mathops.h 2023-10-03 22:15:41.458911245 -0500 +@@ -35,12 +35,20 @@ + static av_always_inline av_const int MULL(int a, int b, unsigned shift) + { + int rt, dummy; ++ if (__builtin_constant_p(shift)) + __asm__ ( + "imull %3 \n\t" + "shrdl %4, %%edx, %%eax \n\t" + :"=a"(rt), "=d"(dummy) +- :"a"(a), "rm"(b), "ci"((uint8_t)shift) ++ :"a"(a), "rm"(b), "i"(shift & 0x1F) + ); ++ else ++ __asm__ ( ++ "imull %3 \n\t" ++ "shrdl %4, %%edx, %%eax \n\t" ++ :"=a"(rt), "=d"(dummy) ++ :"a"(a), "rm"(b), "c"((uint8_t)shift) ++ ); + return rt; + } + +@@ -113,19 +121,31 @@ + // avoid +32 for shift optimization (gcc should do that ...) + #define NEG_SSR32 NEG_SSR32 + static inline int32_t NEG_SSR32( int32_t a, int8_t s){ ++ if (__builtin_constant_p(s)) + __asm__ ("sarl %1, %0\n\t" + : "+r" (a) +- : "ic" ((uint8_t)(-s)) ++ : "i" (-s & 0x1F) + ); ++ else ++ __asm__ ("sarl %1, %0\n\t" ++ : "+r" (a) ++ : "c" ((uint8_t)(-s)) ++ ); + return a; + } + + #define NEG_USR32 NEG_USR32 + static inline uint32_t NEG_USR32(uint32_t a, int8_t s){ ++ if (__builtin_constant_p(s)) + __asm__ ("shrl %1, %0\n\t" + : "+r" (a) +- : "ic" ((uint8_t)(-s)) ++ : "i" (-s & 0x1F) + ); ++ else ++ __asm__ ("shrl %1, %0\n\t" ++ : "+r" (a) ++ : "c" ((uint8_t)(-s)) ++ ); + return a; + } + diff --git a/user/thunderbird/APKBUILD b/user/thunderbird/APKBUILD index 7b970d145..78ee2c13e 100644 --- a/user/thunderbird/APKBUILD +++ b/user/thunderbird/APKBUILD @@ -27,6 +27,7 @@ source="https://archive.mozilla.org/pub/thunderbird/releases/$pkgver/source/thun mozconfig bad-google-code.patch + BTS-1074.patch fix-mutex-build.patch fix-seccomp-bpf.patch gcc89074.patch @@ -150,6 +151,7 @@ package() { sha512sums="e73d3db4333ad659ec1ab249bd261e8c28301c125d0c39b473c83f8fccace6d4916a2bfef14fc20c065055ff6bbd3ca618b5aab178241b53509543640dcd541a thunderbird-91.13.0.source.tar.xz afc87cdd19500f8b6b0bedabe98339cca9e6af86edb45e673c6ee0a49bdb3a48b1816f6f5f8790cab86cca428ab7f142cbeb6462079fe293f5f13563a7761896 mozconfig ace7492f4fb0523c7340fdc09c831906f74fddad93822aff367135538dacd3f56288b907f5a04f53f94c76e722ba0bab73e28d83ec12d3e672554712e6b08613 bad-google-code.patch +df76bae9deaaae98afa9e1e853de5d41a4f84db65057bfe70de3ae172515bdef58a5f9ee0b2303493dc67e9a6aad54af4c9931166de1144737a5867f24b51a4f BTS-1074.patch c0b2bf43206c2a5154e560ef30189a1062ae856861b39f52ce69002390ff9972d43e387bfd2bf8d2ab3cac621987bc042c8c0a8b4cf90ae05717ca7705271880 fix-mutex-build.patch 70863b985427b9653ce5e28d6064f078fb6d4ccf43dd1b68e72f97f44868fc0ce063161c39a4e77a0a1a207b7365d5dc7a7ca5e68c726825eba814f2b93e2f5d fix-seccomp-bpf.patch 6eb7fb134760f5d232710c56f18f14de4f533e41e269531edd01f5650f6d641513e34a8d2294af5ad6fd184736f674c734efb4cc003636a75e14a8fdba2fe3b0 gcc89074.patch diff --git a/user/thunderbird/BTS-1074.patch b/user/thunderbird/BTS-1074.patch new file mode 100644 index 000000000..ac851038d --- /dev/null +++ b/user/thunderbird/BTS-1074.patch @@ -0,0 +1,62 @@ +gas(1) under binutils-2.41 no longer allows invalid negative shifts. + +This patch fixes the bundled FFmpeg in Thunderbird to not use them. + +--- thunderbird-91.13.0/media/ffvpx/libavcodec/x86/mathops.h.old 2023-10-03 22:15:24.440738743 -0500 ++++ thunderbird-91.13.0/media/ffvpx/libavcodec/x86/mathops.h 2023-10-03 22:15:41.458911245 -0500 +@@ -35,12 +35,20 @@ + static av_always_inline av_const int MULL(int a, int b, unsigned shift) + { + int rt, dummy; ++ if (__builtin_constant_p(shift)) + __asm__ ( + "imull %3 \n\t" + "shrdl %4, %%edx, %%eax \n\t" + :"=a"(rt), "=d"(dummy) +- :"a"(a), "rm"(b), "ci"((uint8_t)shift) ++ :"a"(a), "rm"(b), "i"(shift & 0x1F) + ); ++ else ++ __asm__ ( ++ "imull %3 \n\t" ++ "shrdl %4, %%edx, %%eax \n\t" ++ :"=a"(rt), "=d"(dummy) ++ :"a"(a), "rm"(b), "c"((uint8_t)shift) ++ ); + return rt; + } + +@@ -113,19 +121,31 @@ + // avoid +32 for shift optimization (gcc should do that ...) + #define NEG_SSR32 NEG_SSR32 + static inline int32_t NEG_SSR32( int32_t a, int8_t s){ ++ if (__builtin_constant_p(s)) + __asm__ ("sarl %1, %0\n\t" + : "+r" (a) +- : "ic" ((uint8_t)(-s)) ++ : "i" (-s & 0x1F) + ); ++ else ++ __asm__ ("sarl %1, %0\n\t" ++ : "+r" (a) ++ : "c" ((uint8_t)(-s)) ++ ); + return a; + } + + #define NEG_USR32 NEG_USR32 + static inline uint32_t NEG_USR32(uint32_t a, int8_t s){ ++ if (__builtin_constant_p(s)) + __asm__ ("shrl %1, %0\n\t" + : "+r" (a) +- : "ic" ((uint8_t)(-s)) ++ : "i" (-s & 0x1F) + ); ++ else ++ __asm__ ("shrl %1, %0\n\t" ++ : "+r" (a) ++ : "c" ((uint8_t)(-s)) ++ ); + return a; + } + -- cgit v1.2.3-70-g09d2