{
char l1[20], l2[20], p1[20], p2[20];
int ver = dwarf_version;
+ bool saw_one = false;
int opc;
ASM_GENERATE_INTERNAL_LABEL (l1, LINE_NUMBER_BEGIN_LABEL, 0);
output_file_names ();
ASM_OUTPUT_LABEL (asm_out_file, p2);
- if (text_section_line_info && text_section_line_info->in_use)
- output_one_line_info_table (text_section_line_info);
- if (cold_text_section_line_info && cold_text_section_line_info->in_use)
- output_one_line_info_table (cold_text_section_line_info);
-
if (separate_line_info)
{
dw_line_info_table *table;
FOR_EACH_VEC_ELT (dw_line_info_table_p, separate_line_info, i, table)
if (table->in_use)
- output_one_line_info_table (table);
+ {
+ output_one_line_info_table (table);
+ saw_one = true;
+ }
+ }
+ if (cold_text_section_line_info && cold_text_section_line_info->in_use)
+ {
+ output_one_line_info_table (cold_text_section_line_info);
+ saw_one = true;
}
+ /* ??? Some Darwin linkers crash on a .debug_line section with no
+ sequences. Further, merely a DW_LNE_end_sequence entry is not
+ sufficient -- the address column must also be initialized.
+ Make sure to output at least one set_address/end_sequence pair,
+ choosing .text since that section is always present. */
+ if (text_section_line_info->in_use || !saw_one)
+ output_one_line_info_table (text_section_line_info);
+
/* Output the marker for the end of the line number info. */
ASM_OUTPUT_LABEL (asm_out_file, l2);
}
dw_line_info_table *table;
if (sec == text_section)
- {
- table = text_section_line_info;
- if (!table)
- {
- text_section_line_info = table = new_line_info_table ();
- table->end_label = text_end_label;
- }
- }
+ table = text_section_line_info;
else if (sec == cold_text_section)
{
table = cold_text_section_line_info;
switch_to_section (text_section);
ASM_OUTPUT_LABEL (asm_out_file, text_section_label);
+
+ /* Make sure the line number table for .text always exists. */
+ text_section_line_info = new_line_info_table ();
+ text_section_line_info->end_label = text_end_label;
}
/* Called before cgraph_optimize starts outputtting functions, variables