[PATCH] ELF: Don't check relocations in non-loaded, non-alloced sections
H.J. Lu
hjl.tools@gmail.com
Wed Jun 3 01:29:16 GMT 2020
On Tue, Jun 2, 2020 at 5:06 PM Fangrui Song <i@maskray.me> wrote:
>
> I haven't really read the patch, but just wanted to express a point.
> It is sometimes useful to check relocations even for a non-SHF_ALLOC
> section. For example, a PC relative relocation type does not make
> sense from a non-SHF_ALLOC section referencing a SHF_ALLOC section.
>
> Conceptually, even if a non-SHF_ALLOC is loaded as part of the memory
> image, the distance between it and a SHF_ALLOC section may not be a
> constant, so the linker cannot reasonably resolve the relocation.
>
Since non-SHF_ALLOC sections have no impact on run-time behavior,
ld.so ignores dynamic relocations on non-SHF_ALLOC section. In
checking phase, relocations on non-SHF_ALLOC section shouldn't
alter other relocatitons against the same symbol. When resolving
such relocations, linker should ignore any relocation errors for such
relocations.
--
H.J.
More information about the Binutils
mailing list