This is the mail archive of the 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]

Re: powerpc __tls_get_addr call optimization

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
tls.pdf? :-)

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


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