[PATCH] D85467: [lld-macho] Support larger dylib symbol ordinals in bindings
Jez Ng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 6 12:33:02 PDT 2020
int3 created this revision.
int3 added a reviewer: lld-macho.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
int3 requested review of this revision.
Do folks care if we don't have a test for this? Creating 16
dylibs to trigger this straightforward code path seems a little tedious
Repository:
rG LLVM Github Monorepo
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.283704.patch
Type: text/x-patch
Size: 1332 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200806/27cb15c5/attachment.bin>
More information about the llvm-commits
mailing list