diff options
author | Mark Wielaard <mjw@redhat.com> | 2011-04-01 18:24:52 +0000 |
---|---|---|
committer | Mark Wielaard <mark@gcc.gnu.org> | 2011-04-01 18:24:52 +0000 |
commit | bdb0b0f61c5af3ae2d7dbdeca6089bd6ad79d50e (patch) | |
tree | ff9f1978d02833ba15573d58f13b01aaf374758e | |
parent | 9d70124888e3823e60964b56e9ab6bf07454f68e (diff) | |
download | gcc-bdb0b0f61c5af3ae2d7dbdeca6089bd6ad79d50e.zip gcc-bdb0b0f61c5af3ae2d7dbdeca6089bd6ad79d50e.tar.gz gcc-bdb0b0f61c5af3ae2d7dbdeca6089bd6ad79d50e.tar.bz2 |
Don't add DW_AT_low_pc if the CU has no associated code.
* dwarf2out.c (dwarf2out_finish): Don't add low_pc and/or
high_pc attribute if the CU has no associated code. Only output
DW_AT_entry_pc for CU if not generating strict dwarf and
dwarf_version < 4.
From-SVN: r171846
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/dwarf2out.c | 30 |
2 files changed, 25 insertions, 12 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9ca1d95..bfaf388 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2011-03-31 Mark Wielaard <mjw@redhat.com> + + * dwarf2out.c (dwarf2out_finish): Don't add low_pc and/or + high_pc attribute if the CU has no associated code. Only output + DW_AT_entry_pc for CU if not generating strict dwarf and + dwarf_version < 4. + 2011-04-01 Bernd Schmidt <bernds@codesourcery.com> * dwarf2out.h (dwarf2out_frame_debug_init): Declare. diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 8371b5e..50d9429 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -23588,23 +23588,18 @@ dwarf2out_finish (const char *filename) if (!have_multiple_function_sections || (dwarf_version < 3 && dwarf_strict)) { - 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); + /* Don't add if the CU has no associated code. */ + if (text_section_used) + { + 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 { unsigned fde_idx = 0; bool range_list_added = false; - /* We need to give .debug_loc and .debug_ranges an appropriate - "base address". Use zero so that these addresses become - absolute. Historically, we've emitted the unexpected - DW_AT_entry_pc instead of DW_AT_low_pc for this purpose. - Emit both to give time for other tools to adapt. */ - add_AT_addr (comp_unit_die (), DW_AT_low_pc, const0_rtx); - add_AT_addr (comp_unit_die (), DW_AT_entry_pc, const0_rtx); - if (text_section_used) add_ranges_by_labels (comp_unit_die (), text_section_label, text_end_label, &range_list_added); @@ -23625,7 +23620,18 @@ dwarf2out_finish (const char *filename) } if (range_list_added) - add_ranges (NULL); + { + /* We need to give .debug_loc and .debug_ranges an appropriate + "base address". Use zero so that these addresses become + absolute. Historically, we've emitted the unexpected + DW_AT_entry_pc instead of DW_AT_low_pc for this purpose. + Emit both to give time for other tools to adapt. */ + add_AT_addr (comp_unit_die (), DW_AT_low_pc, const0_rtx); + if (! dwarf_strict && dwarf_version < 4) + add_AT_addr (comp_unit_die (), DW_AT_entry_pc, const0_rtx); + + add_ranges (NULL); + } } if (debug_info_level >= DINFO_LEVEL_NORMAL) |