[PATCH] D94323: [dsymutil] Support finding relocations in debug_addr for DWARF5

Jonas Devlieghere via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 8 11:11:17 PST 2021


JDevlieghere updated this revision to Diff 315457.

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94323/new/

https://reviews.llvm.org/D94323

Files:
  llvm/test/tools/dsymutil/Inputs/private/tmp/dwarf5/dwarf5.o
  llvm/test/tools/dsymutil/Inputs/private/tmp/dwarf5/dwarf5.out
  llvm/test/tools/dsymutil/X86/dwarf5.test
  llvm/tools/dsymutil/DwarfLinkerForBinary.cpp


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;
 }
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.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94323.315457.patch
Type: text/x-patch
Size: 2034 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210108/b2fa1133/attachment.bin>


More information about the llvm-commits mailing list