This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: PING^1: [PATCH 1/2] Mark ld.so internal mmap functions hidden in ld.so
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- Cc: GNU C Library <libc-alpha at sourceware dot org>
- Date: Wed, 6 Jan 2016 10:53:55 -0800
- Subject: Re: PING^1: [PATCH 1/2] Mark ld.so internal mmap functions hidden in ld.so
- Authentication-results: sourceware.org; auth=none
- References: <CAMe9rOrx6tSCzMvGeoidvFSsHEUwB_5bWy1mQPT9bVxvsbvdeQ at mail dot gmail dot com> <568D5E27 dot 3000905 at linaro dot org>
On Wed, Jan 6, 2016 at 10:34 AM, Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:
> Checking of the dissassemble ld.so for i686 I see no PLT stub
> being generated for mmap or it being called through it:
>
> $ objdump -d elf/ld.so
> [...]
> 5cdc: 89 04 24 mov %eax,(%esp)
> 5cdf: e8 fc 49 01 00 call 1a6e0 <__mmap>
> [...]
>
> Also regarding mmap I see that generated assembly generated is
> not different without the patch. I do see that for the part 02
> of the patch for the __libc_{open,close} with the patch a
> call to __x86.get_pc_thunk.bx is removed (which is the intention
> of the patch).
>
> Am I missing something here?
>
Since __mmap is local in /lib/ld-linux.so.2:
329: 00019370 86 FUNC LOCAL DEFAULT 11 __mmap
linker won't use PLT. But since we don't tell GCC about it,
GCC will assume PLT is used:
000052a5 00023e04 R_386_PLT32 00000000 __mmap
which reserves EBX for PLT. With my patch, you will see
000052a5 00023e04 R_386_PC32 00000000 __mmap
which frees EBX for other use.
--
H.J.