This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH] Don't use hidden visibility in libc.a with PIE on i386
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: GNU C Library <libc-alpha at sourceware dot org>
- Date: Wed, 23 Aug 2017 05:25:38 -0700
- Subject: Re: [PATCH] Don't use hidden visibility in libc.a with PIE on i386
- Authentication-results: sourceware.org; auth=none
- References: <20170822224425.GA29673@gmail.com> <email@example.com>
On Wed, Aug 23, 2017 at 2:23 AM, Florian Weimer <firstname.lastname@example.org> wrote:
> On 08/23/2017 12:44 AM, H.J. Lu wrote:
>> On i386, when multi-arch is enabled, all external functions must be
>> called via PIC PLT in PIE, which requires setting up EBX register,
>> since they may be IFUNC functions.
> This explanation does not make sense to me. Could you elaborate further?
When a linker detects a call to a hidden IFUNC function, foo, it will create a
PLT entry and resolve
On i386, there are 2 kinds of PLT:
80499a0: ff 25 0c 00 22 08 jmp *0x822000c
80499a6: 68 00 00 00 00 push $0x0
80499ab: e9 e0 ff ff ff jmp 8049990 <.plt>
This is used for non-PIC binary since the address of GOT is fixed.
2. PIC PLT:
178a0: ff a3 0c 00 00 00 jmp *0xc(%ebx)
178a6: 68 00 00 00 00 push $0x0
178ab: e9 e0 ff ff ff jmp 17890 <.plt>
This is used for PIC binary since the address of GOT is in EBX.
For non-PIC binary, it is OK to turn
since GOT is at the fixed address. But for PIE, it isn't OK to
since PIE uses PIC PLT and EBX doesn't have the address of