This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PLT entries for STT_GNU_IFUNC in static binaries
- From: Ian Lance Taylor <iant at google dot com>
- To: vijay nag <vijunag at gmail dot com>
- Cc: Andreas Schwab <schwab at suse dot de>, Binutils <binutils at sourceware dot org>
- Date: Thu, 26 Sep 2013 09:26:18 -0700
- Subject: Re: PLT entries for STT_GNU_IFUNC in static binaries
- Authentication-results: sourceware.org; auth=none
- References: <CAKhyrx9x8LOQeVHkJj1weNPx-FkZeQ=7sbpccPNZVGph6PEHnA at mail dot gmail dot com> <mvmtxh7zyo5 dot fsf at hawking dot suse dot de> <CAKhyrx9MoWcZVTtxrCAD=Mk21_TCh303CEv7Z6JdeQpPhm-dUQ at mail dot gmail dot com>
On Thu, Sep 26, 2013 at 3:12 AM, vijay nag <vijunag@gmail.com> wrote:
> On Thu, Sep 26, 2013 at 3:34 PM, Andreas Schwab <schwab@suse.de> wrote:
>> vijay nag <vijunag@gmail.com> writes:
>>
>>> Why this difference in "objdump -d" output of IRELATIVE PLT entries
>>> for static and dynamic executable ?
>>>
>>> Doesn't static executable possess PLT symbol information ?
>>
>> A static executable doesn't have a dynamic symbol table where these
>> synthetic symbols are created from.
>>
>> Andreas.
>>
>> --
>> Andreas Schwab, SUSE Labs, schwab@suse.de
>> GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
>> "And now for something completely different."
>
> gdb is unable to single-step in a static executable after the program
> jumps into PLT to execute gnu_ifunc.
> How is gdb supposed to handle it ?
>
> (gdb) n
> 273 argv0short = strrchr(argv[0], '/');
> (gdb) n
> 0x08048430 in ?? ()
> (gdb) n
> Cannot find bounds of current function
> (gdb) n
> Cannot find bounds of current function
> (gdb)
When doing a dynamic link the linker resolves functions like strrchr
to the PLT entry. When doing a static link it does not. To make this
work we will have to modify the linker to emit symbol table entries
for the PLT entries that it creates for IFUNC symbols when doing a
static link.
Ian