package/ffmpeg: fix build with binutils >= 2.41
PATCH 1/4 package/ffmpeg: fix build with binutils >= 2.41
--- ...xes-assembling-with-binutils-as-2.41.patch | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 package/ffmpeg/0005-Fixes-assembling-with-binutils-as-2.41.patch
package/ffmpeg/0005-Fixes-assembling-with-binutils-as-2.41.patch new file +84 -0
@@ -0,0 +1,84 @@ +From effadce6c756247ea8bae32dc13bb3e6f464f0eb Mon Sep 17 00:00:00 2001 +From: =?utf8?q?R=C3=A9mi=20Denis-Courmont?= <[email protected]> +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 binutils as >= 2.41 + +Upstream: http://git.videolan.org/?p=ffmpeg.git;a=commitdiff;h=effadce6c756247ea8bae32dc13bb3e6f464f0eb + +Bug reports for this change in binutils: +https://fftrac-bg.ffmpeg.org/ticket/10405 +https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108941 +https://sourceware.org/bugzilla/show_bug.cgi?id=30578 + +Signed-off-by: James Almer <[email protected]> +Signed-off-by: Bernd Kuhls <[email protected]> +--- + 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 +
Signature · 6 lines
2.39.2 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 2/4 package/{binutils, libiberty}: add support for version 2.41
Release notes:
https://sourceware.org/pipermail/binutils/2023-July/128719.html
Copied patches from version 2.40.
Build-tested using these four defconfigs:
----------
BR2_arceb=y
----------
BR2_BINUTILS_VERSION_2_39_X=y
----------
(empty defconfig meaning binutils-2.40)
----------
BR2_BINUTILS_VERSION_2_41_X=y
----------
each using these commands:
$ make host-libiberty $ make host-binutils
--- package/binutils/2.41/0001-sh-conf.patch | 50 +++ .../2.41/0002-poison-system-directories.patch | 309 ++++++++++++++++++ package/binutils/Config.in.host | 5 + package/binutils/binutils.hash | 1 + package/libiberty/libiberty.mk | 2 +- 5 files changed, 366 insertions(+), 1 deletion(-) create mode 100644 package/binutils/2.41/0001-sh-conf.patch create mode 100644 package/binutils/2.41/0002-poison-system-directories.patch
package/binutils/2.41/0001-sh-conf.patch new file +50 -0
@@ -0,0 +1,50 @@ +From 87551ade276aa0db86c4567b3ac219c4f979b538 Mon Sep 17 00:00:00 2001 +From: Romain Naour <[email protected]> +Date: Fri, 25 Dec 2015 11:38:13 +0100 +Subject: [PATCH] sh-conf + +Likewise, binutils has no idea about any of these new targets either, so we +fix that up too.. now we're able to actually build a real toolchain for +sh2a_nofpu- and other more ineptly named toolchains (and yes, there are more +inept targets than that one, really. Go look, I promise). + +Upstream: N/A [Buildroot specific] + +[Romain: rebase on top of 2.32] +Signed-off-by: Romain Naour <[email protected]> +[Thomas: rebase on top of 2.29, in which sh64 support was removed.] +Signed-off-by: Thomas Petazzoni <[email protected]> +--- + configure | 2 +- + configure.ac | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/configure b/configure +index 417fc5a970c..fa8ba331796 100755 +--- a/configure ++++ b/configure +@@ -4067,7 +4067,7 @@ case "${target}" in + nvptx*-*-*) + noconfigdirs="$noconfigdirs target-libssp target-libstdc++-v3 target-libobjc" + ;; +- sh-*-*) ++ sh*-*-*) + case "${target}" in + sh*-*-elf) + ;; +diff --git a/configure.ac b/configure.ac +index 3a1eb0357e5..d700c14ddf5 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1300,7 +1300,7 @@ case "${target}" in + nvptx*-*-*) + noconfigdirs="$noconfigdirs target-libssp target-libstdc++-v3 target-libobjc" + ;; +- sh-*-*) ++ sh*-*-*) + case "${target}" in + sh*-*-elf) + ;; +-- +2.40.1 +
package/binutils/2.41/0002-poison-system-directories.patch new file +309 -0
309 lines not on this page · raw message
package/binutils/Config.in.host +5 -0
@@ -25,6 +25,10 @@ config BR2_BINUTILS_VERSION_2_40_X bool "binutils 2.40" select BR2_PACKAGE_BINUTILS_HAS_LIBSFRAME +config BR2_BINUTILS_VERSION_2_41_X + bool "binutils 2.41" + select BR2_PACKAGE_BINUTILS_HAS_LIBSFRAME + config BR2_BINUTILS_VERSION_ARC bool "binutils arc (2.34.50)" depends on BR2_arc
@@ -37,6 +41,7 @@ config BR2_BINUTILS_VERSION default "2.38" if BR2_BINUTILS_VERSION_2_38_X default "2.39" if BR2_BINUTILS_VERSION_2_39_X default "2.40" if BR2_BINUTILS_VERSION_2_40_X + default "2.41" if BR2_BINUTILS_VERSION_2_41_X config BR2_BINUTILS_GPROFNG bool "gprofng support"
package/binutils/binutils.hash +1 -0
@@ -2,6 +2,7 @@ sha512 8bf0b0d193c9c010e0518ee2b2e5a830898af206510992483b427477ed178396cd210235e85fd7bd99a96fc6d5eedbeccbd48317a10f752b7336ada8b2bb826d binutils-2.38.tar.xz sha512 68e038f339a8c21faa19a57bbc447a51c817f47c2e06d740847c6e9cc3396c025d35d5369fa8c3f8b70414757c89f0e577939ddc0d70f283182504920f53b0a3 binutils-2.39.tar.xz sha512 a37e042523bc46494d99d5637c3f3d8f9956d9477b748b3b1f6d7dfbb8d968ed52c932e88a4e946c6f77b8f48f1e1b360ca54c3d298f17193f3b4963472f6925 binutils-2.40.tar.xz +sha512 5df45d0bd6ddabdce4f35878c041e46a92deef01e7dea5facc97fd65cc06b59abc6fba0eb454b68e571c7e14038dc823fe7f2263843e6e627b7444eaf0fe9374 binutils-2.41.tar.xz # Locally calculated (fetched from Github) sha512 76a8227a19218435319c660e4983ea17985194b7f496f163e97543e7f6fd3e9249241fdc05a16ba512fba96a1d846c1f7b080983404d821d6215f10e7f11e238 binutils-gdb-arc-2020.09-release.tar.gz
package/libiberty/libiberty.mk +1 -1
@@ -4,7 +4,7 @@ # ################################################################################ -LIBIBERTY_VERSION = 2.40 +LIBIBERTY_VERSION = 2.41 LIBIBERTY_SOURCE = binutils-$(LIBIBERTY_VERSION).tar.xz LIBIBERTY_SITE = $(BR2_GNU_MIRROR)/binutils HOST_LIBIBERTY_DL_SUBDIR = binutils
Signature · 6 lines
2.39.2 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 3/4 package/binutils: switch to 2.40.x as the default version
In reply to Bernd KuhlsNow that 2.41 has been released, let's use 2.40.x as the default binutils version.
--- package/binutils/Config.in.host | 2 +- package/binutils/binutils.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
package/binutils/Config.in.host +1 -1
@@ -10,7 +10,7 @@ config BR2_PACKAGE_BINUTILS_HAS_LIBSFRAME choice prompt "Binutils Version" - default BR2_BINUTILS_VERSION_2_39_X if !BR2_arc + default BR2_BINUTILS_VERSION_2_40_X if !BR2_arc default BR2_BINUTILS_VERSION_ARC if BR2_arc help Select the version of binutils you wish to use.
package/binutils/binutils.mk +1 -1
@@ -11,7 +11,7 @@ ifeq ($(BINUTILS_VERSION),) ifeq ($(BR2_arc),y) BINUTILS_VERSION = arc-2020.09-release else -BINUTILS_VERSION = 2.39 +BINUTILS_VERSION = 2.40 endif endif # BINUTILS_VERSION
Signature · 6 lines
2.39.2 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 4/4 package/binutils: drop 2.38.x series
In reply to Bernd KuhlsNow that 2.41.x has been added, that 2.40.x is the default version, drop support for 2.38.x.
--- .checkpackageignore | 5 - Config.in.legacy | 6 + package/binutils/2.38/0001-sh-conf.patch | 48 --- .../2.38/0002-poison-system-directories.patch | 306 ------------------ ...or1k-fix-building-with-gcc-version-5.patch | 50 --- ...K_GOT16-signed-overflow-by-using-spe.patch | 75 ----- ...binutils-2.38-vs.-ppc32-linux-kernel.patch | 55 ---- package/binutils/Config.in.host | 5 - package/binutils/binutils.hash | 1 - 9 files changed, 6 insertions(+), 545 deletions(-) delete mode 100644 package/binutils/2.38/0001-sh-conf.patch delete mode 100644 package/binutils/2.38/0002-poison-system-directories.patch delete mode 100644 package/binutils/2.38/0003-bfd-elf32-or1k-fix-building-with-gcc-version-5.patch delete mode 100644 package/binutils/2.38/0004-or1k-Avoid-R_OR1K_GOT16-signed-overflow-by-using-spe.patch delete mode 100644 package/binutils/2.38/0005-binutils-2.38-vs.-ppc32-linux-kernel.patch
.checkpackageignore +0 -5
@@ -213,11 +213,6 @@ package/berkeleydb/0001-cwd-db_config.patch Upstream package/berkeleydb/0002-atomic_compare_exchange.patch Upstream package/bind/0001-cross.patch Upstream package/bind/S81named Indent Shellcheck Variables -package/binutils/2.38/0001-sh-conf.patch Upstream -package/binutils/2.38/0002-poison-system-directories.patch Upstream -package/binutils/2.38/0003-bfd-elf32-or1k-fix-building-with-gcc-version-5.patch Upstream -package/binutils/2.38/0004-or1k-Avoid-R_OR1K_GOT16-signed-overflow-by-using-spe.patch Upstream -package/binutils/2.38/0005-binutils-2.38-vs.-ppc32-linux-kernel.patch Upstream package/binutils/2.39/0001-sh-conf.patch Upstream package/binutils/2.39/0002-poison-system-directories.patch Upstream package/binutils/2.39/0003-bfd-elf32-or1k-fix-building-with-gcc-version-5.patch Upstream
Config.in.legacy +6 -0
@@ -146,6 +146,12 @@ endif comment "Legacy options removed in 2023.08" +config BR2_BINUTILS_VERSION_2_38_X + bool "binutils 2.38.x has been removed" + select BR2_LEGACY + help + binutils 2.38 has been removed, use a newer version. + config BR2_GCC_VERSION_10_X bool "gcc 10.x support removed" select BR2_LEGACY
package/binutils/2.38/0001-sh-conf.patch deleted +0 -48
48 lines not on this page · raw message
package/binutils/2.38/0002-poison-system-directories.patch deleted +0 -306
306 lines not on this page · raw message
package/binutils/2.38/0003-bfd-elf32-or1k-fix-building-with-gcc-version-5.patch deleted +0 -50
50 lines not on this page · raw message
package/binutils/2.38/0004-or1k-Avoid-R_OR1K_GOT16-signed-overflow-by-using-spe.patch deleted +0 -75
75 lines not on this page · raw message
package/binutils/2.38/0005-binutils-2.38-vs.-ppc32-linux-kernel.patch deleted +0 -55
55 lines not on this page · raw message
package/binutils/Config.in.host +0 -5
@@ -15,9 +15,6 @@ choice help Select the version of binutils you wish to use. -config BR2_BINUTILS_VERSION_2_38_X - bool "binutils 2.38" - config BR2_BINUTILS_VERSION_2_39_X bool "binutils 2.39"
@@ -38,7 +35,6 @@ endchoice config BR2_BINUTILS_VERSION string default "arc-2020.09-release" if BR2_BINUTILS_VERSION_ARC - default "2.38" if BR2_BINUTILS_VERSION_2_38_X default "2.39" if BR2_BINUTILS_VERSION_2_39_X default "2.40" if BR2_BINUTILS_VERSION_2_40_X default "2.41" if BR2_BINUTILS_VERSION_2_41_X
@@ -46,7 +42,6 @@ config BR2_BINUTILS_VERSION config BR2_BINUTILS_GPROFNG bool "gprofng support" depends on !BR2_BINUTILS_VERSION_ARC - depends on !BR2_BINUTILS_VERSION_2_38_X help This option enables support for gprofng, a new profiler.
package/binutils/binutils.hash +0 -1
@@ -1,5 +1,4 @@ # From https://gcc.gnu.org/pub/binutils/releases/sha512.sum -sha512 8bf0b0d193c9c010e0518ee2b2e5a830898af206510992483b427477ed178396cd210235e85fd7bd99a96fc6d5eedbeccbd48317a10f752b7336ada8b2bb826d binutils-2.38.tar.xz sha512 68e038f339a8c21faa19a57bbc447a51c817f47c2e06d740847c6e9cc3396c025d35d5369fa8c3f8b70414757c89f0e577939ddc0d70f283182504920f53b0a3 binutils-2.39.tar.xz sha512 a37e042523bc46494d99d5637c3f3d8f9956d9477b748b3b1f6d7dfbb8d968ed52c932e88a4e946c6f77b8f48f1e1b360ca54c3d298f17193f3b4963472f6925 binutils-2.40.tar.xz sha512 5df45d0bd6ddabdce4f35878c041e46a92deef01e7dea5facc97fd65cc06b59abc6fba0eb454b68e571c7e14038dc823fe7f2263843e6e627b7444eaf0fe9374 binutils-2.41.tar.xz
Signature · 6 lines
2.39.2 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 5 lines · On Tue, 1 Aug 2023 22:21:37 +0200 Bernd Kuhls <[email protected]> wrote:
Signed-off-by Bernd Kuhls <[email protected]>--- ...xes-assembling-with-binutils-as-2.41.patch | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 package/ffmpeg/0005-Fixes-assembling-with-binutils-as-2.41.patch
Series applied, thanks a lot!
Thomas
Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot