[PATCH] D139909: [lld-macho] Fix __objc_stubs ordering

Keith Smiley via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 12 20:48:01 PST 2022


keith created this revision.
Herald added projects: lld-macho, All.
Herald added a reviewer: lld-macho.
keith requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

In the case of large binaries previously you could end up getting
relocation failures. This mirrors ld64's ordering of these sections. I'm
not sure this solves all cases but it should help in some.

Fixes https://github.com/llvm/llvm-project/issues/58298


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D139909

Files:
  lld/MachO/OutputSegment.cpp


Index: lld/MachO/OutputSegment.cpp
===================================================================
--- lld/MachO/OutputSegment.cpp
+++ lld/MachO/OutputSegment.cpp
@@ -90,10 +90,11 @@
   // Sections are uniquely identified by their segment + section name.
   if (segname == segment_names::text) {
     return StringSwitch<int>(osec->name)
-        .Case(section_names::header, -5)
-        .Case(section_names::text, -4)
-        .Case(section_names::stubs, -3)
-        .Case(section_names::stubHelper, -2)
+        .Case(section_names::header, -6)
+        .Case(section_names::text, -5)
+        .Case(section_names::stubs, -4)
+        .Case(section_names::stubHelper, -3)
+        .Case(section_names::objcStubs, -2)
         .Case(section_names::initOffsets, -1)
         .Case(section_names::unwindInfo, std::numeric_limits<int>::max() - 1)
         .Case(section_names::ehFrame, std::numeric_limits<int>::max())


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139909.482352.patch
Type: text/x-patch
Size: 923 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221213/5d57b7a1/attachment.bin>


More information about the llvm-commits mailing list