From: Michael Tremer <michael.tremer@ipfire.org>
To: development@lists.ipfire.org
Subject: [PATCH 1/7] ffmpeg: Fix build with binutils 2.41
Date: Tue, 15 Aug 2023 17:02:24 +0000 [thread overview]
Message-ID: <20230815170230.306397-1-michael.tremer@ipfire.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 3454 bytes --]
Signed-off-by: Michael Tremer <michael.tremer(a)ipfire.org>
---
lfs/ffmpeg | 2 +-
...hpops-clip-constants-used-with-shift.patch | 76 +++++++++++++++++++
2 files changed, 77 insertions(+), 1 deletion(-)
create mode 100644 src/patches/ffmpeg-6.0-mathpops-clip-constants-used-with-shift.patch
diff --git a/lfs/ffmpeg b/lfs/ffmpeg
index d989846d5..836c4dd37 100644
--- a/lfs/ffmpeg
+++ b/lfs/ffmpeg
@@ -85,7 +85,7 @@ $(subst %,%_BLAKE2,$(objects)) :
$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
@$(PREBUILD)
@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
-
+ cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/ffmpeg-6.0-mathpops-clip-constants-used-with-shift.patch
cd $(DIR_APP) && \
CFLAGS="$(CFLAGS)" \
LDFLAGS="$(LDFLAGS)" \
diff --git a/src/patches/ffmpeg-6.0-mathpops-clip-constants-used-with-shift.patch b/src/patches/ffmpeg-6.0-mathpops-clip-constants-used-with-shift.patch
new file mode 100644
index 000000000..52a931002
--- /dev/null
+++ b/src/patches/ffmpeg-6.0-mathpops-clip-constants-used-with-shift.patch
@@ -0,0 +1,76 @@
+From effadce6c756247ea8bae32dc13bb3e6f464f0eb Mon Sep 17 00:00:00 2001
+From: =?utf8?q?R=C3=A9mi=20Denis-Courmont?= <remi(a)remlab.net>
+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 <jamrial(a)gmail.com>
+---
+ 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.25.1
+
--
2.39.2
next reply other threads:[~2023-08-15 17:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-15 17:02 Michael Tremer [this message]
2023-08-15 17:02 ` [PATCH 2/7] ipfire-netboot: " Michael Tremer
2023-08-15 17:02 ` [PATCH 3/7] binutils: Update to 2.41 Michael Tremer
2023-08-15 17:02 ` [PATCH 5/7] binutils: Disable building gprof-ng in toolchain Michael Tremer
2023-08-15 17:02 ` [PATCH 6/7] glibc: Update to 2.38 Michael Tremer
2023-08-15 17:02 ` [PATCH 7/7] make.sh: Bump toolchain version Michael Tremer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230815170230.306397-1-michael.tremer@ipfire.org \
--to=michael.tremer@ipfire.org \
--cc=development@lists.ipfire.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox