gcc/gcc44-pr40521.patch

140 lines
4.4 KiB
Diff

2009-10-13 Mikael Pettersson <mikpe@it.uu.se>
Backport from mainline:
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.
2009-10-09 Jakub Jelinek <jakub@redhat.com>
PR debug/40521
* dwarf2out.c (dwarf2out_init): Test whether
HAVE_GAS_CFI_SECTIONS_DIRECTIVE is non-zero instead of checking
it is defined.
--- gcc/configure.ac 2009-03-24 18:46:03.000000000 +0100
+++ gcc/configure.ac 2009-10-13 12:00:31.000000000 +0200
@@ -2297,6 +2297,17 @@ AC_DEFINE_UNQUOTED(HAVE_GAS_CFI_PERSONAL
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,
--- gcc/config.in 2009-07-22 09:43:59.000000000 +0200
+++ gcc/config.in 2009-10-13 12:00:31.000000000 +0200
@@ -839,6 +839,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 uses the new HImode fild and fist notation. */
#ifndef USED_FOR_TARGET
#undef HAVE_GAS_FILDS_FISTS
--- gcc/configure 2009-03-24 18:46:03.000000000 +0100
+++ gcc/configure 2009-10-13 12:00:31.000000000 +0200
@@ -21680,6 +21680,42 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
+echo "$as_me:$LINENO: checking assembler for cfi sections directive" >&5
+echo $ECHO_N "checking assembler for cfi sections directive... $ECHO_C" >&6
+if test "${gcc_cv_as_cfi_sections_directive+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }
+ 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
+echo "$as_me:$LINENO: result: $gcc_cv_as_cfi_sections_directive" >&5
+echo "${ECHO_T}$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.
echo "$as_me:$LINENO: checking assembler for eh_frame optimization" >&5
--- gcc/dwarf2out.c 2009-06-03 19:32:45.000000000 +0200
+++ gcc/dwarf2out.c 2009-10-13 12:00:39.000000000 +0200
@@ -145,7 +145,18 @@ dwarf2out_do_cfi_asm (void)
#endif
if (!flag_dwarf2_cfi_asm || !dwarf2out_do_frame ())
return false;
- if (saved_do_cfi_asm || !eh_personality_libfunc)
+ if (saved_do_cfi_asm)
+ return true;
+ 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
+ }
+ if (!eh_personality_libfunc)
return true;
if (!HAVE_GAS_CFI_PERSONALITY_DIRECTIVE)
return false;
@@ -16133,6 +16144,14 @@ dwarf2out_init (const char *filename ATT
switch_to_section (cold_text_section);
ASM_OUTPUT_LABEL (asm_out_file, cold_text_section_label);
}
+
+ if (HAVE_GAS_CFI_SECTIONS_DIRECTIVE && 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");
+ }
}
/* A helper function for dwarf2out_finish called through