[lld] [LLD][AArch64] Implement relaxOnce to avoid dead GOT entries for relaxed ADRP+LDR (PR #224370)

Peter Smith via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 21 03:03:34 PDT 2026


smithp35 wrote:

The `All-or-nothing` property is important, as there can be some code (GCC seems to be the culprit) that can jump into the middle of an ADRP, ADD to reuse part of the sequence. If one part is in the GOT and the other is not (or vice-versa) then we're likely to get a code-gen fault.

Not got any great ideas on how to avoid the performance impact of rescanning the relocations, possible that these could be cached in pass 1, so that only the necessary relocs needed to be rescanned. There's also a possibility of a command-line option to disable shrinking of the GOT so that only pass 1 needs to be run.

Although not a problem today as there's only one GOT after all the code, if the multi-GOT code-model (GOT per N GiB) is accepted, then we'll need to be careful about interactions with GOT and Thunk size causing many more patches. For example, add Thunks, GOT size increases, branches across GOT go out of range needing more thunks, etc.

While I can't speak for MaskRay, I'm wondering if there's a better way to work towards what's needed for large binaries. In a single PR there's often not enough context or data to evaluate the patch. Perhaps worth discussing at the next Large Binaries Working group https://discourse.llvm.org/t/rfc-forming-a-massive-binaries-working-group-in-lld/91031 .





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


More information about the llvm-commits mailing list