PR #24750 opened by Pepe
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24750
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24750.patch

# Summary of changes

Fixes #22698

The ppc4xx probe only checks that the assembler accepts `maclhw`, so builds for 
other PowerPC cores can get `maclhw`/`mullhw` (MAC16/MUL16 in 
`libavcodec/ppc/mathops.h`) and die with SIGILL, for example in Opus or the 
8-bit IDCT. `--disable-ppc4xx` does not help, because the probe re-enables it.

- The first commit makes the probe honour `--disable-ppc4xx`, like #24748 does 
for dcbzl.
- The second one disables ppc4xx unless `--cpu` names a 405, 440, 464 or 476 
core. Builds without `--cpu` no longer get it.

Tested with the OpenWrt GCC 14.4.0 and binutils 2.46.1 toolchains: across 63 
`--cpu` and flag combinations `HAVE_PPC4XX` is 1 only for the 4xx cores, with 
no other change in config.h or config.mak. On a P2020 (e500v2), builds with 
`HAVE_PPC4XX` 1 die with SIGILL in Opus and MPEG-2 video, and with this PR they 
decode both (these builds also had #24748). Not tested: clang and real 4xx 
hardware.

cc @sean_mcg @darkfm


>From 647c9ec875f1b6ed263ac90bc2bbc8ffa0118d72 Mon Sep 17 00:00:00 2001
From: Josef Schlehofer <[email protected]>
Date: Mon, 28 Sep 2026 10:58:43 +0200
Subject: [PATCH 1/2] configure: do not probe ppc4xx when it is disabled

The ppc4xx probe re-enables ppc4xx whenever the assembler accepts
maclhw, overriding --disable-ppc4xx. Only run the probe when ppc4xx
is not disabled.

Signed-off-by: Josef Schlehofer <[email protected]>
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 759cb8da10..7c28765b0e 100755
--- a/configure
+++ b/configure
@@ -6664,7 +6664,7 @@ elif enabled ppc; then
 
     check_inline_asm dcbzl     '"dcbzl 0, %0" :: "r"(0)'
     check_inline_asm ibm_asm   '"add 0, 0, 0"'
-    check_inline_asm ppc4xx    '"maclhw r10, r11, r12"'
+    disabled ppc4xx || check_inline_asm ppc4xx '"maclhw r10, r11, r12"'
     check_inline_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
 
     if enabled altivec; then
-- 
2.52.0


>From aa2a2f42a23383c19feb8c8732a911d3096d74ea Mon Sep 17 00:00:00 2001
From: Josef Schlehofer <[email protected]>
Date: Mon, 28 Sep 2026 10:58:44 +0200
Subject: [PATCH 2/2] configure: only enable ppc4xx for 4xx cpus

The ppc4xx probe only checks that the assembler accepts maclhw, so
builds for other PowerPC cores can get maclhw/mullhw and die with
SIGILL, e.g. in Opus or the 8-bit IDCT. Disable ppc4xx unless --cpu
names a 405, 440, 464 or 476 core. Builds without --cpu no longer
get it.

Fixes: #22698
Signed-off-by: Josef Schlehofer <[email protected]>
---
 configure | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/configure b/configure
index 7c28765b0e..99659eec21 100755
--- a/configure
+++ b/configure
@@ -5860,6 +5860,13 @@ elif enabled ppc; then
         ;;
     esac
 
+    # only use ppc4xx (maclhw, mullhw) on 405, 440, 464 and 476 cores
+    case $(tolower $cpu) in
+        405*|ppc405*|powerpc405*|440*|ppc440*|powerpc440*) ;;
+        464*|ppc464*|powerpc464*|476*|ppc476*|powerpc476*) ;;
+        *) disable ppc4xx ;;
+    esac
+
 elif enabled riscv; then
 
     check_headers asm/hwprobe.h
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to