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

Git pushed a commit to branch master
in repository ffmpeg.

commit 77b9dc4159b9f4247ec29e4cd6e1c0dcc7c5caed
Author:     Kacper Michajłow <[email protected]>
AuthorDate: Sat Apr 4 12:49:41 2026 +0200
Commit:     Kacper Michajłow <[email protected]>
CommitDate: Mon Sep 14 21:09:36 2026 +0000

    configure: check sanitizer flags before adding them
    
    Configure now will die and report correct error message if
    unsupported sanitizer is requested. Instead of adding flags
    unconditionally.
    
    The linker flags are added only if supported. Some compilers like MSVC,
    does not need/want them. The same goes for -fno-omit-frame-pointer which
    is added only when supported now.
    
    Probing needs the temporary files and the probed tools, neither of which
    exists where the toolchain is selected, hence the requested sanitizers
    are gathered and actual probe is defered to after toolchain is
    established.
    
    Signed-off-by: Kacper Michajłow <[email protected]>
---
 configure | 43 +++++++++++++++++++++++++++----------------
 1 file changed, 27 insertions(+), 16 deletions(-)

diff --git a/configure b/configure
index beb5e1460f..ffc1bb68cc 100755
--- a/configure
+++ b/configure
@@ -4868,36 +4868,45 @@ set >> $logfile
 test -n "$valgrind" && toolchain="valgrind-memcheck"
 
 add_sanitizer_flags(){
+    sanitizer_cflags=
+    sanitizer_ldflags=
+
     case "$1" in
         asan)
-            add_allcflags -fsanitize=address
-            add_ldflags -fsanitize=address
+            sanitizer_cflags="-fsanitize=address"
+            sanitizer_ldflags="-fsanitize=address"
         ;;
         fuzz)
-            add_allcflags -fsanitize=fuzzer-no-link
-            add_ldflags -fsanitize=fuzzer-no-link
+            sanitizer_cflags="-fsanitize=fuzzer-no-link"
+            sanitizer_ldflags="-fsanitize=fuzzer-no-link"
             : "${libfuzzer_path:=-fsanitize=fuzzer}"
         ;;
         lsan)
-            add_allcflags -fsanitize=leak
-            add_ldflags -fsanitize=leak
+            sanitizer_cflags="-fsanitize=leak"
+            sanitizer_ldflags="-fsanitize=leak"
         ;;
         msan)
-            add_allcflags -fsanitize=memory -fsanitize-memory-track-origins
-            add_ldflags -fsanitize=memory
+            sanitizer_cflags="-fsanitize=memory 
-fsanitize-memory-track-origins"
+            sanitizer_ldflags="-fsanitize=memory"
         ;;
         tsan)
-            add_allcflags -fsanitize=thread
-            add_ldflags -fsanitize=thread
+            sanitizer_cflags="-fsanitize=thread"
+            sanitizer_ldflags="-fsanitize=thread"
         ;;
         usan|ubsan)
-            add_allcflags -fsanitize=undefined
-            add_ldflags -fsanitize=undefined
+            sanitizer_cflags="-fsanitize=undefined"
+            sanitizer_ldflags="-fsanitize=undefined"
         ;;
         ?*)
             die "Unknown sanitizer $1"
         ;;
     esac
+
+    test_cflags $sanitizer_cflags ||
+        die "Sanitizer $1 is not supported by $cc"
+
+    add_allcflags $sanitizer_cflags
+    check_ldflags $sanitizer_ldflags
 }
 
 add_sanitizers(){
@@ -4907,12 +4916,12 @@ add_sanitizers(){
     for sanitizer; do
         add_sanitizer_flags "$sanitizer"
     done
-    add_allcflags -fno-omit-frame-pointer
+    check_allcflags -fno-omit-frame-pointer
 }
 
 case "$toolchain" in
     clang-*)
-        add_sanitizers "${toolchain#clang-}"
+        requested_sanitizers="${toolchain#clang-}"
         cc_default="clang"
         cxx_default="clang++"
     ;;
@@ -4924,10 +4933,10 @@ case "$toolchain" in
         ranlib_default="llvm-ranlib"
         strip_default="llvm-strip"
         windres_default="llvm-windres"
-        test "$toolchain" != "llvm" && add_sanitizers "${toolchain#llvm-}"
+        test "$toolchain" != "llvm" && 
requested_sanitizers="${toolchain#llvm-}"
     ;;
     gcc-*)
-        add_sanitizers "${toolchain#gcc-}"
+        requested_sanitizers="${toolchain#gcc-}"
         cc_default="gcc"
         cxx_default="g++"
         # In case of tsan with gcc, PIC has to be enabled
@@ -5487,6 +5496,8 @@ test_cpp_condition windows.h "_MSC_FULL_VER >= 193030705" 
&&
 test_host_cpp_condition windows.h "_MSC_FULL_VER >= 193030705" &&
     check_host_cflags -options:strict
 
+test -n "$requested_sanitizers" && add_sanitizers "$requested_sanitizers"
+
 add_cflags $extra_cflags
 add_cxxflags $extra_cxxflags
 add_objcflags $extra_objcflags

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to