This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Fix glitch with DW_AT_MIPS_linkage_name
> This is not ok, you've reverted a DWARF4 support change.
> You want to use AT_linkage_name as second argument to add_AT_string.
I totally missed that, thanks. In fact, the patch turned out to be incomplete
since AT_linkage_name can be emitted in another place. Using a macro here is
a little awkward so I've eliminated it in the process.
Retested on i586-suse-linux, OK for mainline?
2010-06-06 Eric Botcazou <ebotcazou@adacore.com>
* dwarf2out.c (AT_linkage_name): Delete.
(add_linkage_attr): New function.
(add_name_and_src_coords_attributes): Call it to emit linkage name.
(dwarf2out_finish): Likewise.
(move_linkage_attr): Explicitly accept both attribute variants.
--
Eric Botcazou
Index: dwarf2out.c
===================================================================
--- dwarf2out.c (revision 160335)
+++ dwarf2out.c (working copy)
@@ -6307,11 +6307,6 @@ static void gen_remaining_tmpl_value_par
#define DEBUG_MACINFO_SECTION_LABEL "Ldebug_macinfo"
#endif
-/* Mangled name attribute to use. This used to be a vendor extension
- until DWARF 4 standardized it. */
-#define AT_linkage_name \
- (dwarf_version >= 4 ? DW_AT_linkage_name : DW_AT_MIPS_linkage_name)
-
/* Definitions of defaults for formats and names of various special
(artificial) labels which may be generated within this file (when the -g
@@ -17166,6 +17161,25 @@ add_pure_or_virtual_attribute (dw_die_re
}
}
+/* Add a DW_AT_linkage_name or DW_AT_MIPS_linkage_name attribute for the
+ given decl. This used to be a vendor extension until after DWARF 4
+ standardized it. */
+
+static void
+add_linkage_attr (dw_die_ref die, tree decl)
+{
+ const char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
+
+ /* Mimic what assemble_name_raw does with a leading '*'. */
+ if (name[0] == '*')
+ name = &name[1];
+
+ if (dwarf_version >= 4)
+ add_AT_string (die, DW_AT_linkage_name, name);
+ else
+ add_AT_string (die, DW_AT_MIPS_linkage_name, name);
+}
+
/* Add source coordinate attributes for the given decl. */
static void
@@ -17211,8 +17225,7 @@ add_name_and_src_coords_attributes (dw_d
deferred_asm_name = asm_name;
}
else if (DECL_ASSEMBLER_NAME (decl) != DECL_NAME (decl))
- add_AT_string (die, AT_linkage_name,
- IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
+ add_linkage_attr (die, decl);
}
}
@@ -21642,7 +21655,8 @@ move_linkage_attr (dw_die_ref die)
unsigned ix = VEC_length (dw_attr_node, die->die_attr);
dw_attr_node linkage = *VEC_index (dw_attr_node, die->die_attr, ix - 1);
- gcc_assert (linkage.dw_attr == AT_linkage_name);
+ gcc_assert (linkage.dw_attr == DW_AT_linkage_name
+ || linkage.dw_attr == DW_AT_MIPS_linkage_name);
while (--ix > 0)
{
@@ -21875,8 +21889,7 @@ dwarf2out_finish (const char *filename)
tree decl = node->created_for;
if (DECL_ASSEMBLER_NAME (decl) != DECL_NAME (decl))
{
- add_AT_string (node->die, AT_linkage_name,
- IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
+ add_linkage_attr (node->die, decl);
move_linkage_attr (node->die);
}
}