[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
Mon Nov 18 13:51:54 PST 2024


================
@@ -1251,26 +1255,26 @@ void SymtabSection::emitStabs() {
 
       // We use 'originalIsec' to get the file id of the symbol since 'isec()'
       // might point to the merged ICF symbol's file
-      symbolsNeedingStabs.emplace_back(defined,
-                                       defined->originalIsec->getFile()->id);
+      Defined *funcBodySym = getFuncBodySym(defined);
----------------
ellishg wrote:

Do you plan to use `getFuncBodySym()` elsewhere? Because I think it'll be more readable to inline it here.
```suggestion
      Defined *funcBodySym = defined->identicalCodeFoldingKind == Symbol::ICFFoldKind::Thunk ? macho::getBodyForThunkFoldedSym(defined) : defined;
```


https://github.com/llvm/llvm-project/pull/116687


More information about the llvm-commits mailing list