[lld] [lld-macho] Fix compatibility between --icf=safe_thunks and --keep-icf-stabs (PR #116687)
Ellis Hoag via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 19 15:29:02 PST 2024
================
@@ -1204,6 +1205,17 @@ void SymtabSection::emitEndFunStab(Defined *defined) {
stabs.emplace_back(std::move(stab));
}
+// Given a pointer to a function symbol, return the symbol that points to the
+// actual function body that will go in the final binary. Generally this is the
+// symbol itself, but if the symbol was folded using a thunk, we retrieve the
+// target function body from the thunk.
+Defined *SymtabSection::getFuncBodySym(Defined *originalSym) {
+ if (originalSym->identicalCodeFoldingKind != Symbol::ICFFoldKind::Thunk)
----------------
ellishg wrote:
Oh sorry, I meant that you should flip the condition and the return. So that if it is a thunk, we return the thunk. Otherwise we return the original symbol.
https://github.com/llvm/llvm-project/pull/116687
More information about the llvm-commits
mailing list