This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: LD_PRELOAD doesn't work with dynamic object built with `-static-pie`
- From: Baojun Wang <wangbj at gmail dot com>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: libc-help at sourceware dot org
- Date: Mon, 17 Jun 2019 14:07:53 -0400
- Subject: Re: LD_PRELOAD doesn't work with dynamic object built with `-static-pie`
- References: <CAC+a-TY6WfN-f0_sJhBR0+D7MbeYaruwg0UPWRO2RMDB+x7Kiw@mail.gmail.com> <874l5ogxb2.fsf@oldenburg2.str.redhat.com>
Thank you for the clarification. I did turn on `LD_DEBUG` and was surprised
it didn't work.
On Tue, May 21, 2019 at 2:02 AM Florian Weimer <fweimer@redhat.com> wrote:
> * Baojun Wang:
>
> > I tried to build a shared object with `-static-pie`, and then used it as
> > `LD_PRELOAD`, but it didn't work, do you know why it failed?
>
> This will not work for multiple reasons. The static PIE object will not
> have a dynamic symbol table, so no interposition takes place. It also
> uses relocations which are not supported in ELF shared objects.
>
> glibc 2.30 will provide a clearer diagnostic for this, rejecting loading
> the object outright.
>
> Thanks,
> Florian
>