This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug dynamic-link/21609] Incomplete workaround for GCC __tls_get_addr ABI issue on x86-64


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

--- Comment #5 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/pr21609/master has been created
        at  ed9e8b00cd277979c6368467f93947e45eb8fc30 (commit)

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

commit ed9e8b00cd277979c6368467f93947e45eb8fc30
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Jul 5 04:46:45 2017 -0700

    x86-64: Redirect __tls_get_addr to ___tls_get_addr

    On x86-64, __tls_get_addr realigns stack to support GCC older than GCC
    4.9.4:

    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58066

    ___tls_get_addr is the alternative x86-64 runtime interface to TLS with
    aligned stack.  If linker treats ___tls_get_addr just like __tls_get_addr
    and the weakref assembly directive is extended to redirect __tls_get_addr
    to ___tls_get_addr, we can replace reference to __tls_get_addr with
    ___tls_get_addr if GCC aligns stack for __tls_get_addr, but doesn't
    support ___tls_get_addr.

        * sysdeps/x86_64/Makefile (+cflags): New.  Add
        -include $(..)sysdeps/x86_64/tls_get_addr.h if __tls_get_addr
        can be redireted to ___tls_get_addr.
        * sysdeps/x86_64/configure.ac: Check if GCC supports
        ___tls_get_addr.  If not, check if __tls_get_addr to
        ___tls_get_addr redirection works.
        * sysdeps/x86_64/configure: Regenerated.
        * sysdeps/x86_64/tls_get_addr.h: New file.

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=639d0d5203cc112dc775d030ad794217a8d34025

commit 639d0d5203cc112dc775d030ad794217a8d34025
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Jul 4 09:24:09 2017 -0700

    x86-64: Export ___tls_get_addr

    On x86-64, __tls_get_addr is changed to realign stack to support GCC
    older than GCC 4.9.4:

    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58066

    This patch exports ___tls_get_addr as the alternative x86-64 runtime
    interface to TLS with aligned stack.

    This requires linker support for TLS optimization with ___tls_get_addr.
    GCC 4.9.4 and newer can generate call to ___tls_get_addr, instead of
    __tls_get_addr.  We can use the weakref assembly directive to redirect
    __tls_get_addr to ___tls_get_addr if linker supports ___tls_get_addr and
    GCC doesn't.

        * sysdeps/unix/sysv/linux/x86_64/64/ld.abilist: Add GLIBC_2.26
        and ___tls_get_addr.
        * sysdeps/unix/sysv/linux/x86_64/x32/ld.abilist: Likewise.
        * sysdeps/x86_64/Versions: Export ___tls_get_addr in GLIBC_2.26.

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=08659292af38dffbbec9f07103708f8b5ea48e4c

commit 08659292af38dffbbec9f07103708f8b5ea48e4c
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Jul 3 13:16:57 2017 -0700

    x86-64: Align the stack in __tls_get_addr [BZ #21609]

    This change forces realignment of the stack pointer in __tls_get_addr, so
    that binaries compiled by GCCs older than GCC 4.9:

    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58066

    continue to work even if vector instructions are used in glibc which
    require the ABI stack realignment.

    __tls_get_addr_slow is added to handle the slow paths in the default
    implementation of__tls_get_addr in elf/dl-tls.c.  The new __tls_get_addr
    calls __tls_get_addr_slow after realigning the stack.  Internal calls
    within ld.so go directly to the default implementation of __tls_get_addr
    because they do not need stack realignment.

    2017-07-04  Florian Weimer  <fweimer@redhat.com>
            H.J. Lu  <hongjiu.lu@intel.com>

        [BZ #21609]
        * sysdeps/x86_64/Makefile (sysdep-dl-routines): Add tls_get_addr.
        (gen-as-const-headers): Add rtld-offsets.sym.
        * sysdeps/x86_64/dl-tls.c: New file.
        * sysdeps/x86_64/rtld-offsets.sym: Likwise.
        * sysdeps/x86_64/tls_get_addr.S: Likewise.
        * sysdeps/x86_64/dl-tls.h: Add multiple inclusion guards.
        * sysdeps/x86_64/tlsdesc.sym (TI_MODULE_OFFSET): New.
        (TI_OFFSET_OFFSET): Likwise.

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

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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]