diff options
author | Eric Christopher <echristo@gmail.com> | 2013-10-16 01:37:49 +0000 |
---|---|---|
committer | Eric Christopher <echristo@gmail.com> | 2013-10-16 01:37:49 +0000 |
commit | a486f55569c584d00cfdde43a8755d68cdb68c4f (patch) | |
tree | 87168e2f895c3faaa3a761244f66bb717a0cbc4f /lib | |
parent | 06957f43f6051901590b318c10b1a0a5c7f898d4 (diff) | |
download | external_llvm-a486f55569c584d00cfdde43a8755d68cdb68c4f.zip external_llvm-a486f55569c584d00cfdde43a8755d68cdb68c4f.tar.gz external_llvm-a486f55569c584d00cfdde43a8755d68cdb68c4f.tar.bz2 |
Fix a pair of bugs in the emission of pubname tables:
1) Make sure we emit static member variables by checking
at the end of createGlobalVariableDIE rather than piecemeal
in the function.
(As a note, createGlobalVariableDIE needs rewriting.)
2) Make sure we use the definition rather than declaration DIE
for two things: a) determining linkage for gnu pubnames, and b)
as the address of the DIE for global variables.
(As a note, createGlobalVariableDIE really needs rewriting.)
Adjust the testcase to make sure we're checking the correct DIEs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192761 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp | 8 | ||||
-rw-r--r-- | lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 14 |
2 files changed, 16 insertions, 6 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp index 732db20..b6ea6a4 100644 --- a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp @@ -1472,10 +1472,8 @@ void CompileUnit::createGlobalVariableDIE(const MDNode *N) { addType(VariableDIE, GTy); // Add scoping info. - if (!GV.isLocalToUnit()) { + if (!GV.isLocalToUnit()) addFlag(VariableDIE, dwarf::DW_AT_external); - addGlobalName(GV.getName(), VariableDIE); - } // Add line number info. addSourceLine(VariableDIE, GV); @@ -1568,6 +1566,10 @@ void CompileUnit::createGlobalVariableDIE(const MDNode *N) { if (GV.getLinkageName() != "" && GV.getName() != GV.getLinkageName()) addAccelName(GV.getLinkageName(), AddrDIE); } + + if (!GV.isLocalToUnit()) + addGlobalName(GV.getName(), + VariableSpecDIE ? VariableSpecDIE : VariableDIE); } /// constructSubrangeDIE - Construct subrange DIE from DISubrange. diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index cee97c8..b7463c5 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -2356,9 +2356,17 @@ void DwarfDebug::emitAccelTypes() { /// computeIndexValue - Compute the gdb index value for the DIE and CU. static dwarf::PubIndexEntryDescriptor computeIndexValue(CompileUnit *CU, DIE *Die) { - dwarf::GDBIndexEntryLinkage Linkage = - Die->findAttribute(dwarf::DW_AT_external) ? dwarf::GIEL_EXTERNAL - : dwarf::GIEL_STATIC; + dwarf::GDBIndexEntryLinkage Linkage = dwarf::GIEL_STATIC; + + // We could have a specification DIE that has our most of our knowledge, + // look for that now. + DIEValue *SpecVal = Die->findAttribute(dwarf::DW_AT_specification); + if (SpecVal) { + DIE *SpecDIE = cast<DIEEntry>(SpecVal)->getEntry(); + if (SpecDIE->findAttribute(dwarf::DW_AT_external)) + Linkage = dwarf::GIEL_EXTERNAL; + } else if (Die->findAttribute(dwarf::DW_AT_external)) + Linkage = dwarf::GIEL_EXTERNAL; switch (Die->getTag()) { case dwarf::DW_TAG_class_type: |