[lld] [lld][MachO] Fix symbol inseration in `transplantSymbolsAtOffset` (PR #120737)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 20 06:13:23 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lld
Author: Carlo Cabrera (carlocab)
<details>
<summary>Changes</summary>
The existing comparison does not insert symbols in the intended place.
Unfortunately, it is not very clear how to test this. Suggestions
appreciated.
Closes #<!-- -->120559.
---
Full diff: https://github.com/llvm/llvm-project/pull/120737.diff
1 Files Affected:
- (modified) lld/MachO/SymbolTable.cpp (+1-1)
``````````diff
diff --git a/lld/MachO/SymbolTable.cpp b/lld/MachO/SymbolTable.cpp
index f0a92da8777e13..36e421b52abcac 100644
--- a/lld/MachO/SymbolTable.cpp
+++ b/lld/MachO/SymbolTable.cpp
@@ -69,7 +69,7 @@ static void transplantSymbolsAtOffset(InputSection *fromIsec,
// 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;
+ return cast<Defined>(s)->value > off;
});
llvm::erase_if(fromIsec->symbols, [&](Symbol *s) {
auto *d = cast<Defined>(s);
``````````
</details>
https://github.com/llvm/llvm-project/pull/120737
More information about the llvm-commits
mailing list