[lld] [ELF] Add target-specific relocation scanning for x86 (PR #178846)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 12 21:59:33 PST 2026
MaskRay wrote:
> Looks like it broke a buildbot: [lab.llvm.org/buildbot#/builders/25/builds/15566](https://lab.llvm.org/buildbot/#/builders/25/builds/15566)
`lld/test/ELF/shared.s` failed in a ubsan build, which exposed a pre-existing issue
https://github.com/llvm/llvm-project/blob/a89e766ca63d61874138dd84b0e2eaf1f9d73d51/lld/ELF/Arch/X86.cpp#L137C1-L137C55
`return (loc[-1] & 0xc7) == 0x5 ? R_GOT : R_GOTPLT;` does not check whether `loc` is the first byte of an input section. The byte before the first input section is valid but should not be checked.
The new code changed it to `(sec.content().data()[offset - 1] & 0xc7) == 0x5`, where `offset == 0` would lead to a pointer unwrap failure. I'll add `offset &&`
https://github.com/llvm/llvm-project/pull/178846
More information about the llvm-commits
mailing list