This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug dynamic-link/18422] elf/tst-audit tests fail without PLT entries
- From: "cvs-commit at gcc dot gnu.org" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Mon, 25 May 2015 12:03:05 +0000
- Subject: [Bug dynamic-link/18422] elf/tst-audit tests fail without PLT entries
- Auto-submitted: auto-generated
- References: <bug-18422-131 at http dot sourceware dot org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=18422
--- Comment #2 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, hjl/pr18422 has been created
at df5dc4f32dc00eecd24534275ad82e1a3b49335a (commit)
- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=df5dc4f32dc00eecd24534275ad82e1a3b49335a
commit df5dc4f32dc00eecd24534275ad82e1a3b49335a
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Sat May 23 06:05:19 2015 -0700
Don't build ld.so with -Wl,-z,now
PLT entries aren't required when -z now used. Linker on master with:
commit 25070364b0ce33eed46aa5d78ebebbec6accec7e
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Sat May 16 07:00:21 2015 -0700
Don't generate PLT relocations for now binding
There is no need for PLT relocations with -z now. We can use GOT
relocations, which take less space, instead and replace 16-byte .plt
entres with 8-byte .plt.got entries.
bfd/
* elf32-i386.c (elf_i386_check_relocs): Create .plt.got section
for now binding.
(elf_i386_allocate_dynrelocs): Use .plt.got section for now
binding.
* elf64-x86-64.c (elf_x86_64_check_relocs): Create .plt.got
section for now binding.
(elf_x86_64_allocate_dynrelocs): Use .plt.got section for now
binding.
won't generate PLT entries with -z now. elf/tst-audit2.c has
/* This calloc definition will be called by the dynamic linker itself.
We test that it has initialized our TLS block by the time it does so.
*/
void *
calloc (size_t n, size_t m)
{
if (magic[0] != MAGIC1 || magic[1] != MAGIC2)
{
printf ("{%x, %x} != {%x, %x}\n", magic[0], magic[1], MAGIC1,
MAGIC2);
abort ();
}
magic[0] = MAGIC2;
magic[1] = MAGIC1;
Since ld.so is built with -z now, there are no PLT relocations and this
calloc won't be used:
Relocation section '.rela.dyn' at offset 0x66c contains 16 entries:
Offset Info Type Sym.Value Sym. Name + Addend
00222e88 00000008 R_X86_64_RELATIVE 10970
00222e8c 00000008 R_X86_64_RELATIVE f8f0
00222e90 00000008 R_X86_64_RELATIVE f6c0
00222e94 00000008 R_X86_64_RELATIVE 11bd0
00222e98 00000008 R_X86_64_RELATIVE a1b0
00222e9c 00000008 R_X86_64_RELATIVE 130c0
00222ea0 00000008 R_X86_64_RELATIVE 13c50
00222ea4 00000008 R_X86_64_RELATIVE 15fc0
00222ea8 00000008 R_X86_64_RELATIVE 12cd0
00222eac 00000008 R_X86_64_RELATIVE 17f90
00222fbc 00000a06 R_X86_64_GLOB_DAT 00018230
__libc_memalign@@GLIBC_2.16 + 0
00222fc4 00001506 R_X86_64_GLOB_DAT 00018300 malloc@@GLIBC_2.16 + 0
00222fcc 00000d06 R_X86_64_GLOB_DAT 00018310 calloc@@GLIBC_2.16 + 0
00222fd4 00000506 R_X86_64_GLOB_DAT 000184a0 realloc@@GLIBC_2.16 + 0
00222fdc 00000706 R_X86_64_GLOB_DAT 002239a0 _r_debug@@GLIBC_2.16 + 0
00222fe4 00000406 R_X86_64_GLOB_DAT 00018340 free@@GLIBC_2.16 + 0
Assuming we do want to keep PLT relocations in ld.so so that malloc
functions in ld.so can be overridden, ld.so should be built with -z now.
There is no reason to build ld.so with -z now since ld.so is the one
doing BIND_NOW. The only thing we get with -z now on ld.so is DT tag:
0x0000000000000018 (BIND_NOW)
0x000000006ffffffb (FLAGS_1) Flags: NOW
This patch removes -Wl,-z,now from ld.so build.
[BZ #18422]
* elf/Makefile (z-now-yes): Removed.
($(objpfx)ld.so): Remove $(z-now-$(bind-now)).
-----------------------------------------------------------------------
--
You are receiving this mail because:
You are on the CC list for the bug.