[lld] [lld][ELF] Merge equivalent symbols found during ICF (PR #139493)
Pranav Kant via llvm-commits
llvm-commits at lists.llvm.org
Fri May 23 13:33:56 PDT 2025
pranavk wrote:
@MaskRay
> - The patch uses !isGlobal() (STB_GLOBAL), which should switch to isLocal(). STB_WEAK/STB_GNU_UNIQUE should be handled the same way as STB_GLOBAL.
Done.
> - Symbol merging is performed by scanning referended symbols (getRelocTargetSyms). Should we build a section-to-symbol map by scanning the file symbol table instead? In general, I want to reduce getRelocTargetSym calls.
Originally, we tried creating such a map in `variableEq` towards the end of that function but that didn't work because that function is called by multiple threads. We could serially try to create such a map at start of the ICF but I don't see much benefit of that.
> - The da->value + addA == db->value + addB condition in constantEq is not well-motivated (I doubt there is any benefit). Can probably switch to da->value == db->value && addA == addB and remove a isTrivialRelocation call.
Addressed separately above.
> - We should not move OffsetGetter and needsGot from Relocations.cpp. Most targets' getRelExpr don't need the loc argument. We don't need 100% accurate getRelExpr. I think we can pass a fake loc ensuring validity of loc[-1] (used by X86.cpp) and loc[3] (used by LoongArch). Then we don't need OffsetGetter at all.
Done. Thanks for suggestion here.
https://github.com/llvm/llvm-project/pull/139493
More information about the llvm-commits
mailing list