[FFmpeg-cvslog] configure: make sure LTO does not optimize out the test functions

Andreas Cadhalpun git at videolan.org
Fri Nov 18 01:08:37 EET 2016


ffmpeg | branch: release/3.2 | Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com> | Tue Oct 25 19:09:46 2016 +0200| [e92f585bd90ede07a252113ba4bf8e79cd5852de] | committer: Andreas Cadhalpun

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

Fixes trac ticket #5909

Bud-Id: https://bugs.gentoo.org/show_bug.cgi?id=598054
Acked-by: Michael Niedermayer <michael at niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
(cherry picked from commit 890eb3d7c477b9fd2c6b1fa0785aca1d02a12e29)
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e92f585bd90ede07a252113ba4bf8e79cd5852de
---

 configure | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 7476ca8..72ffaea 100755
--- a/configure
+++ b/configure
@@ -1146,10 +1146,16 @@ check_func_headers(){
         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) { 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
 }
 



More information about the ffmpeg-cvslog mailing list