From 5284e0dc72737be0b5bd5e1d9abc8ff517c87a7a Mon Sep 17 00:00:00 2001 From: Owen Rafferty Date: Mon, 21 Aug 2023 17:55:39 -0500 Subject: [PATCH] ffmpeg: binutils 2.41 patch --- extra/ffmpeg/build | 3 +- extra/ffmpeg/checksums | 1 + extra/ffmpeg/patches/binutils-2.41.patch | 60 ++++++++++++++++++++++++ extra/ffmpeg/sources | 1 + 4 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 extra/ffmpeg/patches/binutils-2.41.patch diff --git a/extra/ffmpeg/build b/extra/ffmpeg/build index a0d26afa..501cb4e8 100755 --- a/extra/ffmpeg/build +++ b/extra/ffmpeg/build @@ -1,6 +1,7 @@ #!/bin/sh -e patch -p1 < add-av_stream_get_first_dts-for-chromium.patch +patch -p1 < binutils-2.41.patch ./configure \ --cc="$CC" \ @@ -29,7 +30,7 @@ patch -p1 < add-av_stream_get_first_dts-for-chromium.patch --enable-openssl \ --enable-shared \ --enable-version3 \ - --x86asmexe=nasm \ + --x86asmexe=nasm make make DESTDIR="$1" install diff --git a/extra/ffmpeg/checksums b/extra/ffmpeg/checksums index c3f5a423..005106c7 100644 --- a/extra/ffmpeg/checksums +++ b/extra/ffmpeg/checksums @@ -1,2 +1,3 @@ 4879074c357102f85932673044c57c144b0c188ae58edec2a115965536ee340f5e 4f16712641b400498753572c0f2d1e30f28fa0df0ea8d0bd2da9d2d74f6613b3ee +4ce8f7ccc5b582575bcf16c399a3cccbd53c8347ae836951ea50c5045f1b8f3232 diff --git a/extra/ffmpeg/patches/binutils-2.41.patch b/extra/ffmpeg/patches/binutils-2.41.patch new file mode 100644 index 00000000..395b4db0 --- /dev/null +++ b/extra/ffmpeg/patches/binutils-2.41.patch @@ -0,0 +1,60 @@ +diff --git a/libavcodec/x86/mathops.h b/libavcodec/x86/mathops.h +index 6298f5e..ca7e2df 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; + } + diff --git a/extra/ffmpeg/sources b/extra/ffmpeg/sources index eb6e1dfb..56faaf7e 100644 --- a/extra/ffmpeg/sources +++ b/extra/ffmpeg/sources @@ -1,2 +1,3 @@ https://ffmpeg.org/releases/ffmpeg-6.0.tar.xz patches/add-av_stream_get_first_dts-for-chromium.patch +patches/binutils-2.41.patch