[PATCH] D85467: [lld-macho] Support larger dylib symbol ordinals in bindings

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 12 19:51:31 PDT 2020


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG180ad756ec5c: [lld-macho] Support larger dylib symbol ordinals in bindings (authored by int3).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85467

Files:
  lld/MachO/SyntheticSections.cpp


Index: lld/MachO/SyntheticSections.cpp
===================================================================
--- lld/MachO/SyntheticSections.cpp
+++ lld/MachO/SyntheticSections.cpp
@@ -148,8 +148,8 @@
       os << static_cast<uint8_t>(BIND_OPCODE_SET_DYLIB_ORDINAL_IMM |
                                  dysym.file->ordinal);
     } else {
-      error("TODO: Support larger dylib symbol ordinals");
-      return;
+      os << static_cast<uint8_t>(MachO::BIND_OPCODE_SET_DYLIB_ORDINAL_ULEB);
+      encodeULEB128(dysym.file->ordinal, os);
     }
     lastBinding.ordinal = dysym.file->ordinal;
   }
@@ -348,11 +348,13 @@
   uint64_t offset = in.lazyPointers->addr - dataSeg->firstSection()->addr +
                     sym.stubsIndex * WordSize;
   encodeULEB128(offset, os);
-  if (sym.file->ordinal <= MachO::BIND_IMMEDIATE_MASK)
+  if (sym.file->ordinal <= MachO::BIND_IMMEDIATE_MASK) {
     os << static_cast<uint8_t>(MachO::BIND_OPCODE_SET_DYLIB_ORDINAL_IMM |
                                sym.file->ordinal);
-  else
-    fatal("TODO: Support larger dylib symbol ordinals");
+  } else {
+    os << static_cast<uint8_t>(MachO::BIND_OPCODE_SET_DYLIB_ORDINAL_ULEB);
+    encodeULEB128(sym.file->ordinal, os);
+  }
 
   os << static_cast<uint8_t>(MachO::BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM)
      << sym.getName() << '\0'


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85467.285244.patch
Type: text/x-patch
Size: 1332 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200813/f8d66240/attachment.bin>


More information about the llvm-commits mailing list