The following reportedly fixes PR86736, a dwarf2out ICE with
-gpubnames (default on darwin) when compiling with -g0
(default on darwin) but linking with -g.  pubnames (and types)
are really part of early debug - there is no point in emitting
those late (but the early part also fails, see PR88878 I opened).

Committed to trunk.

Richard.

2019-01-17  Richard Biener  <rguent...@suse.de>

        PR lto/86736
        * dwarf2out.c (want_pubnames): Never generate pubnames sections
        and friends for the LTO part of debug info.

diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index a1b5a5eaf19..cd2e889a8cc 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -11074,7 +11074,9 @@ output_comp_unit (dw_die_ref die, int output_if_empty,
 static inline bool
 want_pubnames (void)
 {
-  if (debug_info_level <= DINFO_LEVEL_TERSE)
+  if (debug_info_level <= DINFO_LEVEL_TERSE
+      /* Names and types go to the early debug part only.  */
+      || in_lto_p)
     return false;
   if (debug_generate_pub_sections != -1)
     return debug_generate_pub_sections;

Reply via email to