elide empty .debug_loc
Richard Henderson
rth@redhat.com
Fri Aug 17 11:36:00 GMT 2001
H.J. reported that an empty .debug_loc crashed the Irix ld.so.
I can't verify that, but it does make sense to not bother to
emit it if its unused.
r~
* dwarf2out.c (dwarf2out_init): Don't emit .debug_loc label here.
(dwarf2out_finish): Do it here. Emit .debug_loc before .debug_info.
Index: dwarf2out.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/dwarf2out.c,v
retrieving revision 1.303
diff -c -p -d -r1.303 dwarf2out.c
*** dwarf2out.c 2001/08/17 02:33:24 1.303
--- dwarf2out.c 2001/08/17 18:33:29
*************** dwarf2out_init (main_input_filename)
*** 11693,11701 ****
DEBUG_INFO_SECTION_LABEL, 0);
ASM_GENERATE_INTERNAL_LABEL (debug_line_section_label,
DEBUG_LINE_SECTION_LABEL, 0);
- ASM_GENERATE_INTERNAL_LABEL (loc_section_label, DEBUG_LOC_SECTION_LABEL, 0);
- named_section_flags (DEBUG_LOC_SECTION, SECTION_DEBUG);
- ASM_OUTPUT_LABEL (asm_out_file, loc_section_label);
named_section_flags (DEBUG_ABBREV_SECTION, SECTION_DEBUG);
ASM_OUTPUT_LABEL (asm_out_file, abbrev_section_label);
named_section_flags (DEBUG_INFO_SECTION, SECTION_DEBUG);
--- 11693,11698 ----
*************** dwarf2out_finish (input_filename)
*** 11785,11790 ****
--- 11782,11799 ----
output_line_info ();
}
+ /* Output location list section if necessary. */
+ if (have_location_lists)
+ {
+ /* Output the location lists info. */
+ named_section_flags (DEBUG_LOC_SECTION, SECTION_DEBUG);
+ 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 == 0)
*************** dwarf2out_finish (input_filename)
*** 11829,11843 ****
/* Output the address range information. */
named_section_flags (DEBUG_ARANGES_SECTION, SECTION_DEBUG);
output_aranges ();
- }
-
- /* Output location list section if necessary. */
- if (have_location_lists)
- {
- /* Output the location lists info. */
- named_section_flags (DEBUG_LOC_SECTION, SECTION_DEBUG);
- output_location_lists (die);
- have_location_lists = 0;
}
/* Output ranges section if necessary. */
--- 11838,11843 ----
More information about the Gcc-patches
mailing list