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

* [Bug libc/18078] FAIL: elf/check-localplt with ld from binutils 2.26
  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 ` cvs-commit at gcc dot gnu.org
  2015-03-11 14:02 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2015-03-09 23:04 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #1 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/pr18078 has been created
        at  9d758fcf853188107fab5a788af5c295f5e5e2ce (commit)

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=9d758fcf853188107fab5a788af5c295f5e5e2ce

commit 9d758fcf853188107fab5a788af5c295f5e5e2ce
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Mar 9 13:22:01 2015 -0700

    Mark PLT entries for free and malloc options

    On x86, linker in binutils 2.26 and newer consolidates R_*_JUMP_SLOT with
    R_*_GLOB_DAT relocation against the same symbol.  It makes R_*_JUMP_SLOT
    relocations against free and malloc optional.  We should mark PLT entries
    for free and malloc optional.

        [BZ #18078]
        * sysdeps/unix/sysv/linux/i386/localplt.data: Mark PLT entries
        for free and malloc optional.
        * sysdeps/x86_64/localplt.data: New file.

-----------------------------------------------------------------------

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


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

* [Bug libc/18078] FAIL: elf/check-localplt with ld from binutils 2.26
  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
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2015-03-11 14:02 UTC (permalink / raw)
  To: glibc-bugs

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

--- 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/pr18078 has been created
        at  5dfc212622b0dbc03626def225bb805ba0c55760 (commit)

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=5dfc212622b0dbc03626def225bb805ba0c55760

commit 5dfc212622b0dbc03626def225bb805ba0c55760
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Mar 9 13:22:01 2015 -0700

    Mark PLT entries for free and malloc options

    On x86, linker in binutils 2.26 and newer consolidates R_*_JUMP_SLOT with
    R_*_GLOB_DAT relocation against the same symbol.  It makes R_*_JUMP_SLOT
    relocations against free and malloc optional.  We should mark PLT entries
    for free and malloc optional.

    Check DT_RELA/DT_REL

        [BZ #18078]
        * sysdeps/unix/sysv/linux/i386/localplt.data: Mark PLT entries
        for free and malloc optional.
        * sysdeps/x86_64/localplt.data: New file.

-----------------------------------------------------------------------

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


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

* [Bug libc/18078] FAIL: elf/check-localplt with ld from binutils 2.26
  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
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2015-03-11 17:03 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #3 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/pr18078 has been created
        at  688e958c81f230b5860b57590f45f1bc729ba2cf (commit)

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=688e958c81f230b5860b57590f45f1bc729ba2cf

commit 688e958c81f230b5860b57590f45f1bc729ba2cf
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Mar 9 13:22:01 2015 -0700

    Extend local PLT reference check

    On x86, linker in binutils 2.26 and newer consolidates R_*_JUMP_SLOT with
    R_*_GLOB_DAT relocation against the same symbol.  This patch extends
    local PLT reference check to support alternate relocations.

        [BZ #18078]
        * scripts/check-localplt.awk: Support alternate relocations.
        * scripts/localplt.awk: Also check relocations in DT_RELA/DT_REL
        sections.
        * sysdeps/unix/sysv/linux/i386/localplt.data: Mark free and
        malloc entries with + REL R_386_GLOB_DAT.
        * sysdeps/x86_64/localplt.data: New file.

-----------------------------------------------------------------------

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


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

* [Bug libc/18078] FAIL: elf/check-localplt with ld from binutils 2.26
  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
                   ` (2 preceding siblings ...)
  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
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2015-07-29 19:06 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #4 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, master has been updated
       via  9637d8a253493be471d9a71640e91349f7a8a050 (commit)
      from  febce2ac5f46a0d5c67ca8b535a028425d421be4 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=9637d8a253493be471d9a71640e91349f7a8a050

commit 9637d8a253493be471d9a71640e91349f7a8a050
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Jul 29 11:57:54 2015 -0700

    Extend local PLT reference check

    On x86, linker in binutils 2.26 and newer consolidates R_*_JUMP_SLOT with
    R_*_GLOB_DAT relocation against the same symbol.  This patch extends
    local PLT reference check to support alternate relocations.

        [BZ #18078]
        * scripts/check-localplt.awk: Support alternate relocations.
        * scripts/localplt.awk: Also check relocations in DT_RELA/DT_REL
        sections.
        * sysdeps/unix/sysv/linux/i386/localplt.data: Mark free and
        malloc entries with + REL R_386_GLOB_DAT.
        * sysdeps/x86_64/localplt.data: New file.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                                  |   10 ++++++
 NEWS                                       |   22 ++++++------
 scripts/check-localplt.awk                 |   40 ++++++++++++++++++++---
 scripts/localplt.awk                       |   47 ++++++++++++++++++++++++++++
 sysdeps/unix/sysv/linux/i386/localplt.data |    8 +++--
 sysdeps/{generic => x86_64}/localplt.data  |    8 +++--
 6 files changed, 113 insertions(+), 22 deletions(-)
 copy sysdeps/{generic => x86_64}/localplt.data (66%)

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


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

* [Bug libc/18078] FAIL: elf/check-localplt with ld from binutils 2.26
  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
                   ` (3 preceding siblings ...)
  2015-07-29 19:06 ` cvs-commit at gcc dot gnu.org
@ 2015-07-29 19:10 ` hjl.tools at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: hjl.tools at gmail dot com @ 2015-07-29 19:10 UTC (permalink / raw)
  To: glibc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |2.22

--- Comment #5 from H.J. Lu <hjl.tools at gmail dot com> ---
Fixed.

-- 
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).