Commit 4288315738 for ffmpeg
commit 4288315738ce36e7ad8b1065f12631f036eb5780
Author: Kacper Michajłow <kasper93@gmail.com>
Date: Sun Oct 18 22:39:49 2026 +0200
configure: store probed symbols in a volatile intptr_t
Cast each probed symbol to intptr_t and store it in a static volatile
object instead of casting it to long in a wrapper function whose address
main() masks. The volatile stores keep the references under LTO and
intptr_t avoids the pointer truncation warnings on LLP64 targets
(-Wpointer-to-int-cast). Also deduplicate it with check_host_lib.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
diff --git a/configure b/configure
index 1221926d46..5d660590bc 100755
--- a/configure
+++ b/configure
@@ -1468,26 +1468,28 @@ int main(void){ $func(); }
EOF
}
+print_func_headers_test(){
+ headers=$1
+ funcs=$2
+ for hdr in $headers; do
+ print_include $hdr
+ done
+ echo "#include <stdint.h>"
+ echo "static volatile intptr_t ref;"
+ echo "int main(void) {"
+ for func in $funcs; do
+ echo " ref = (intptr_t) $func;"
+ done
+ echo "return 0; }"
+}
+
check_func_headers(){
log check_func_headers "$@"
headers=$1
funcs=$2
shift 2
- {
- for hdr in $headers; do
- print_include $hdr
- done
- echo "#include <stdint.h>"
- for func in $funcs; do
- echo "long check_$func(void) { return (long) $func; }"
- done
- echo "int main(void) { int ret = 0;"
- # LTO could optimize out the test functions without this
- for func in $funcs; do
- echo " ret |= ((intptr_t)check_$func) & 0xFFFF;"
- done
- echo "return ret; }"
- } | test_ld "cc" "$@" && enable $funcs && enable_sanitized $headers
+ print_func_headers_test "$headers" "$funcs" | test_ld "cc" "$@" &&
+ enable $funcs && enable_sanitized $headers
}
check_class_headers_cxx(){
@@ -1904,23 +1906,11 @@ check_host_cpp_condition(){
check_host_lib(){
log check_host_lib "$@"
- headers="$1"
- funcs="$2"
+ headers=$1
+ funcs=$2
shift 2
- {
- for hdr in $headers; do
- print_include $hdr
- done
- echo "#include <stdint.h>"
- for func in $funcs; do
- echo "long check_$func(void) { return (long) $func; }"
- done
- echo "int main(void) { int ret = 0;"
- for func in $funcs; do
- echo " ret |= ((intptr_t)check_$func) & 0xFFFF;"
- done
- echo "return ret; }"
- } | test_host_ld "$@" && append host_extralibs "$@"
+ print_func_headers_test "$headers" "$funcs" | test_host_ld "$@" &&
+ append host_extralibs "$@"
}
cp_if_changed(){