[google/gcc-4_6] Fix -gfission issue in index_location_lists (issue6248072)

Message ID 20120530211237.0241AE14E8@ccoutant.mtv.corp.google.com
State New
Headers show

Commit Message

Cary Coutant May 30, 2012, 9:12 p.m.
This patch is for the google/gcc-4_6 branch. It fixes an issue that
causes the .debug_addr section to be twice as big as it should be.

Tested on x86_64 and ran validate_failures.py. Also tested by
building an internal application and verifying correct behavior.

2012-05-30   Cary Coutant  <ccoutant@google.com>

	* gcc/dwarf2out.c (index_location_lists): Don't index location
	lists that have already been indexed.

This patch is available for review at http://codereview.appspot.com/6248072


Index: gcc/dwarf2out.c
--- gcc/dwarf2out.c	(revision 187983)
+++ gcc/dwarf2out.c	(working copy)
@@ -24269,8 +24269,10 @@  index_location_lists (dw_die_ref die)
             dw_attr_node attr;
-            /* Don't index an entry that won't be output.  */
-            if (strcmp (curr->begin, curr->end) == 0)
+            /* Don't index an entry that has already been indexed
+	       or won't be output.  */
+            if (curr->begin_index != -1U
+	        || strcmp (curr->begin, curr->end) == 0)
             attr.dw_attr = DW_AT_location;