summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2020-03-10 04:36:09 -0700
committerGitHub <noreply@github.com>2020-03-10 07:36:09 -0400
commit8c50837f0b58ba5b2bcb1b424a2a4bfa01559fb2 (patch)
treef395da55c9426a2a44c92464b90e267a5c3645cf /configure.ac
parent4a6414f2785a60f455c91fdd04f7745fe7fc11e0 (diff)
downloadlibffi-8c50837f0b58ba5b2bcb1b424a2a4bfa01559fb2.tar.gz
Improve read-write .eh_frame check (#546)
llvm-objdump -h does not print BFD SEC_* constants like "READONLY", so the check will consider .eh_frame writable. clang 11 (since https://reviews.llvm.org/D73999) will error for mismatching section flags. Use readelf -S and check "WA" instead.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac12
1 files changed, 3 insertions, 9 deletions
diff --git a/configure.ac b/configure.ac
index bf96297..3ca1f4f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -262,17 +262,11 @@ fi
if test "x$GCC" = "xyes"; then
AC_CACHE_CHECK([whether .eh_frame section should be read-only],
libffi_cv_ro_eh_frame, [
- libffi_cv_ro_eh_frame=no
+ 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
- objdump -h conftest.o > conftest.dump 2>&1
- libffi_eh_frame_line=`grep -n eh_frame conftest.dump | cut -d: -f 1`
- if test "x$libffi_eh_frame_line" != "x"; then
- libffi_test_line=`expr $libffi_eh_frame_line + 1`p
- sed -n $libffi_test_line conftest.dump > conftest.line
- if grep READONLY conftest.line > /dev/null; then
- libffi_cv_ro_eh_frame=yes
- fi
+ if readelf -WS conftest.o | grep -q -n 'eh_frame .* WA'; then
+ libffi_cv_ro_eh_frame=no
fi
fi
rm -f conftest.*