V3 [PATCH] ELF: Don't check relocations in non-loaded, non-alloced sections

H.J. Lu hjl.tools@gmail.com
Wed Jun 3 18:55:08 GMT 2020


On Wed, Jun 3, 2020 at 9:48 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Tue, Jun 02, 2020 at 06:29:16PM -0700, H.J. Lu wrote:
> > 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.
> >
> >
>
> Linker shouldn't ignore any relocation errors for such relocations.  But
> linker should resolve them to 0:
>
> https://sourceware.org/bugzilla/show_bug.cgi?id=26080
>
> Here is the updated patch.  OK for master?
>

Here is the updated patch to remove SEC_ALLOC check in
_bfd_mips_elf_check_relocs.

OK for master?

Thanks.

-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-ELF-Don-t-check-relocations-in-non-loaded-non-alloce.patch
Type: text/x-patch
Size: 21707 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20200603/e7163df1/attachment-0001.bin>


More information about the Binutils mailing list