Patchwork [google/main] Fix erroneous output of pubnames when no .debug_section is emitted. (issue5528054)

login
register
mail settings
Submitter Sterling Augustine
Date Jan. 9, 2012, 10:18 p.m.
Message ID <20120109221849.8A179160CF0@sterling.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/135122/
State New
Headers show

Comments

Sterling Augustine - Jan. 9, 2012, 10:18 p.m.
Certain source files will not produce a .debug_info section. This patch to
google/main adds a check for that case to output_pubnames, preventing a link
failure.

Tested:
	By rebuild and bootstrap.

ChangeLog:

2012-01-09   Sterling Augustine  <saugustine@google.com>

	* gcc/dwarf2out.c (output_pubnames): Add check for info_section_emitted.


--
This patch is available for review at http://codereview.appspot.com/5528054
Cary Coutant - Jan. 9, 2012, 11:09 p.m.
> Certain source files will not produce a .debug_info section. This patch to
> google/main adds a check for that case to output_pubnames, preventing a link
> failure.
>
> Tested:
>        By rebuild and bootstrap.
>
> ChangeLog:
>
> 2012-01-09   Sterling Augustine  <saugustine@google.com>
>
>        * gcc/dwarf2out.c (output_pubnames): Add check for info_section_emitted.

LGTM.

-cary

Patch

diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 3788cf8..57f18ad 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -8754,7 +8754,7 @@  output_pubnames (VEC (pubname_entry, gc) * names)
   unsigned long pubnames_length = size_of_pubnames (names);
   pubname_ref pub;
 
-  if (!targetm.want_debug_pub_sections)
+  if (!targetm.want_debug_pub_sections || !info_section_emitted)
     return;
   if (names == pubname_table)
     {