[PATCH] D123302: [lld/mac] Add some comments and asserts

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 7 12:43:48 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG2cb3d28b1735: [lld/mac] Add some comments and asserts (authored by thakis).
Herald added a project: LLVM.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D123302

Files:
  lld/MachO/SymbolTable.cpp
  lld/MachO/SyntheticSections.cpp


Index: lld/MachO/SyntheticSections.cpp
===================================================================
--- lld/MachO/SyntheticSections.cpp
+++ lld/MachO/SyntheticSections.cpp
@@ -908,6 +908,11 @@
       ObjFile *file = dyn_cast_or_null<ObjFile>(isec->getFile());
       if (!file || !file->compileUnit)
         continue;
+
+      // All symbols that set includeInSymtab to false are synthetic symbols.
+      // Those have `file` set to nullptr and were already skipped due to that.
+      assert(defined->includeInSymtab);
+
       symbolsNeedingStabs.push_back(defined);
     }
   }
Index: lld/MachO/SymbolTable.cpp
===================================================================
--- lld/MachO/SymbolTable.cpp
+++ lld/MachO/SymbolTable.cpp
@@ -230,8 +230,9 @@
                                    uint64_t value, bool isPrivateExtern,
                                    bool includeInSymtab,
                                    bool referencedDynamically) {
+  assert(!isec || !isec->getFile()); // See makeSyntheticInputSection().
   Defined *s =
-      addDefined(name, nullptr, isec, value, /*size=*/0,
+      addDefined(name, /*file=*/nullptr, isec, value, /*size=*/0,
                  /*isWeakDef=*/false, isPrivateExtern,
                  /*isThumb=*/false, referencedDynamically,
                  /*noDeadStrip=*/false, /*isWeakDefCanBeHidden=*/false);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123302.421316.patch
Type: text/x-patch
Size: 1374 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220407/5fb02bce/attachment.bin>


More information about the llvm-commits mailing list