Commit 8962c8c8d06803e310bac0ffc8e84ea15daeff3f

Anthony Green 2013-01-08T12:22:24

Fix read-only eh_frame test

diff --git a/ChangeLog b/ChangeLog
index 464dbe8..88e3659 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2013-01-08  Anthony Green  <green@moxielogic.com>
 
+	* configure.ac: Fix test for read-only eh_frame.
+	* configure: Rebuilt.
+
+2013-01-08  Anthony Green  <green@moxielogic.com>
+
 	* src/x86/sysv.S, src/x86/unix64.S: Only emit DWARF unwind info
 	when building with the GNU toolchain.
 	* testsuite/libffi.call/ffitest.h (CHECK): Fix for Solaris vendor
diff --git a/configure b/configure
index c4d1e8d..142bb86 100755
--- a/configure
+++ b/configure
@@ -14635,11 +14635,12 @@ else
 
   	libffi_cv_ro_eh_frame=no
   	echo 'extern void foo (void); void bar (void) { foo (); foo (); }' > conftest.c
-  	if $CC $CFLAGS -S -fpic -fexceptions -o conftest.s conftest.c > /dev/null 2>&1; then
-  	    if grep '.section.*eh_frame.*"a"' conftest.s > /dev/null; then
-  		libffi_cv_ro_eh_frame=yes
-  	    elif grep '.section.*eh_frame.*#alloc' conftest.c \
-  		 | grep -v '#write' > /dev/null; then
+  	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`
+	    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
   	fi
diff --git a/configure.ac b/configure.ac
index 78f54af..b62dd6f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -402,11 +402,12 @@ if test "x$GCC" = "xyes"; then
       libffi_cv_ro_eh_frame, [
   	libffi_cv_ro_eh_frame=no
   	echo 'extern void foo (void); void bar (void) { foo (); foo (); }' > conftest.c
-  	if $CC $CFLAGS -S -fpic -fexceptions -o conftest.s conftest.c > /dev/null 2>&1; then
-  	    if grep '.section.*eh_frame.*"a"' conftest.s > /dev/null; then
-  		libffi_cv_ro_eh_frame=yes
-  	    elif grep '.section.*eh_frame.*#alloc' conftest.c \
-  		 | grep -v '#write' > /dev/null; then
+  	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`
+	    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
   	fi