This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] Fix glitch with DW_AT_MIPS_linkage_name
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 6 Jun 2010 19:10:17 +0200
- Subject: [patch] Fix glitch with DW_AT_MIPS_linkage_name
Hi,
if a symbol is prefixed with '*', it will be assembled verbatim:
/* Output to FILE (an assembly file) a reference to NAME. If NAME
starts with a *, the rest of NAME is output verbatim. Otherwise
NAME is transformed in a target-specific way (usually by the
addition of an underscore). */
void
assemble_name_raw (FILE *file, const char *name)
{
if (name[0] == '*')
fputs (&name[1], file);
else
ASM_OUTPUT_LABELREF (file, name);
}
We use this in Ada for the Link_Name of pragma Export. The problem is that
the '*' is then emitted in the debug info:
.long .LASF9 # DW_AT_name: "pck__one_global_buffer"
.byte 0x3 # DW_AT_decl_file (pck.ads)
.byte 0xa # DW_AT_decl_line
.long .LASF10 # DW_AT_MIPS_linkage_name: "*ONE_GLOBAL_BUFFER"
which confuses GDB.
Tested on i586-suse-linux, OK for mainline?
2010-06-06 Eric Botcazou <ebotcazou@adacore.com>
* dwarf2out.c (add_name_and_src_coords_attributes): Skip a leading '*'
in the DW_AT_MIPS_linkage_name.
--
Eric Botcazou
Index: dwarf2out.c
===================================================================
--- dwarf2out.c (revision 160335)
+++ dwarf2out.c (working copy)
@@ -17211,8 +17211,14 @@ 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)));
+ {
+ const char *name
+ = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
+ /* Mimic what assemble_name_raw does with a leading '*'. */
+ if (name[0] == '*')
+ name = &name[1];
+ add_AT_string (die, DW_AT_MIPS_linkage_name, name);
+ }
}
}