aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2009-10-02 20:52:15 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2009-10-02 20:52:15 +0200
commit7d45fb9420c0d23774e3e34730cd6d847d78a90a (patch)
treeb601d10cfde53e6771be0e872d53e7560bd0ad31
parentce1cfdbd5170c67adb822ea2d9ea69f53ffa2099 (diff)
downloadgcc-7d45fb9420c0d23774e3e34730cd6d847d78a90a.zip
gcc-7d45fb9420c0d23774e3e34730cd6d847d78a90a.tar.gz
gcc-7d45fb9420c0d23774e3e34730cd6d847d78a90a.tar.bz2
re PR debug/40521 (-g causes GCC to generate .eh_frame)
PR debug/40521 * configure.ac (HAVE_GAS_CFI_SECTIONS_DIRECTIVE): New test. * configure: Regenerated. * config.in: Regenerated. * dwarf2out.c (dwarf2out_do_cfi_asm): Return false if !HAVE_GAS_CFI_SECTIONS_DIRECTIVE and not emitting .eh_frame. (dwarf2out_init): If HAVE_GAS_CFI_SECTIONS_DIRECTIVE and not emitting .eh_frame, emit .cfi_sections .debug_frame directive. From-SVN: r152414
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/config.in6
-rwxr-xr-xgcc/configure36
-rw-r--r--gcc/configure.ac11
-rw-r--r--gcc/dwarf2out.c20
5 files changed, 83 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 00a6055..f16eff0 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,15 @@
2009-10-02 Jakub Jelinek <jakub@redhat.com>
+ PR debug/40521
+ * configure.ac (HAVE_GAS_CFI_SECTIONS_DIRECTIVE): New test.
+ * configure: Regenerated.
+ * config.in: Regenerated.
+ * dwarf2out.c (dwarf2out_do_cfi_asm): Return false if
+ !HAVE_GAS_CFI_SECTIONS_DIRECTIVE and not emitting .eh_frame.
+ (dwarf2out_init): If HAVE_GAS_CFI_SECTIONS_DIRECTIVE and
+ not emitting .eh_frame, emit .cfi_sections .debug_frame
+ directive.
+
PR debug/41404
PR debug/41353
* cfgexpand.c (expand_debug_expr) <case STRING_CST>: Don't create
diff --git a/gcc/config.in b/gcc/config.in
index 9ee0bde..12573fd 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -887,6 +887,12 @@
#endif
+/* Define 0/1 if your assembler supports .cfi_sections. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_GAS_CFI_SECTIONS_DIRECTIVE
+#endif
+
+
/* Define if your assembler supports the .loc discriminator sub-directive. */
#ifndef USED_FOR_TARGET
#undef HAVE_GAS_DISCRIMINATOR
diff --git a/gcc/configure b/gcc/configure
index dbd10a5..a1e28a7 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -21542,6 +21542,42 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for cfi sections directive" >&5
+$as_echo_n "checking assembler for cfi sections directive... " >&6; }
+if test "${gcc_cv_as_cfi_sections_directive+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ gcc_cv_as_cfi_sections_directive=no
+ if test x$gcc_cv_as != x; then
+ echo ' .text
+ .cfi_sections .debug_frame, .eh_frame
+ .cfi_startproc
+ .cfi_endproc' > conftest.s
+ if { ac_try='$gcc_cv_as -o conftest.o conftest.s >&5'
+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }
+ then
+ gcc_cv_as_cfi_sections_directive=yes
+ else
+ echo "configure: failed program was" >&5
+ cat conftest.s >&5
+ fi
+ rm -f conftest.o conftest.s
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_cfi_sections_directive" >&5
+$as_echo "$gcc_cv_as_cfi_sections_directive" >&6; }
+
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_GAS_CFI_SECTIONS_DIRECTIVE `if test $gcc_cv_as_cfi_sections_directive = yes;
+ then echo 1; else echo 0; fi`
+_ACEOF
+
+
# GAS versions up to and including 2.11.0 may mis-optimize
# .eh_frame data.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for eh_frame optimization" >&5
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 96b3b5d..d7597d2 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -2301,6 +2301,17 @@ AC_DEFINE_UNQUOTED(HAVE_GAS_CFI_PERSONALITY_DIRECTIVE,
then echo 1; else echo 0; fi`],
[Define 0/1 if your assembler supports .cfi_personality.])
+gcc_GAS_CHECK_FEATURE([cfi sections directive],
+ gcc_cv_as_cfi_sections_directive, ,,
+[ .text
+ .cfi_sections .debug_frame, .eh_frame
+ .cfi_startproc
+ .cfi_endproc])
+AC_DEFINE_UNQUOTED(HAVE_GAS_CFI_SECTIONS_DIRECTIVE,
+ [`if test $gcc_cv_as_cfi_sections_directive = yes;
+ then echo 1; else echo 0; fi`],
+ [Define 0/1 if your assembler supports .cfi_sections.])
+
# GAS versions up to and including 2.11.0 may mis-optimize
# .eh_frame data.
gcc_GAS_CHECK_FEATURE(eh_frame optimization, gcc_cv_as_eh_frame,
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 3a0e4f3..2728cfd 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -179,6 +179,16 @@ dwarf2out_do_cfi_asm (void)
if ((enc & 0x70) != 0 && (enc & 0x70) != DW_EH_PE_pcrel)
return false;
+ if (!HAVE_GAS_CFI_SECTIONS_DIRECTIVE)
+ {
+#ifdef TARGET_UNWIND_INFO
+ return false;
+#else
+ if (USING_SJLJ_EXCEPTIONS || (!flag_unwind_tables && !flag_exceptions))
+ return false;
+#endif
+ }
+
saved_do_cfi_asm = true;
return true;
}
@@ -18628,6 +18638,16 @@ dwarf2out_init (const char *filename ATTRIBUTE_UNUSED)
switch_to_section (cold_text_section);
ASM_OUTPUT_LABEL (asm_out_file, cold_text_section_label);
}
+
+#ifdef HAVE_GAS_CFI_SECTIONS_DIRECTIVE
+ if (dwarf2out_do_cfi_asm ())
+ {
+#ifndef TARGET_UNWIND_INFO
+ if (USING_SJLJ_EXCEPTIONS || (!flag_unwind_tables && !flag_exceptions))
+#endif
+ fprintf (asm_out_file, "\t.cfi_sections\t.debug_frame\n");
+ }
+#endif
}
/* A helper function for dwarf2out_finish called through