Commit b6051207 by Sterling Augustine Committed by Sterling Augustine

dwarf2out.c (size_of_pubnames): Move code to...

2013-07-25  Sterling Augustine  <saugustine@google.com>

	* dwarf2out.c (size_of_pubnames): Move code to...
	(include_pubname_in_output): ...here.  New.
	(want_pubnames): Rearrange.
	(output_pubnames): Call include_pubname_in_output.  Move assertion.

From-SVN: r201255
parent f0051264
2013-07-25 Sterling Augustine <saugustine@google.com>
* dwarf2out.c (size_of_pubnames): Move code to...
(include_pubname_in_output): ...here. New.
(want_pubnames): Rearrange.
(output_pubnames): Call include_pubname_in_output. Move assertion.
2013-07-25 Cameron McInally <cameron.mcinally@nyu.edu> 2013-07-25 Cameron McInally <cameron.mcinally@nyu.edu>
* doc/extend.texi: Fix return types for __builtin_ia32_cmp*s builtins. * doc/extend.texi: Fix return types for __builtin_ia32_cmp*s builtins.
......
...@@ -7887,6 +7887,32 @@ unmark_all_dies (dw_die_ref die) ...@@ -7887,6 +7887,32 @@ unmark_all_dies (dw_die_ref die)
unmark_all_dies (AT_ref (a)); unmark_all_dies (AT_ref (a));
} }
/* Calculate if the entry should appear in the final output file. It may be
from a pruned a type. */
static bool
include_pubname_in_output (vec<pubname_entry, va_gc> *table, pubname_entry *p)
{
if (table == pubname_table)
{
/* Enumerator names are part of the pubname table, but the
parent DW_TAG_enumeration_type die may have been pruned.
Don't output them if that is the case. */
if (p->die->die_tag == DW_TAG_enumerator &&
(p->die->die_parent == NULL
|| !p->die->die_parent->die_perennial_p))
return false;
/* Everything else in the pubname table is included. */
return true;
}
/* The pubtypes table shouldn't include types that have been
pruned. */
return (p->die->die_offset != 0
|| !flag_eliminate_unused_debug_types);
}
/* Return the size of the .debug_pubnames or .debug_pubtypes table /* Return the size of the .debug_pubnames or .debug_pubtypes table
generated for the compilation unit. */ generated for the compilation unit. */
...@@ -7899,9 +7925,7 @@ size_of_pubnames (vec<pubname_entry, va_gc> *names) ...@@ -7899,9 +7925,7 @@ size_of_pubnames (vec<pubname_entry, va_gc> *names)
size = DWARF_PUBNAMES_HEADER_SIZE; size = DWARF_PUBNAMES_HEADER_SIZE;
FOR_EACH_VEC_ELT (*names, i, p) FOR_EACH_VEC_ELT (*names, i, p)
if (names != pubtype_table if (include_pubname_in_output (names, p))
|| p->die->die_offset != 0
|| !flag_eliminate_unused_debug_types)
size += strlen (p->name) + DWARF_OFFSET_SIZE + 1; size += strlen (p->name) + DWARF_OFFSET_SIZE + 1;
size += DWARF_OFFSET_SIZE; size += DWARF_OFFSET_SIZE;
...@@ -8731,9 +8755,9 @@ output_comp_unit (dw_die_ref die, int output_if_empty) ...@@ -8731,9 +8755,9 @@ output_comp_unit (dw_die_ref die, int output_if_empty)
static inline bool static inline bool
want_pubnames (void) want_pubnames (void)
{ {
return (debug_generate_pub_sections != -1 if (debug_generate_pub_sections != -1)
? debug_generate_pub_sections return debug_generate_pub_sections;
: targetm.want_debug_pub_sections); return targetm.want_debug_pub_sections;
} }
/* Add the DW_AT_GNU_pubnames and DW_AT_GNU_pubtypes attributes. */ /* Add the DW_AT_GNU_pubnames and DW_AT_GNU_pubtypes attributes. */
...@@ -9095,24 +9119,14 @@ output_pubnames (vec<pubname_entry, va_gc> *names) ...@@ -9095,24 +9119,14 @@ output_pubnames (vec<pubname_entry, va_gc> *names)
FOR_EACH_VEC_ELT (*names, i, pub) FOR_EACH_VEC_ELT (*names, i, pub)
{ {
/* Enumerator names are part of the pubname table, but the parent if (include_pubname_in_output (names, pub))
DW_TAG_enumeration_type die may have been pruned. Don't output {
them if that is the case. */ dw_offset die_offset = pub->die->die_offset;
if (pub->die->die_tag == DW_TAG_enumerator &&
(pub->die->die_parent == NULL
|| !pub->die->die_parent->die_perennial_p))
continue;
/* We shouldn't see pubnames for DIEs outside of the main CU. */ /* We shouldn't see pubnames for DIEs outside of the main CU. */
if (names == pubname_table && pub->die->die_tag != DW_TAG_enumerator) if (names == pubname_table && pub->die->die_tag != DW_TAG_enumerator)
gcc_assert (pub->die->die_mark); gcc_assert (pub->die->die_mark);
if (names != pubtype_table
|| pub->die->die_offset != 0
|| !flag_eliminate_unused_debug_types)
{
dw_offset die_offset = pub->die->die_offset;
/* If we're putting types in their own .debug_types sections, /* If we're putting types in their own .debug_types sections,
the .debug_pubtypes table will still point to the compile the .debug_pubtypes table will still point to the compile
unit (not the type unit), so we want to use the offset of unit (not the type unit), so we want to use the offset of
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment