[PATCH] D98073: [lld-macho] Skip over symbols in un-parsed debug info sections

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 5 14:24:57 PST 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3c19b4f34d6a: [lld-macho] Skip over symbols in un-parsed debug info sections (authored by int3).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98073

Files:
  lld/MachO/InputFiles.cpp
  lld/MachO/SyntheticSections.cpp
  lld/test/MachO/stabs.s


Index: lld/test/MachO/stabs.s
===================================================================
--- lld/test/MachO/stabs.s
+++ lld/test/MachO/stabs.s
@@ -181,6 +181,10 @@
 .subsections_via_symbols
 .section  __DWARF,__debug_line,regular,debug
 
+.section  __DWARF,__debug_aranges,regular,debug
+ltmp1:
+  .byte 0
+
 #--- no-debug.s
 ## This file has no debug info.
 .text
Index: lld/MachO/SyntheticSections.cpp
===================================================================
--- lld/MachO/SyntheticSections.cpp
+++ lld/MachO/SyntheticSections.cpp
@@ -733,6 +733,8 @@
   for (InputFile *file : inputFiles) {
     if (auto *objFile = dyn_cast<ObjFile>(file)) {
       for (Symbol *sym : objFile->symbols) {
+        if (sym == nullptr)
+          continue;
         // TODO: when we implement -dead_strip, we should filter out symbols
         // that belong to dead sections.
         if (auto *defined = dyn_cast<Defined>(sym)) {
Index: lld/MachO/InputFiles.cpp
===================================================================
--- lld/MachO/InputFiles.cpp
+++ lld/MachO/InputFiles.cpp
@@ -407,7 +407,11 @@
 
     const section_64 &sec = sectionHeaders[sym.n_sect - 1];
     SubsectionMap &subsecMap = subsections[sym.n_sect - 1];
-    assert(!subsecMap.empty());
+
+    // parseSections() may have chosen not to parse this section.
+    if (subsecMap.empty())
+      continue;
+
     uint64_t offset = sym.n_value - sec.addr;
 
     // If the input file does not use subsections-via-symbols, all symbols can


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98073.328648.patch
Type: text/x-patch
Size: 1517 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210305/a12ee461/attachment.bin>


More information about the llvm-commits mailing list