This is the mail archive of the
mailing list for the glibc project.
Re: powerpc __tls_get_addr call optimization
- From: "Carlos O'Donell" <carlos at redhat dot com>
- To: Alan Modra <amodra at gmail dot com>, libc-alpha at sourceware dot org
- Date: Wed, 18 Mar 2015 13:07:32 -0400
- Subject: Re: powerpc __tls_get_addr call optimization
- Authentication-results: sourceware.org; auth=none
- References: <20150318061145 dot GE24573 at bubble dot grove dot modra dot org>
On 03/18/2015 02:11 AM, Alan Modra wrote:
> Now that Alex's fixes for static TLS have gone in, I figure it's worth
> revisiting an old patch of mine.
I'm not against this patch, but it certainly seems like you would be
better served by just implementing tls descriptors?
Do you have a reference to the binutils patch?
> This patch is glibc support for a PowerPC TLS optimization, inspired
> by Alexandre Oliva's TLS optimization for other processors,
> In essence, this optimization uses a zero module id in the TLS
> descriptor to indicate that a TLS variable is allocated space in the
> static TLS area. A special plt call linker stub for __tls_get_addr
> checks for such a TLS descriptor and if found, returns the offset
> immediately. The linker communicates the fact that the special
> __tls_get_addr stub is present by setting a bit in the dynamic tag
I'm confused, you write "TLS descriptor" but power doesn't have TLS DESC
support yet in glibc?
The code in question writes a module id of zero into the GOT entry
associated with the TLS variable, not really the TLS descriptor?
Speaking of which, you wouldn't happen to have a Latex contribution
that describes the Power TLS support so I can add it to and update
> tst-tlsmod2.so is built with -Wl,--no-tls-get-addr-optimize for
> tst-tls-dlinfo, which otherwise would fail since it tests that no
> static tls is allocated. The ld option --no-tls-get-addr-optimize has
> been available since binutils-2.20 so doesn't need a configure test.
> Regression tested powerpc-linux and powerpc64-linux.
> * NEWS: Advertise TLS optimization.
> * elf/elf.h (R_PPC_TLSGD, R_PPC_TLSLD, DT_PPC_OPT, PPC_OPT_TLS): Define.
> (DT_PPC_NUM): Increment.
> * elf/dynamic-link.h (HAVE_STATIC_TLS): Define, extracted from..
> (CHECK_STATIC_TLS): ..here.
> * sysdeps/powerpc/powerpc32/dl-machine.h (elf_machine_rela): Optimize
> TLS descriptors.
> * sysdeps/powerpc/powerpc64/dl-machine.h (elf_machine_rela): Likewise.
> * sysdeps/powerpc/dl-tls.c: New file.
> * sysdeps/powerpc/Versions: Add __tls_get_addr_opt.
> * sysdeps/unix/sysv/linux/powerpc/Makefile: Build tst-tlsmod2.so
> with --no-tls-get-addr-optimize.
> * sysdeps/unix/sysv/linux/powerpc/powerpc32/ld.abilist: Update.
> * sysdeps/unix/sysv/linux/powerpc/powerpc64/ld.abilist: Likewise.
> * sysdeps/unix/sysv/linux/powerpc/powerpc64/ld-le.abilist: Likewise.
This absolutely needs a new ppc64-specific test case to make sure this is
actually working as intended? If it requires a new binutils, then you'll need
to have the test return 77 (UNSUPPORTED) if the present binutils is not new
The rest looks fine.