[lld] [lld][ICF] Prevent merging two sections when they point to non-globals (PR #136641)

Peter Smith via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 22 06:07:47 PDT 2025


================
@@ -356,6 +357,22 @@ static SmallVector<Symbol *> getRelocTargetSyms(const InputSection *sec) {
   return getReloc(sec, rel.relas);
 }
 
+// Checks if relocation has semantics beyond just the offset. We identify
+// such relocations to prevent ICF to preserve correctness.
+static bool isTrivialRelocationType(uint16_t emachine, RelType type) {
----------------
smithp35 wrote:

Could be worth stating what our current definition of non-trivial is?

I think we're currently looking at relocations that are GOT entry generating, and are part of a sequence of relocated instructions.

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


More information about the llvm-commits mailing list