Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions lld/MachO/SymbolTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,15 @@ static void transplantSymbolsAtOffset(InputSection *fromIsec,
InputSection *toIsec, Defined *skip,
uint64_t fromOff, uint64_t toOff) {
// Ensure the symbols will still be in address order after our insertions.
auto insertIt = llvm::upper_bound(toIsec->symbols, toOff,
[](uint64_t off, const Symbol *s) {
return cast<Defined>(s)->value < off;
});
auto symSucceedsOff = [](uint64_t off, const Symbol *s) {
return cast<Defined>(s)->value > off;
};
assert(std::is_partitioned(toIsec->symbols.begin(), toIsec->symbols.end(),
[symSucceedsOff, toOff](const Symbol *s) {
return !symSucceedsOff(toOff, s);
}) &&
"Symbols in toIsec must be partitioned by toOff.");
auto insertIt = llvm::upper_bound(toIsec->symbols, toOff, symSucceedsOff);
llvm::erase_if(fromIsec->symbols, [&](Symbol *s) {
auto *d = cast<Defined>(s);
if (d->value != fromOff)
Expand Down
Loading