This is the mail archive of the gdb-testers@sourceware.org mailing list for the GDB 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]

[binutils-gdb] __tls_get_addr_opt GOT entries


*** TEST RESULTS FOR COMMIT 676ee2b5fa6ae41342a9fcd2b7ca18693fa0535b ***

Author: Alan Modra <amodra@gmail.com>
Branch: master
Commit: 676ee2b5fa6ae41342a9fcd2b7ca18693fa0535b

__tls_get_addr_opt GOT entries

My 2017-01-24 patch (commit f0158f44) wrongly applied an optimization
of GOT entries for the __tls_get_addr_opt stub, to shared libraries.

When the TLS segment layout is known, as it is for the executable and
shared libraries loaded at initial program start, powerpc supports a
__tls_get_addr optimization.  On the first call to __tls_get_addr for
a given __tls_index GOT entry, the DTPMOD word is set to zero and the
DTPREL word to the thread pointer offset to the thread variable.  This
allows the __tls_get_addr_opt stub to return that value immediately
without making a call into glibc for any subsequent __tls_get_addr
calls using that __tls_index GOT entry.

That's all fine, but I thought I'd be clever and when the thread
variable is local, set up the GOT entry as if __tls_get_addr had
already been called.  Which is good only for the executable, since ld
cannot know the TLS layout for shared libraries.

Of course, if this only applies to executables there isn't much point
to the optimization.  Normally, GD and LD code in an executable will
be converted to IE or LE, losing the __tls_get_addr call.  So the only
time it will trigger is with --no-tls-optimize.  Thus, revert all
support.

	* elf64-ppc.c (ppc64_elf_relocate_section): Don't optimize
	__tls_index GOT entries when using __tls_get_addr_opt stub.
	* elf32-ppc.c (ppc_elf_relocate_section): Likewise.


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