Fix FDE labels for Darwin
authorIain Sandoe <iain@sandoe.co.uk>
Wed, 22 Aug 2018 11:37:02 +0000 (11:37 +0000)
committerIain Sandoe <iains@gcc.gnu.org>
Wed, 22 Aug 2018 11:37:02 +0000 (11:37 +0000)
gcc/

PR bootstrap/81033
PR target/81733
PR target/52795
* gcc/dwarf2out.c (FUNC_SECOND_SECT_LABEL): New.
(dwarf2out_switch_text_section): Generate a local label for the second
function sub-section and apply it as the second FDE start label.
* gcc/final.c (final_scan_insn_1): Emit second FDE label after the second
sub-section start.

From-SVN: r263763

gcc/ChangeLog
gcc/dwarf2out.c
gcc/final.c

index 7dfdd45dd97f14e32f684a933416d34cd8eed0c1..a0e321d874d6c49814f43d62f3995fba2eb55153 100644 (file)
@@ -1,3 +1,14 @@
+2018-08-22  Iain Sandoe  <iain@sandoe.co.uk>
+
+       PR bootstrap/81033
+       PR target/81733
+       PR target/52795
+       * gcc/dwarf2out.c (FUNC_SECOND_SECT_LABEL): New.
+       (dwarf2out_switch_text_section): Generate a local label for the second
+       function sub-section and apply it as the second FDE start label.
+       * gcc/final.c (final_scan_insn_1): Emit second FDE label after the second
+       sub-section start.
+
 2018-08-22  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/86988
index edf1ac358963177506a9aa10383f03f48359afb4..91af4e8fc4e0fffd28346c08ed80b2d26c3ee217 100644 (file)
@@ -298,6 +298,10 @@ static unsigned int rnglist_idx;
 #define FUNC_BEGIN_LABEL       "LFB"
 #endif
 
+#ifndef FUNC_SECOND_SECT_LABEL
+#define FUNC_SECOND_SECT_LABEL "LFSB"
+#endif
+
 #ifndef FUNC_END_LABEL
 #define FUNC_END_LABEL         "LFE"
 #endif
@@ -1213,21 +1217,24 @@ static void set_cur_line_info_table (section *);
 void
 dwarf2out_switch_text_section (void)
 {
+  char label[MAX_ARTIFICIAL_LABEL_BYTES];
   section *sect;
   dw_fde_ref fde = cfun->fde;
 
   gcc_assert (cfun && fde && fde->dw_fde_second_begin == NULL);
 
+  ASM_GENERATE_INTERNAL_LABEL (label, FUNC_SECOND_SECT_LABEL,
+                              current_function_funcdef_no);
+
+  fde->dw_fde_second_begin = ggc_strdup (label);
   if (!in_cold_section_p)
     {
       fde->dw_fde_end = crtl->subsections.cold_section_end_label;
-      fde->dw_fde_second_begin = crtl->subsections.hot_section_label;
       fde->dw_fde_second_end = crtl->subsections.hot_section_end_label;
     }
   else
     {
       fde->dw_fde_end = crtl->subsections.hot_section_end_label;
-      fde->dw_fde_second_begin = crtl->subsections.cold_section_label;
       fde->dw_fde_second_end = crtl->subsections.cold_section_end_label;
     }
   have_multiple_function_sections = true;
index 842e5e067db7419076c07a603283e42231a44353..6943c073d9bd3ef3e751506883df6fa4281d7e3d 100644 (file)
@@ -2232,6 +2232,9 @@ final_scan_insn_1 (rtx_insn *insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED,
              ASM_OUTPUT_LABEL (asm_out_file,
                                IDENTIFIER_POINTER (cold_function_name));
 #endif
+             if (dwarf2out_do_frame ()
+                 && cfun->fde->dw_fde_second_begin != NULL)
+               ASM_OUTPUT_LABEL (asm_out_file, cfun->fde->dw_fde_second_begin);
            }
          break;