diff mbox

[cygming] Adjust some .cfi directives configury

Message ID 4C803C7B.1030904@redhat.com
State New
Headers show

Commit Message

Richard Henderson Sept. 3, 2010, 12:08 a.m. UTC
With the following two changes, GCC can use the .cfi directives on
PE coff targets too.  With all of the good-ness that enables.

Tested on x86_64-linux and x86_64-w64-mingw32 (with binutils before
and after the .debug_frame fix being detected).  Committed.


r~
* configure.ac (gcc_cv_as_cfi_advance_working): Use objdump
	instead of readelf in the test.
	(gcc_cv_as_cfi_sections_directive): Check for correct relocation
	in the .debug_frame section for coff targets.
diff mbox

Patch

diff --git a/gcc/configure.ac b/gcc/configure.ac
index 1fcb87a..3308667 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -2405,7 +2405,7 @@  gcc_GAS_CHECK_FEATURE([cfi directives], gcc_cv_as_cfi_directive,
     gcc_cv_as_cfi_directive=yes
     ;;
 esac])
-if test $gcc_cv_as_cfi_directive = yes && test x$gcc_cv_readelf != x; then
+if test $gcc_cv_as_cfi_directive = yes && test x$gcc_cv_objdump != x; then
 gcc_GAS_CHECK_FEATURE([working cfi advance], gcc_cv_as_cfi_advance_working,
   ,,
 [	.text
@@ -2415,13 +2415,13 @@  gcc_GAS_CHECK_FEATURE([working cfi advance], gcc_cv_as_cfi_advance_working,
 	.cfi_adjust_cfa_offset 128
 	.cfi_endproc],
 [[
-if $gcc_cv_readelf -wf conftest.o 2>/dev/null \
+if $gcc_cv_objdump -Wf conftest.o 2>/dev/null \
     | grep 'DW_CFA_advance_loc[24]:[ 	][ 	]*75040[ 	]' >/dev/null; then
    gcc_cv_as_cfi_advance_working=yes
 fi
 ]])
 else
-  # no readelf, err on the side of caution
+  # no objdump, err on the side of caution
   gcc_cv_as_cfi_advance_working=no
 fi
 AC_DEFINE_UNQUOTED(HAVE_GAS_CFI_DIRECTIVE,
@@ -2445,7 +2445,23 @@  gcc_GAS_CHECK_FEATURE([cfi sections directive],
 [	.text
 	.cfi_sections .debug_frame, .eh_frame
 	.cfi_startproc
-	.cfi_endproc])
+	.cfi_endproc],
+[case $target_os in
+  win32 | pe | cygwin* | mingw32* | uwin*)
+    # Need to check that we generated the correct relocation for the
+    # .debug_frame section.  This was fixed for binutils 2.21.
+    gcc_cv_as_cfi_sections_directive=no
+    if test "x$gcc_cv_objdump" != x; then
+     if $gcc_cv_objdump -j .debug_frame -r conftest.o 2>/dev/null | \
+	grep secrel > /dev/null; then
+      gcc_cv_as_cfi_sections_directive=yes
+     fi
+    fi
+    ;;
+  *)
+    gcc_cv_as_cfi_sections_directive=yes
+    ;;
+esac])
 AC_DEFINE_UNQUOTED(HAVE_GAS_CFI_SECTIONS_DIRECTIVE,
   [`if test $gcc_cv_as_cfi_sections_directive = yes;
     then echo 1; else echo 0; fi`],