Skip to content
Snippets Groups Projects
Commit 890eb3d7 authored by Andreas Cadhalpun's avatar Andreas Cadhalpun
Browse files

configure: make sure LTO does not optimize out the test functions

parent 97792e85
No related branches found
No related tags found
No related merge requests found
...@@ -1146,10 +1146,16 @@ check_func_headers(){ ...@@ -1146,10 +1146,16 @@ check_func_headers(){
for hdr in $headers; do for hdr in $headers; do
print_include $hdr print_include $hdr
done done
echo "#include <stdint.h>"
for func in $funcs; do for func in $funcs; do
echo "long check_$func(void) { return (long) $func; }" echo "long check_$func(void) { return (long) $func; }"
done done
echo "int main(void) { return 0; }" 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; }"
} | check_ld "cc" "$@" && enable $funcs && enable_safe $headers } | check_ld "cc" "$@" && enable $funcs && enable_safe $headers
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment