aboutsummaryrefslogtreecommitdiff
path: root/gcc/dwarf2out.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r--gcc/dwarf2out.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 76fd7f07f9e..9342236966d 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -628,13 +628,19 @@ add_fde_cfi (const char *label, dw_cfi_ref cfi)
{
dw_cfi_ref xcfi;
- fde->dw_fde_current_label = label = xstrdup (label);
+ label = xstrdup (label);
/* Set the location counter to the new label. */
xcfi = new_cfi ();
- xcfi->dw_cfi_opc = DW_CFA_advance_loc4;
+ /* If we have a current label, advance from there, otherwise
+ set the location directly using set_loc. */
+ xcfi->dw_cfi_opc = fde->dw_fde_current_label
+ ? DW_CFA_advance_loc4
+ : DW_CFA_set_loc;
xcfi->dw_cfi_oprnd1.dw_cfi_addr = label;
add_cfi (&fde->dw_fde_cfi, xcfi);
+
+ fde->dw_fde_current_label = label;
}
add_cfi (&fde->dw_fde_cfi, cfi);
@@ -2069,6 +2075,7 @@ output_cfi (dw_cfi_ref cfi, dw_fde_ref fde, int for_eh)
else
dw2_asm_output_addr (DWARF2_ADDR_SIZE,
cfi->dw_cfi_oprnd1.dw_cfi_addr, NULL);
+ fde->dw_fde_current_label = cfi->dw_cfi_oprnd1.dw_cfi_addr;
break;
case DW_CFA_advance_loc1:
@@ -6919,6 +6926,10 @@ dwarf2out_switch_text_section (void)
fde->dw_fde_unlikely_section_label = cfun->cold_section_label;
fde->dw_fde_unlikely_section_end_label = cfun->cold_section_end_label;
have_multiple_function_sections = true;
+
+ /* Reset the current label on switching text sections, so that we
+ don't attempt to advance_loc4 between labels in different sections. */
+ fde->dw_fde_current_label = NULL;
}
/* Output the location list given to us. */