diff options
| author | Khem Raj <raj.khem@gmail.com> | 2023-07-31 12:52:59 -0700 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-08-01 09:51:21 +0100 |
| commit | 61bcec8a28c710bab8917267d72b504bb3395188 (patch) | |
| tree | 427104cdf351931d3714355f482aec6e719d37ac | |
| parent | d505ab5ea561bf5c501e7417a17d72bacfe3dadf (diff) | |
| download | poky-61bcec8a28c710bab8917267d72b504bb3395188.tar.gz | |
ffmpeg: Fix wrong code found with gas/2.41
(From OE-Core rev: 692e414aed5313ff275b69e93179aa7c559700f3)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/recipes-multimedia/ffmpeg/ffmpeg/0001-avcodec-x86-mathops-clip-constants-used-with-shift-i.patch | 77 | ||||
| -rw-r--r-- | meta/recipes-multimedia/ffmpeg/ffmpeg_6.0.bb | 1 |
2 files changed, 78 insertions, 0 deletions
diff --git a/meta/recipes-multimedia/ffmpeg/ffmpeg/0001-avcodec-x86-mathops-clip-constants-used-with-shift-i.patch b/meta/recipes-multimedia/ffmpeg/ffmpeg/0001-avcodec-x86-mathops-clip-constants-used-with-shift-i.patch new file mode 100644 index 0000000000..a47a20365f --- /dev/null +++ b/meta/recipes-multimedia/ffmpeg/ffmpeg/0001-avcodec-x86-mathops-clip-constants-used-with-shift-i.patch | |||
| @@ -0,0 +1,77 @@ | |||
| 1 | From effadce6c756247ea8bae32dc13bb3e6f464f0eb Mon Sep 17 00:00:00 2001 | ||
| 2 | From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= <remi@remlab.net> | ||
| 3 | Date: Sun, 16 Jul 2023 18:18:02 +0300 | ||
| 4 | Subject: [PATCH] avcodec/x86/mathops: clip constants used with shift | ||
| 5 | instructions within inline assembly | ||
| 6 | |||
| 7 | Fixes assembling with binutil as >= 2.41 | ||
| 8 | |||
| 9 | Upstream-Status: Backport [https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/effadce6c756247ea8bae32dc13bb3e6f464f0eb] | ||
| 10 | Signed-off-by: James Almer <jamrial@gmail.com> | ||
| 11 | --- | ||
| 12 | libavcodec/x86/mathops.h | 26 +++++++++++++++++++++++--- | ||
| 13 | 1 file changed, 23 insertions(+), 3 deletions(-) | ||
| 14 | |||
| 15 | diff --git a/libavcodec/x86/mathops.h b/libavcodec/x86/mathops.h | ||
| 16 | index 6298f5ed19..ca7e2dffc1 100644 | ||
| 17 | --- a/libavcodec/x86/mathops.h | ||
| 18 | +++ b/libavcodec/x86/mathops.h | ||
| 19 | @@ -35,12 +35,20 @@ | ||
| 20 | static av_always_inline av_const int MULL(int a, int b, unsigned shift) | ||
| 21 | { | ||
| 22 | int rt, dummy; | ||
| 23 | + if (__builtin_constant_p(shift)) | ||
| 24 | __asm__ ( | ||
| 25 | "imull %3 \n\t" | ||
| 26 | "shrdl %4, %%edx, %%eax \n\t" | ||
| 27 | :"=a"(rt), "=d"(dummy) | ||
| 28 | - :"a"(a), "rm"(b), "ci"((uint8_t)shift) | ||
| 29 | + :"a"(a), "rm"(b), "i"(shift & 0x1F) | ||
| 30 | ); | ||
| 31 | + else | ||
| 32 | + __asm__ ( | ||
| 33 | + "imull %3 \n\t" | ||
| 34 | + "shrdl %4, %%edx, %%eax \n\t" | ||
| 35 | + :"=a"(rt), "=d"(dummy) | ||
| 36 | + :"a"(a), "rm"(b), "c"((uint8_t)shift) | ||
| 37 | + ); | ||
| 38 | return rt; | ||
| 39 | } | ||
| 40 | |||
| 41 | @@ -113,19 +121,31 @@ __asm__ volatile(\ | ||
| 42 | // avoid +32 for shift optimization (gcc should do that ...) | ||
| 43 | #define NEG_SSR32 NEG_SSR32 | ||
| 44 | static inline int32_t NEG_SSR32( int32_t a, int8_t s){ | ||
| 45 | + if (__builtin_constant_p(s)) | ||
| 46 | __asm__ ("sarl %1, %0\n\t" | ||
| 47 | : "+r" (a) | ||
| 48 | - : "ic" ((uint8_t)(-s)) | ||
| 49 | + : "i" (-s & 0x1F) | ||
| 50 | ); | ||
| 51 | + else | ||
| 52 | + __asm__ ("sarl %1, %0\n\t" | ||
| 53 | + : "+r" (a) | ||
| 54 | + : "c" ((uint8_t)(-s)) | ||
| 55 | + ); | ||
| 56 | return a; | ||
| 57 | } | ||
| 58 | |||
| 59 | #define NEG_USR32 NEG_USR32 | ||
| 60 | static inline uint32_t NEG_USR32(uint32_t a, int8_t s){ | ||
| 61 | + if (__builtin_constant_p(s)) | ||
| 62 | __asm__ ("shrl %1, %0\n\t" | ||
| 63 | : "+r" (a) | ||
| 64 | - : "ic" ((uint8_t)(-s)) | ||
| 65 | + : "i" (-s & 0x1F) | ||
| 66 | ); | ||
| 67 | + else | ||
| 68 | + __asm__ ("shrl %1, %0\n\t" | ||
| 69 | + : "+r" (a) | ||
| 70 | + : "c" ((uint8_t)(-s)) | ||
| 71 | + ); | ||
| 72 | return a; | ||
| 73 | } | ||
| 74 | |||
| 75 | -- | ||
| 76 | 2.41.0 | ||
| 77 | |||
diff --git a/meta/recipes-multimedia/ffmpeg/ffmpeg_6.0.bb b/meta/recipes-multimedia/ffmpeg/ffmpeg_6.0.bb index 1d80fd9294..07c641dc96 100644 --- a/meta/recipes-multimedia/ffmpeg/ffmpeg_6.0.bb +++ b/meta/recipes-multimedia/ffmpeg/ffmpeg_6.0.bb | |||
| @@ -23,6 +23,7 @@ LIC_FILES_CHKSUM = "file://COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ | |||
| 23 | file://COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02" | 23 | file://COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02" |
| 24 | 24 | ||
| 25 | SRC_URI = "https://www.ffmpeg.org/releases/${BP}.tar.xz \ | 25 | SRC_URI = "https://www.ffmpeg.org/releases/${BP}.tar.xz \ |
| 26 | file://0001-avcodec-x86-mathops-clip-constants-used-with-shift-i.patch \ | ||
| 26 | file://0001-libswscale-riscv-Fix-syntax-of-vsetvli.patch" | 27 | file://0001-libswscale-riscv-Fix-syntax-of-vsetvli.patch" |
| 27 | 28 | ||
| 28 | SRC_URI[sha256sum] = "57be87c22d9b49c112b6d24bc67d42508660e6b718b3db89c44e47e289137082" | 29 | SRC_URI[sha256sum] = "57be87c22d9b49c112b6d24bc67d42508660e6b718b3db89c44e47e289137082" |
