Remove DW_AT_GNU_addr_base from skeleton type unit DIEs.

GCC currently adds a DW_AT_GNU_addr_base attribute to skeleton type unit
DIEs, even though it's not needed there. By removing it, we can save
the 8 bytes that a DW_FORM_addr takes up, plus the 24 bytes that the
corresponding relocation takes.

This patch is for the google/gcc-4_8 branch. I will submit it
for trunk when stage 1 is open.

Tested with crosstool_validate.py.


2014-02-11  Cary Coutant  <ccout...@google.com>

        * dwarf2out.c (add_top_level_skeleton_die_attrs): Don't add
        DW_AT_GNU_addr_base to all skeleton DIEs.
        (dwarf2out_finish): Add it only to the skeleton comp_unit DIE.


Index: dwarf2out.c
===================================================================
--- dwarf2out.c (revision 207671)
+++ dwarf2out.c (working copy)
@@ -8918,7 +8918,6 @@ add_top_level_skeleton_die_attrs (dw_die
   if (comp_dir != NULL)
     add_skeleton_AT_string (die, DW_AT_comp_dir, comp_dir);
   add_AT_pubnames (die);
-  add_AT_lineptr (die, DW_AT_GNU_addr_base, debug_addr_section_label);
 }
 
 /* Return the single type-unit die for skeleton type units.  */
@@ -23929,6 +23928,8 @@ dwarf2out_finish (const char *filename)
          skeleton die attrs are added when the skeleton type unit is
          created, so ensure it is created by this point.  */
       add_top_level_skeleton_die_attrs (main_comp_unit_die);
+      add_AT_lineptr (main_comp_unit_die, DW_AT_GNU_addr_base,
+                      debug_addr_section_label);
       (void) get_skeleton_type_unit ();
       htab_traverse_noresize (debug_str_hash, index_string, &index);
     }

Reply via email to