Fix read-only .eh_frame section test when CFLAGS contains -flto. (#590)
authorjacobly0 <jacobly0@users.noreply.github.com>
Tue, 27 Oct 2020 14:00:03 +0000 (10:00 -0400)
committerGitHub <noreply@github.com>
Tue, 27 Oct 2020 14:00:03 +0000 (10:00 -0400)
configure.ac

index 3ca1f4fbba9264572442dd3dc339b56c759246b9..790274ea91f87848c4271ece840ebc17f05fd98f 100644 (file)
@@ -260,11 +260,13 @@ EOF
 fi
 
 if test "x$GCC" = "xyes"; then
+  AX_CHECK_COMPILE_FLAG(-fno-lto, libffi_cv_no_lto=-fno-lto)
+
   AC_CACHE_CHECK([whether .eh_frame section should be read-only],
       libffi_cv_ro_eh_frame, [
        libffi_cv_ro_eh_frame=yes
        echo 'extern void foo (void); void bar (void) { foo (); foo (); }' > conftest.c
-       if $CC $CFLAGS -c -fpic -fexceptions -o conftest.o conftest.c > /dev/null 2>&1; then
+       if $CC $CFLAGS -c -fpic -fexceptions $libffi_cv_no_lto -o conftest.o conftest.c > /dev/null 2>&1; then
            if readelf -WS conftest.o | grep -q -n 'eh_frame .* WA'; then
                libffi_cv_ro_eh_frame=no
            fi