Skip special LLVM prefix '1' while emitting linknage name.

This prefix is used by LLVM to inform the asm printer to not emit usual global symbol prefix before the symbol name.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75875 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Devang Patel 2009-07-16 01:01:22 +00:00
parent 3434312a17
commit 53cb17dfbc

View File

@ -785,10 +785,16 @@ DIE *DwarfDebug::CreateGlobalVariableDIE(CompileUnit *DW_Unit,
AddString(GVDie, dwarf::DW_AT_name, dwarf::DW_FORM_string, Name);
std::string LinkageName;
GV.getLinkageName(LinkageName);
if (!LinkageName.empty())
if (!LinkageName.empty()) {
// Skip special LLVM prefix that is used to inform the asm printer to not emit
// usual symbol prefix before the symbol name. This happens for Objective-C
// symbol names and symbol whose name is replaced using GCC's __asm__ attribute.
if (LinkageName[0] == 1)
LinkageName = &LinkageName[1];
AddString(GVDie, dwarf::DW_AT_MIPS_linkage_name, dwarf::DW_FORM_string,
LinkageName);
AddType(DW_Unit, GVDie, GV.getType());
}
AddType(DW_Unit, GVDie, GV.getType());
if (!GV.isLocalToUnit())
AddUInt(GVDie, dwarf::DW_AT_external, dwarf::DW_FORM_flag, 1);
AddSourceLine(GVDie, &GV);
@ -855,9 +861,15 @@ DIE *DwarfDebug::CreateSubprogramDIE(CompileUnit *DW_Unit,
std::string LinkageName;
SP.getLinkageName(LinkageName);
if (!LinkageName.empty())
if (!LinkageName.empty()) {
// Skip special LLVM prefix that is used to inform the asm printer to not emit
// usual symbol prefix before the symbol name. This happens for Objective-C
// symbol names and symbol whose name is replaced using GCC's __asm__ attribute.
if (LinkageName[0] == 1)
LinkageName = &LinkageName[1];
AddString(SPDie, dwarf::DW_AT_MIPS_linkage_name, dwarf::DW_FORM_string,
LinkageName);
}
AddSourceLine(SPDie, &SP);
DICompositeType SPTy = SP.getType();
@ -2455,7 +2467,16 @@ void DwarfDebug::EmitDebugInlineInfo() {
SP.getLinkageName(LName);
SP.getName(Name);
Asm->EmitString(LName.empty() ? Name : LName);
if (LName.empty())
Asm->EmitString(Name);
else {
// Skip special LLVM prefix that is used to inform the asm printer to not emit
// usual symbol prefix before the symbol name. This happens for Objective-C
// symbol names and symbol whose name is replaced using GCC's __asm__ attribute.
if (LName[0] == 1)
LName = &LName[1];
Asm->EmitString(LName);
}
Asm->EOL("MIPS linkage name");
Asm->EmitString(Name); Asm->EOL("Function name");