[PATCH] csu: Skip ARCH_SETUP_IREL if _dl_relocate_static_pie applied IRELATIVE relocations [BZ #27164]

Fāng-ruì Sòng maskray@google.com
Mon Sep 6 06:30:25 GMT 2021


On Tue, Jul 13, 2021 at 7:15 PM Siddhesh Poyarekar <siddhesh@gotplt.org> wrote:
>
> On 7/14/21 4:36 AM, Fangrui Song wrote:
> > Please see the sentence from the first message
> > "In addition, this enables a future simplification to GNU ld: we can
> > drop a linker script difference between -no-pie and -pie."
> >
> > This is the only difference other than image base difference.
>
> I did see the first message and indeed, all messages in the thread
> before asking that question.  Perhaps my wording wasn't specific enough:
> what is the benefit to *users* of having those symbols in dynamic
> binaries?  If the only reason what you mentioned in your first email,
> then this patch proposes to add runtime overhead to make what is
> essentially a cosmetic difference to GNU ld.  That doesn't make sense.
>
> In that context, lld behaviour needs to be changed since it adds symbols
> specifically meant to enable ifunc resolution in non-pie static binaries
> to all generated binaries without any known benefit to end user
> applications.
>
> Siddhesh

Circling back... Finally I conceded and changed LLD 13.0.0 to not
define __rela_iplt_start/__rela_iplt_end for -pie, for the sake of
users.

For the record, Android bionic uses the same IRELATIVE code path for
both static non-pie and static pie.
They had to adapt to undefined __rela_iplt_start for static pie:
https://r.android.com/1809796

I described this issue in detail in a chapter of
https://maskray.me/blog/2021-09-05-build-glibc-with-lld


More information about the Libc-alpha mailing list