This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

The following commit(s) were added to refs/heads/master by this push:
     new e999ea73bc configure: keep -march=native for --cpu=host
e999ea73bc is described below

commit e999ea73bcb09eaec2f894039df26519bb9c5ab9
Author:     Kacper Michajłow <[email protected]>
AuthorDate: Fri Jun 5 11:35:19 2026 +0200
Commit:     Kacper Michajłow <[email protected]>
CommitDate: Mon Jun 22 21:02:17 2026 +0000

    configure: keep -march=native for --cpu=host
    
    --cpu=host resolved =native to the concrete CPU name and passed that to
    the compiler. The name is a strict superset of the actual machine: it
    discards the per-feature adjustments the compiler makes for =native
    (e.g. AVX-512 left disabled by the OS or a VM), so the build could emit
    instructions that fault at runtime.
    
    Keep the resolved name for per-arch feature gating, but feed
    -march/-mcpu=native for the codegen so that information is preserved.
    
    Signed-off-by: Kacper Michajłow <[email protected]>
---
 configure | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 7160664603..9eb9d75326 100755
--- a/configure
+++ b/configure
@@ -5627,7 +5627,11 @@ if test "$cpu" = host; then
                             q
                         }" $TMPE
             }
-            cpu=$(check_native -march || check_native -mcpu)
+            if cpu=$(check_native -march); then
+                native_cpuflags="-march=native"
+            elif cpu=$(check_native -mcpu); then
+                native_cpuflags="-mcpu=native"
+            fi
         ;;
         clang)
             check_native(){
@@ -5639,7 +5643,7 @@ if test "$cpu" = host; then
                             q
                         }" $TMPE
             }
-            cpu=$(check_native -march)
+            cpu=$(check_native -march) && native_cpuflags="-march=native"
         ;;
     esac
 
@@ -6011,6 +6015,9 @@ else
 fi
 
 if [ "$cpu" != generic ]; then
+    # For --cpu=host, use the compiler's =native for codegen. $cpu is
+    # only the resolved name used for feature gating above.
+    test -n "$native_cpuflags" && cpuflags=$native_cpuflags
     add_allcflags $cpuflags
     add_asflags $cpuflags
     test "$cc_type" = "$ld_type" && add_ldflags $cpuflags

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

Reply via email to