/* 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;
+/* True if the compilation unit places functions in more than one section. */
+static GTY(()) bool have_multiple_function_sections = 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. */
#define RANGES_TABLE_INCREMENT 64
/* Whether we have location lists that need outputting */
-static GTY(()) unsigned have_location_lists;
+static GTY(()) bool have_location_lists;
/* Unique label counter. */
static GTY(()) unsigned int loclabel_num;
attr->dw_attr_val.val_class = dw_val_class_loc_list;
attr->dw_attr_val.v.val_loc_list = loc_list;
add_dwarf_attr (die, attr);
- have_location_lists = 1;
+ have_location_lists = true;
}
static inline dw_loc_list_ref
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;
- have_switched_text_section = true;
+ have_multiple_function_sections = 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 && !have_switched_text_section)
+ if (!have_multiple_function_sections)
{
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 && !have_switched_text_section)
+ if (!have_multiple_function_sections)
{
dw2_asm_output_delta (DWARF2_ADDR_SIZE, blabel,
text_section_label,
/* We need to reset the locations at the beginning of each
function. We can't do this in the end_function hook, because the
- declarations that use the locations won't have been outputted when
- that hook is called. */
+ declarations that use the locations won't have been output when
+ that hook is called. Also compute have_multiple_function_sections here. */
static void
-dwarf2out_begin_function (tree unused ATTRIBUTE_UNUSED)
+dwarf2out_begin_function (tree fun)
{
htab_empty (decl_loc_table);
+
+ if (function_section (fun) != text_section)
+ have_multiple_function_sections = true;
}
/* Output a label to mark the beginning of a source code line entry
/* Indicate that line number info exists. */
line_info_table_in_use++;
-
- /* Indicate that multiple line number tables exist. */
- if (DECL_SECTION_NAME (current_function_decl))
- separate_line_info_table_in_use++;
}
- else if (DECL_SECTION_NAME (current_function_decl))
+ else if (function_section (current_function_decl) != text_section)
{
dw_separate_line_info_ref line_info;
targetm.asm_out.internal_label (asm_out_file, SEPARATE_LINE_CODE_LABEL,
output_line_info ();
}
- /* Output location list section if necessary. */
- if (have_location_lists)
- {
- /* Output the location lists info. */
- switch_to_section (debug_loc_section);
- ASM_GENERATE_INTERNAL_LABEL (loc_section_label,
- DEBUG_LOC_SECTION_LABEL, 0);
- ASM_OUTPUT_LABEL (asm_out_file, loc_section_label);
- output_location_lists (die);
- have_location_lists = 0;
- }
-
/* We can only use the low/high_pc attributes if all of the code was
in .text. */
- if (!separate_line_info_table_in_use && !have_switched_text_section)
+ if (!have_multiple_function_sections)
{
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);
else if (have_location_lists || ranges_table_in_use)
add_AT_addr (comp_unit_die, DW_AT_entry_pc, const0_rtx);
+ /* Output location list section if necessary. */
+ if (have_location_lists)
+ {
+ /* Output the location lists info. */
+ switch_to_section (debug_loc_section);
+ ASM_GENERATE_INTERNAL_LABEL (loc_section_label,
+ DEBUG_LOC_SECTION_LABEL, 0);
+ ASM_OUTPUT_LABEL (asm_out_file, loc_section_label);
+ output_location_lists (die);
+ }
+
if (debug_info_level >= DINFO_LEVEL_NORMAL)
add_AT_lbl_offset (comp_unit_die, DW_AT_stmt_list,
debug_line_section_label);