[lld] [lld][ELF] Merge equivalent symbols found during ICF (PR #139493)
Reid Kleckner via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 10 16:33:54 PDT 2025
rnk wrote:
> If I were designing an ABI, I would simply disallow GOT code sequences that span multiple sections.
Sure, but we have to live with the ABI we have, not the one we want.
> So I don't think the ABI is going to mandate that the outliner be changed.
... and I think that's a second opinion supporting the position that what LLD is doing right now isn't correct.
----
Standing back, I feel like this is blocked on making the right tradeoff between corner-case correctness and architectural simplicity/complexity. Usually in the toolchain space I make the argument that "correctness comes first, we can always simplify or optimize later", and I think that applies in this instance. Is there a simpler way that we could bail out of doing ICF on GOT relocations altogether? Is there some other compromise we could be making in ICF that achieves simplicity while making it less powerful in the presence of GOT-using relocations?
Somehow, I feel like this is part of the origin of the conceptual bug: we have relocations that refer to the *GOT entry* for symbol `foo`, which is not actually in the section that contains `foo`, and ICF has accidentally abstracted away that detail.
The obvious recommended compromise on the table is "don't do that" (teach the machine outliner to stop separating these relocations), but this leaves a latent correctness issue, and I'm not really comfortable with that.
https://github.com/llvm/llvm-project/pull/139493
More information about the llvm-commits
mailing list