Index: llvm/test/tools/dsymutil/X86/dwarf5.test =================================================================== --- /dev/null +++ llvm/test/tools/dsymutil/X86/dwarf5.test @@ -0,0 +1,18 @@ +Test DWARF5 support in dsymutil. Currently this still generates an empty dSYM. + +$ cat dwarf5.c +__attribute__ ((optnone)) +int foo() { + volatile i; + return i; +} + +int main(int argc, char** argv) { + return foo(); +} + +$ clang -gdwarf-5 dwarf5.c -c -o dwarf5.o +$ clang dwarf5.o -o dwarf5.out + +RUN: dsymutil -oso-prepend-path %p/../Inputs %p/../Inputs/private/tmp/dwarf5/dwarf5.out -o %t.dSYM 2>&1 | FileCheck %s +CHECK: warning: Unsupported attribute form in cloneAttribute. Dropping. Index: llvm/tools/dsymutil/DwarfLinkerForBinary.cpp =================================================================== --- llvm/tools/dsymutil/DwarfLinkerForBinary.cpp +++ llvm/tools/dsymutil/DwarfLinkerForBinary.cpp @@ -582,10 +582,10 @@ return true; } -/// Look for relocations in the debug_info section that match -/// entries in the debug map. These relocations will drive the Dwarf -/// link by indicating which DIEs refer to symbols present in the -/// linked binary. +/// Look for relocations in either the debug_info or the debug_addr sections +/// that match entries in the debug map. These relocations will drive the Dwarf +/// link by indicating which DIEs refer to symbols present in the linked +/// binary. /// \returns whether there are any valid relocations in the debug info. bool DwarfLinkerForBinary::AddressManager::findValidRelocsInDebugInfo( const object::ObjectFile &Obj, const DebugMapObject &DMO) { @@ -598,9 +598,9 @@ consumeError(NameOrErr.takeError()); SectionName = SectionName.substr(SectionName.find_first_not_of("._")); - if (SectionName != "debug_info") - continue; - return findValidRelocs(Section, Obj, DMO); + if (SectionName == "debug_info" || SectionName == "debug_addr") + if(findValidRelocs(Section, Obj, DMO)) + return true; } return false; }