[PATCH] D108167: [lld-macho] Refactor parseSections to avoid creating isec on LLVM segments

Vincent Lee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 16 18:48:25 PDT 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rG08d55c5c0156: [lld-macho] Refactor parseSections to avoid creating isec on LLVM segments (authored by thevinster).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108167

Files:
  lld/MachO/InputFiles.cpp


Index: lld/MachO/InputFiles.cpp
===================================================================
--- lld/MachO/InputFiles.cpp
+++ lld/MachO/InputFiles.cpp
@@ -279,6 +279,14 @@
             {off, make<ConcatInputSection>(segname, name, this,
                                            data.slice(off, literalSize), align,
                                            flags)});
+    } else if (segname == segment_names::llvm) {
+      // ld64 does not appear to emit contents from sections within the __LLVM
+      // segment. Symbols within those sections point to bitcode metadata
+      // instead of actual symbols. Global symbols within those sections could
+      // have the same name without causing duplicate symbol errors. Push an
+      // empty map to ensure indices line up for the remaining sections.
+      // TODO: Evaluate whether the bitcode metadata is needed.
+      subsections.push_back({});
     } else {
       auto *isec =
           make<ConcatInputSection>(segname, name, this, data, align, flags);
@@ -290,14 +298,6 @@
         // empty map to ensure the indices line up for the remaining sections.
         subsections.push_back({});
         debugSections.push_back(isec);
-      } else if (isec->getSegName() == segment_names::llvm) {
-        // ld64 does not appear to emit contents from sections within the __LLVM
-        // segment. Symbols within those sections point to bitcode metadata
-        // instead of actual symbols. Global symbols within those sections could
-        // have the same name without causing duplicate symbol errors. Push an
-        // empty map to ensure indices line up for the remaining sections.
-        // TODO: Evaluate whether the bitcode metadata is needed.
-        subsections.push_back({});
       } else {
         subsections.push_back({{0, isec}});
       }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108167.366787.patch
Type: text/x-patch
Size: 1837 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210817/517ff2bc/attachment.bin>


More information about the llvm-commits mailing list