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

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


On Tue, Jan 19, 2021 at 9:47 AM Szabolcs Nagy <szabolcs.nagy@arm.com> wrote:
>
> The 01/19/2021 09:42, H.J. Lu wrote:
> > On Tue, Jan 19, 2021 at 9:38 AM Szabolcs Nagy <szabolcs.nagy@arm.com> wrote:
> > >
> > > The 01/19/2021 09:10, H.J. Lu wrote:
> > > > 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.
> > >
> > > this piece of code is used for both static PIE and non-PIE,
> > > but we already require binutils >= 2.25 for building glibc,
> > > dropping weak should be fine.
> > >
> >
> > It is safer to check BUILD_PIE_DEFAULT when dropping
> > weak.
>
> ok.
>
> does static linking have weaker linker version requirement
> than building glibc?

Very unlikely.  But one may be forced to use the older linker
for some reason.

-- 
H.J.


More information about the Libc-alpha mailing list