From bd32ddc0480654b81e97041b0295dc962f6a700f Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Tue, 3 Oct 2023 22:28:22 -0500 Subject: user/ffmpeg: Fix x86 assembler for new binutils --- user/ffmpeg/APKBUILD | 6 +- .../fix-avcodec-x86-mathops-binutils-241.patch | 76 ++++++++++++++++++++++ 2 files changed, 80 insertions(+), 2 deletions(-) create mode 100644 user/ffmpeg/fix-avcodec-x86-mathops-binutils-241.patch (limited to 'user/ffmpeg') diff --git a/user/ffmpeg/APKBUILD b/user/ffmpeg/APKBUILD index 82c463675..de3213b98 100644 --- a/user/ffmpeg/APKBUILD +++ b/user/ffmpeg/APKBUILD @@ -4,7 +4,7 @@ # Maintainer: A. Wilcox pkgname=ffmpeg pkgver=4.4.1 -pkgrel=0 +pkgrel=1 pkgdesc="Record, convert, and stream audio and video" url="https://ffmpeg.org/" arch="all" @@ -21,6 +21,7 @@ makedepends="alsa-lib-dev bzip2-dev freetype-dev gnutls-dev imlib2-dev subpackages="$pkgname-dev $pkgname-doc $pkgname-libs" source="https://ffmpeg.org/releases/ffmpeg-$pkgver.tar.xz 0001-libavutil-clean-up-unused-FF_SYMVER-macro.patch + fix-avcodec-x86-mathops-binutils-241.patch " # secfixes: @@ -101,4 +102,5 @@ libs() { } sha512sums="c651c120b71db6991ffc54abc291986e7d35d776203af327f9a28853d1d0af468ca0956e2d3d893f55a211f70a40c041d5aa9aa9664ef581302b27494be9374e ffmpeg-4.4.1.tar.xz -1047a23eda51b576ac200d5106a1cd318d1d5291643b3a69e025c0a7b6f3dbc9f6eb0e1e6faa231b7e38c8dd4e49a54f7431f87a93664da35825cc2e9e8aedf4 0001-libavutil-clean-up-unused-FF_SYMVER-macro.patch" +1047a23eda51b576ac200d5106a1cd318d1d5291643b3a69e025c0a7b6f3dbc9f6eb0e1e6faa231b7e38c8dd4e49a54f7431f87a93664da35825cc2e9e8aedf4 0001-libavutil-clean-up-unused-FF_SYMVER-macro.patch +c1141eb8b8d9d02f021fee2290d02b16d924d2fcca9ea971f9438db46c7d83775bc7ffeb87fba6561008c43359684329c7f7f8f82aea7999b252e3ab98617581 fix-avcodec-x86-mathops-binutils-241.patch" diff --git a/user/ffmpeg/fix-avcodec-x86-mathops-binutils-241.patch b/user/ffmpeg/fix-avcodec-x86-mathops-binutils-241.patch new file mode 100644 index 000000000..33fd3d484 --- /dev/null +++ b/user/ffmpeg/fix-avcodec-x86-mathops-binutils-241.patch @@ -0,0 +1,76 @@ +From effadce6c756247ea8bae32dc13bb3e6f464f0eb Mon Sep 17 00:00:00 2001 +From: =?utf8?q?R=C3=A9mi=20Denis-Courmont?= +Date: Sun, 16 Jul 2023 18:18:02 +0300 +Subject: [PATCH] avcodec/x86/mathops: clip constants used with shift + instructions within inline assembly + +Fixes assembling with binutil as >= 2.41 + +Signed-off-by: James Almer +--- + libavcodec/x86/mathops.h | 26 +++++++++++++++++++++++--- + 1 file changed, 23 insertions(+), 3 deletions(-) + +diff --git a/libavcodec/x86/mathops.h b/libavcodec/x86/mathops.h +index 6298f5ed19..ca7e2dffc1 100644 +--- a/libavcodec/x86/mathops.h ++++ b/libavcodec/x86/mathops.h +@@ -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 @@ __asm__ volatile(\ + // 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; + } + +-- +2.30.2 + -- cgit v1.2.3-70-g09d2