/* Number of elements in line_info_table currently in use. */
static GTY(()) unsigned line_info_table_in_use;
+/* True if the compilation unit contains more than one .text section. */
+static GTY(()) bool have_switched_text_section = false;
+
/* A pointer to the base of a table that contains line information
for each source code line outside of .text in the compilation unit. */
static GTY ((length ("separate_line_info_table_allocated")))
fde->dw_fde_hot_section_end_label = cfun->hot_section_end_label;
fde->dw_fde_unlikely_section_label = cfun->cold_section_label;
fde->dw_fde_unlikely_section_end_label = cfun->cold_section_end_label;
- separate_line_info_table_in_use++;
+ have_switched_text_section = true;
}
/* Output the location list given to us. */
for (curr = list_head; curr != NULL; curr = curr->dw_loc_next)
{
unsigned long size;
- if (separate_line_info_table_in_use == 0)
+ if (!separate_line_info_table_in_use && !have_switched_text_section)
{
dw2_asm_output_delta (DWARF2_ADDR_SIZE, curr->begin, curr->section,
"Location list begin address (%s)",
/* If all code is in the text section, then the compilation
unit base address defaults to DW_AT_low_pc, which is the
base of the text section. */
- if (separate_line_info_table_in_use == 0)
+ if (!separate_line_info_table_in_use && !have_switched_text_section)
{
dw2_asm_output_delta (DWARF2_ADDR_SIZE, blabel,
text_section_label,
add_const_value_attribute (var_die, rtl);
}
+#ifdef DWARF2_UNWIND_INFO
/* Convert the CFI instructions for the current function into a location
list. This is used for DW_AT_frame_base when we targeting a dwarf2
consumer that does not support the dwarf3 DW_OP_call_frame_cfa. */
frame_pointer_cfa_offset = -offset;
}
+#endif
/* Generate a DW_AT_name attribute given some string value to be included as
the value of the attribute. */
add_AT_fde_ref (subr_die, DW_AT_MIPS_fde, current_funcdef_fde);
#endif
+#ifdef DWARF2_UNWIND_INFO
/* We define the "frame base" as the function's CFA. This is more
convenient for several reasons: (1) It's stable across the prologue
and epilogue, which makes it better than just a frame pointer,
debugger about. We'll need to adjust all frame_base references
by this displacement. */
compute_frame_pointer_to_cfa_displacement ();
+#else
+ /* For targets which support DWARF2, but not DWARF2 call-frame info,
+ we just use the stack pointer or frame pointer. */
+ /* ??? Should investigate getting better info via callbacks, or else
+ by interpreting the IA-64 unwind info. */
+ {
+ rtx fp_reg
+ = frame_pointer_needed ? hard_frame_pointer_rtx : stack_pointer_rtx;
+ add_AT_loc (subr_die, DW_AT_frame_base, reg_loc_descriptor (fp_reg));
+ }
+#endif
if (cfun->static_chain_decl)
add_AT_location_description (subr_die, DW_AT_static_link,
prune_unused_types_walk_attribs. */
if (DWARF2_ASM_LINE_DEBUG_INFO && ! flag_eliminate_unused_debug_types)
- maybe_emit_file (i);
+ return maybe_emit_file (i);
return i;
}
if (debug_info_level >= DINFO_LEVEL_VERBOSE)
{
+ int fileno;
+
named_section_flags (DEBUG_MACINFO_SECTION, SECTION_DEBUG);
dw2_asm_output_data (1, DW_MACINFO_start_file, "Start new file");
dw2_asm_output_data_uleb128 (lineno, "Included from line number %d",
lineno);
- maybe_emit_file (lookup_filename (filename));
- dw2_asm_output_data_uleb128 (lookup_filename (filename),
- "Filename we just started");
+
+ fileno = maybe_emit_file (lookup_filename (filename));
+ dw2_asm_output_data_uleb128 (fileno, "Filename we just started");
}
}
/* We can only use the low/high_pc attributes if all of the code was
in .text. */
- if (separate_line_info_table_in_use == 0)
+ if (!separate_line_info_table_in_use && !have_switched_text_section)
{
add_AT_lbl_id (comp_unit_die, DW_AT_low_pc, text_section_label);
add_AT_lbl_id (comp_unit_die, DW_AT_high_pc, text_end_label);