[lld] [LLD][ELF] Skip non-SHF_ALLOC sections when checking max VA and max VA difference in relaxOnce() (PR #145863)
Mingjie Xu via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 26 23:10:16 PDT 2025
Enna1 wrote:
Thanks for the review!
> This is correct but can you edit /x86-64-gotpc-relax-too-far.s to make this testable?
Tried but didn't make it...
The max VA and max VA difference checks are for early return.
The real decision for not relaxing R_X86_64_(REX_)GOTPCRELX is made by checking `!isInt<32>(getRelocTargetVA)`.
Even if max VA or max VA difference in -pie/-shared is >= 2^31 (say the size of .strtab section is 2^31), `isInt<32>(getRelocTargetVA)` still can be true and R_X86_64_(REX_)GOTPCRELX will be relaxed.
I thinks current implementation doesn't have correctnees issue, but this change can remove some redundant `isInt<32>(getRelocTargetVA)` checks, so I didn't come up how to extend /x86-64-gotpc-relax-too-far.s to test this.
Do you have any suggestions? Thanks!
https://github.com/llvm/llvm-project/pull/145863
More information about the llvm-commits
mailing list