[lld] 180ad75 - [lld-macho] Support larger dylib symbol ordinals in bindings
Jez Ng via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 12 19:51:09 PDT 2020
Author: Jez Ng
Date: 2020-08-12T19:50:25-07:00
New Revision: 180ad756ec5c41b7771404a5da13af7f268f4859
URL: https://github.com/llvm/llvm-project/commit/180ad756ec5c41b7771404a5da13af7f268f4859
DIFF: https://github.com/llvm/llvm-project/commit/180ad756ec5c41b7771404a5da13af7f268f4859.diff
LOG: [lld-macho] Support larger dylib symbol ordinals in bindings
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
Reviewed By: #lld-macho, smeenai
Differential Revision: https://reviews.llvm.org/D85467
Added:
Modified:
lld/MachO/SyntheticSections.cpp
Removed:
################################################################################
diff --git a/lld/MachO/SyntheticSections.cpp b/lld/MachO/SyntheticSections.cpp
index a4ab454ab2eb..9876b9ddad37 100644
--- a/lld/MachO/SyntheticSections.cpp
+++ b/lld/MachO/SyntheticSections.cpp
@@ -148,8 +148,8 @@ static void encodeBinding(const DylibSymbol &dysym, const OutputSection *osec,
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 @@ uint32_t LazyBindingSection::encode(const DylibSymbol &sym) {
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'
More information about the llvm-commits
mailing list