[PATCH v4 08/10] csu: Move static pie self relocation later [BZ #27072]

H.J. Lu hjl.tools@gmail.com
Tue Jan 19 17:10:33 GMT 2021


On Tue, Jan 19, 2021 at 9:03 AM Szabolcs Nagy <szabolcs.nagy@arm.com> wrote:
>
> The 01/19/2021 08:47, H.J. Lu wrote:
> > On Tue, Jan 19, 2021 at 7:32 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > On Tue, Jan 19, 2021 at 7:24 AM Szabolcs Nagy <szabolcs.nagy@arm.com> wrote:
> > > > The 01/19/2021 06:48, H.J. Lu wrote:
> > > > > On Tue, Jan 19, 2021 at 6:37 AM Adhemerval Zanella via Libc-alpha
> > > > > <libc-alpha@sourceware.org> wrote:
> > > > > > On 19/01/2021 11:35, Szabolcs Nagy wrote:
> > > > > > > the problem is that _dl_phdr is used in ARCH_SETUP_TLS
> > > > > > > (to get the tls program headers) so the __ehdr_start
> > > > > > > magic should be before that (this only matters if auxv
> > > > > > > lacks AT_PHDR for some reason, which should not happen
> > > > > > > normally on linux, so testing won't show the problem)
> > > > > >
> > > > > > By normally do you mean it might happen on a specific kernel version
> > > > > > or is it architecture specific?
> > > >
> > > > i guess __ehdr_start symbol can be useful and with it
> > > > glibc does not have to depend on auxv (which an elf
> > > > loader like valgrind/qemu-user may get wrong)
> > > >
> > > > however it is only used as a fallback and on linux
> > > > AT_PHDR is always expected to be present. (i don't
> > > > know if this ever triggers)
> > >
> > > Only used on Hurd?
> >
> > Does arm64 linker always define __ehdr_start?  If yes, can you drop
> > "weak," to see if RELATIVE goes away?
>
> __ehdr_start support was added in binutils 2.23

We may assume binutils >= 2.33 when building for static PIE
since all static PIE linkers should define __ehdr_start.

Does lld define __ehdr_start?

> so i guess all supported binutils has it which
> means we can make it non-weak indeed.
>
> good idea.
>
> (we can also ignore auxv and rely on __ehdr_start only,
> but for now just making it non-weak should be fine.)
>


-- 
H.J.


More information about the Libc-alpha mailing list