public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/18078] New: FAIL: elf/check-localplt with ld from binutils 2.26
@ 2015-03-03 17:19 hjl.tools at gmail dot com
  2015-03-09 23:04 ` [Bug libc/18078] " cvs-commit at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: hjl.tools at gmail dot com @ 2015-03-03 17:19 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=18078

            Bug ID: 18078
           Summary: FAIL: elf/check-localplt with ld from binutils 2.26
           Product: glibc
           Version: 2.21
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: hjl.tools at gmail dot com
                CC: drepper.fsp at gmail dot com

On x86, using linker with

commit dd7e64d45b317128f5fe813a8da0b13b4ad046ae
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Nov 25 05:05:39 2014 -0800

    Optimize out i386/x86-64 JUMP_SLOT relocation

    When there are both PLT and GOT references to the same function symbol,
    linker will create a GOTPLT slot for PLT entry and a GOT slot for GOT
    reference.  A run-time JUMP_SLOT relocation is created to update the
    GOTPLT slot and a run-time GLOB_DAT relocation is created to update the
    GOT slot.  Both JUMP_SLOT and GLOB_DAT relocations will apply the same
    symbol value to GOTPLT and GOT slots, respectively, at run-time.

    This optimization combines GOTPLT and GOT slots into a single GOT slot
    and removes the run-time JUMP_SLOT relocation.  It replaces the regular
    PLT entry:

      indirect jump  [GOTPLT slot]
      push     relocation index
      jump     PLT0

    with an GOT PLT entry with an indirect jump via the GOT slot:

      indirect jump  [GOT slot]
      nop

    and resolves PLT reference to the GOT PLT entry.

    We must avoid this optimization if pointer equality is needed since
    we don't clear symbol value in this case and the dynamic linker won't
    update the GOT slot.  Otherwise, the resulting binary will get into an
    infinite loop at run-time.

I got

FAIL: elf/check-localplt

from

[hjl@gnu-18 elf]$ LC_ALL=C gawk -f ../scripts/localplt.awk
/export/build/gnu/glibc-pie/build-x86_64-linux/libc.so.jmprel
/export/build/gnu/glibc-pie/build-x86_64-linux/elf/ld.so.jmprel
/export/build/gnu/glibc-pie/build-x86_64-linux/math/libm.so.jmprel
/export/build/gnu/glibc-pie/build-x86_64-linux/rt/librt.so.jmprel
/export/build/gnu/glibc-pie/build-x86_64-linux/dlfcn/libdl.so.jmprel
/export/build/gnu/glibc-pie/build-x86_64-linux/resolv/libresolv.so.jmprel
/export/build/gnu/glibc-pie/build-x86_64-linux/crypt/libcrypt.so.jmprel
/export/build/gnu/glibc-pie/build-x86_64-linux/nptl/libpthread.so.jmprel | \
>   LC_ALL=C gawk -f ../scripts/check-localplt.awk ../sysdeps/generic/localplt.data -
Missing required PLT reference: ld.so: free
Missing required PLT reference: libc.so: malloc
Missing required PLT reference: libc.so: free
[hjl@gnu-18 elf]$ 

Here ld optimized out R_X86_64_JUMP_SLOT:

[hjl@gnu-18 build-x86_64-linux]$ readelf -rW elf/ld.so | grep free
0000000000221fe8  0000000600000006 R_X86_64_GLOB_DAT      0000000000017120
free@@GLIBC_2.2.5 + 0
[hjl@gnu-18 build-x86_64-linux]$ readelf -rW elf/ld.so | grep free
0000000000221fe8  0000000600000006 R_X86_64_GLOB_DAT      0000000000017120
free@@GLIBC_2.2.5 + 0
[hjl@gnu-18 build-x86_64-linux]$ readelf -rW libc.so | grep free
000000000039cee0  000000d500000006 R_X86_64_GLOB_DAT      000000000039f9a8
__free_hook@@GLIBC_2.2.5 + 0
000000000039cf90  000008a400000006 R_X86_64_GLOB_DAT      000000000007ae40
free@@GLIBC_2.2.5 + 0
[hjl@gnu-18 build-x86_64-linux]$ readelf -rW libc.so | grep malloc
000000000039cdb0  000006ec00000006 R_X86_64_GLOB_DAT      000000000039f9b0
__malloc_initialize_hook@@GLIBC_2.2.5 + 0
000000000039ce30  0000049700000006 R_X86_64_GLOB_DAT      000000000007a770
malloc@@GLIBC_2.2.5 + 0
000000000039ced8  0000043900000006 R_X86_64_GLOB_DAT      000000000039dbd0
__malloc_hook@@GLIBC_2.2.5 + 0
[hjl@gnu-18 build-x86_64-linux]$

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-07-29 19:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-03 17:19 [Bug libc/18078] New: FAIL: elf/check-localplt with ld from binutils 2.26 hjl.tools at gmail dot com
2015-03-09 23:04 ` [Bug libc/18078] " cvs-commit at gcc dot gnu.org
2015-03-11 14:02 ` cvs-commit at gcc dot gnu.org
2015-03-11 17:03 ` cvs-commit at gcc dot gnu.org
2015-07-29 19:06 ` cvs-commit at gcc dot gnu.org
2015-07-29 19:10 ` hjl.tools at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).