old-cross-binutils/gdb/testsuite/gdb.threads
Jan Kratochvil 5876f5032f Fix TLS access for -static -pthread
I have posted:
	TLS variables access for -static -lpthread executables
	https://sourceware.org/ml/libc-help/2014-03/msg00024.html
and the GDB patch below has been confirmed as OK for current glibcs.

Further work should be done for newer glibcs:
	Improve TLS variables glibc compatibility
	https://sourceware.org/bugzilla/show_bug.cgi?id=16954

Still the patch below implements the feature in a fully functional way backward
compatible with current glibcs, it depends on the following glibc source line:
	csu/libc-tls.c
	main_map->l_tls_modid = 1;

gdb/
2014-05-21  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Fix TLS access for -static -pthread.
	* linux-thread-db.c (struct thread_db_info): Add td_thr_tlsbase_p.
	(try_thread_db_load_1): Initialize it.
	(thread_db_get_thread_local_address): Call it if LM is zero.
	* target.c (target_translate_tls_address): Remove LM_ADDR zero check.
	* target.h (struct target_ops) (to_get_thread_local_address): Add
	load_module_addr comment.

gdb/gdbserver/
2014-05-21  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Fix TLS access for -static -pthread.
	* gdbserver/thread-db.c (struct thread_db): Add td_thr_tlsbase_p.
	(thread_db_get_tls_address): Call it if LOAD_MODULE is zero.
	(thread_db_load_search, try_thread_db_load_1): Initialize it.

gdb/testsuite/
2014-05-21  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Fix TLS access for -static -pthread.
	* gdb.threads/staticthreads.c <HAVE_TLS> (tlsvar): New.
	<HAVE_TLS> (thread_function, main): Initialize it.
	* gdb.threads/staticthreads.exp: Try gdb_compile_pthreads for $have_tls.
	Add clean_restart.
	<$have_tls != "">: Check TLSVAR.

Message-ID: <20140410115204.GB16411@host2.jankratochvil.net>
2014-05-21 16:25:53 +02:00
..
attach-into-signal.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
attach-into-signal.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
attach-stopped.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
attach-stopped.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
bp_in_thread.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
bp_in_thread.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
clone-new-thread-event.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
clone-new-thread-event.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
corethreads.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
corethreads.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
create-fail.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
create-fail.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
current-lwp-dead.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
current-lwp-dead.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
dlopen-libpthread-lib.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
dlopen-libpthread.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
dlopen-libpthread.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
execl.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
execl.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
execl1.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
fork-child-threads.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
fork-child-threads.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
fork-thread-pending.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
fork-thread-pending.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
gcore-thread.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
hand-call-in-threads.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
hand-call-in-threads.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
ia64-sigill.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
ia64-sigill.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
info-threads-cur-sal-2.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
info-threads-cur-sal.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
info-threads-cur-sal.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
interrupted-hand-call.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
interrupted-hand-call.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
killed.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
killed.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
leader-exit.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
leader-exit.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
linux-dp.c
linux-dp.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
local-watch-wrong-thread.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
local-watch-wrong-thread.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
Makefile.in
manythreads.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
manythreads.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
multi-create.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
multi-create.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
multiple-step-overs.c Handle multiple step-overs. 2014-03-20 13:43:28 +00:00
multiple-step-overs.exp Handle multiple step-overs. 2014-03-20 13:43:28 +00:00
no-unwaited-for-left.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
no-unwaited-for-left.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
non-ldr-exc-1.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
non-ldr-exc-1.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
non-ldr-exc-2.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
non-ldr-exc-2.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
non-ldr-exc-3.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
non-ldr-exc-3.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
non-ldr-exc-4.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
non-ldr-exc-4.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
pending-step.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
pending-step.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
print-threads.c
print-threads.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
pthread_cond_wait.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
pthread_cond_wait.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
pthreads.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
pthreads.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
reconnect-signal.c [remote/gdbserver] Don't lose signals when reconnecting. 2014-01-08 18:55:51 +00:00
reconnect-signal.exp [remote/gdbserver] Don't lose signals when reconnecting. 2014-01-08 18:55:51 +00:00
schedlock.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
schedlock.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
siginfo-threads.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
siginfo-threads.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
signal-while-stepping-over-bp-other-thread.c Further cleanup of signal-while-stepping-over-bp-other-thread.c. 2014-03-20 14:09:53 +00:00
signal-while-stepping-over-bp-other-thread.exp Make signal-while-stepping-over-bp-other-thread.exp run against remote targets too. 2014-03-20 13:44:32 +00:00
sigstep-threads.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
sigstep-threads.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
sigthread.c
sigthread.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
staticthreads.c Fix TLS access for -static -pthread 2014-05-21 16:25:53 +02:00
staticthreads.exp Fix TLS access for -static -pthread 2014-05-21 16:25:53 +02:00
step-over-lands-on-breakpoint.c Fix missing breakpoint/watchpoint hits, eliminate deferred_step_ptid. 2014-03-20 13:26:31 +00:00
step-over-lands-on-breakpoint.exp Fix missing breakpoint/watchpoint hits, eliminate deferred_step_ptid. 2014-03-20 13:26:31 +00:00
step-over-trips-on-watchpoint.c Fix for even more missed events; eliminate thread-hop code. 2014-03-20 13:42:23 +00:00
step-over-trips-on-watchpoint.exp Fix for even more missed events; eliminate thread-hop code. 2014-03-20 13:42:23 +00:00
stepi-random-signal.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
stepi-random-signal.exp Fix gdb.threads/stepi-random-signal.exp on software single-step targets. 2014-02-07 19:04:10 +00:00
switch-threads.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
switch-threads.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
thread-execl.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
thread-execl.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
thread-find.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
thread-specific-bp.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
thread-specific-bp.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
thread-specific.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
thread-specific.exp gdb.threads/thread-specific.exp: Fix uninitialized variable references 2014-03-21 23:51:16 +00:00
thread-unwindonsignal.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
thread_check.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
thread_check.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
thread_events.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
thread_events.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
threadapply.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
threadapply.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
threxit-hop-specific.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
threxit-hop-specific.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
tls-main.c
tls-nodebug.c gdb/testsuite/gdb.threads: Ensure TLS tests link against pthreads. 2013-07-18 15:49:22 +00:00
tls-nodebug.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
tls-shared.c gdb/testsuite/gdb.threads: Ensure TLS tests link against pthreads. 2013-07-18 15:49:22 +00:00
tls-shared.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
tls-var-main.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
tls-var.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
tls-var.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
tls.c
tls.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
tls2.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
watchpoint-fork-child.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
watchpoint-fork-mt.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
watchpoint-fork-parent.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
watchpoint-fork-st.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
watchpoint-fork.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
watchpoint-fork.h Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
watchthreads-reorder.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
watchthreads-reorder.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
watchthreads.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
watchthreads.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
watchthreads2.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
watchthreads2.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
wp-replication.c Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
wp-replication.exp Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00