RFC: [PATCH] ELF: Don't require section header on ELF objects

H.J. Lu hjl.tools@gmail.com
Mon Mar 9 13:54:04 GMT 2020


On Mon, Mar 9, 2020 at 6:46 AM Kaylee Blake <klkblake@gmail.com> wrote:
>
> On 9/3/20 11:59 pm, Florian Weimer wrote:
> > * Kaylee Blake:
> >
> >>> I think that's conceptually the wrong thing to do for ELF, sorry.  If
> >>> there is no section header, the object should be unlinkable.  The
> >>> linker should not use the dynamic segment to locate the symbol
> >>> information, only the dynamic section (in case the link ABI and
> >>> run-time ABI are different).
> >>
> >> I'm confused by your comment about link and run-time ABIs differing;
> >> surely if the ABI at runtime differs from the ABI at link time, you are
> >> just going to crash at runtime?
> >
> > No, the typical application are fewer symbols in the DSO at link time
> > than at load time, for example for linking against an older version of
> > glibc than is installed on the system.
>
> How is that being done? On my machine, the symbols in glibc found
> through the section header are identical to the ones found through the
> dynamic array, except that some of the latter are missing symbol
> versions, which I think is due to this patch not looking them up? (I'm
> not actually sure if this patch does that or not).
>

Symbol versioning is a real problem.  We need to reconstruct all dynamic
symbol info from PT_DYNAMIC segment.   I am running into a wrong
output problem on i386.  I am leaning toward Florian's suggestion to
only add --remove-section-header and -z nosectionheader without
reconstructing dynamic symbol info from PT_DYNAMIC segment.

-- 
H.J.



More information about the Binutils mailing list