From 7d303841dbb6e668e5acdd9218ce82231a00a967 Mon Sep 17 00:00:00 2001 From: Vineet Gupta Date: Tue, 30 Jun 2015 17:46:56 +0530 Subject: NPTL/arc: notify kernel of the TP value Native gdb makes a ptrace (GET_THREAD_AREA) which needs to return the TP. however when libc sets up TP reg (for main thread), it doesn't call arc_settls syscall so kernel doesn't know of TP register details (moreso because clone doesnt have SETTLS flag) Note that kernel doesn't know about r25 being TP etc. This commit got lost in merge of NPTL tools into arc-mainline-dev and showed up again as STAR 9000919529 (native gdb can't debug threaded apps) ------->8--------------- [ARCLinux]# gdb ./pth Reading symbols from ./pth...(no debugging symbols found)...done. (gdb) b main Breakpoint 1 at 0x106f2 (gdb) r Starting program: /pth [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/libthread_db.so.1". thread_get_info_callback: cannot get thread info: generic error (gdb) q ------->8--------------- Debugged-by: Anton Kolesov Signed-off-by: Vineet Gupta Signed-off-by: Vineet Gupta --- libpthread/nptl/sysdeps/arc/tls.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libpthread/nptl/sysdeps/arc/tls.h b/libpthread/nptl/sysdeps/arc/tls.h index 63dd11398..4af415a1c 100644 --- a/libpthread/nptl/sysdeps/arc/tls.h +++ b/libpthread/nptl/sysdeps/arc/tls.h @@ -104,8 +104,11 @@ typedef struct operation can cause a failure 'errno' must not be touched. */ # define TLS_INIT_TP(tcbp, secondcall) \ ({ \ - __builtin_set_thread_pointer(tcbp); \ - NULL; \ + long result_var; \ + __builtin_set_thread_pointer(tcbp); \ + result_var = INTERNAL_SYSCALL (arc_settls, err, 1, (tcbp)); \ + INTERNAL_SYSCALL_ERROR_P (result_var, err) \ + ? "unknown error" : NULL; \ }) /* Return the address of the dtv for the current thread. -- cgit v1.2.3 From 49700fa92a3727e0248fc7c23f6df8486707deb1 Mon Sep 17 00:00:00 2001 From: Max Filippov Date: Fri, 3 Jul 2015 19:51:25 +0300 Subject: test/tls: xtensa: fix TLS_LD definition TLS_LD should use linker-provided symbol _TLS_MODULE_BASE_ instead of symbol it resolves to get thread pointer, otherwise linker relaxation doesn't work correctly, adding extra offset to thread-local variable address. This fixes most of tls/tst-tls* tests. Signed-off-by: Max Filippov --- test/tls/tls-macros.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/tls/tls-macros.h b/test/tls/tls-macros.h index a41aef688..7d8927400 100644 --- a/test/tls/tls-macros.h +++ b/test/tls/tls-macros.h @@ -900,9 +900,9 @@ register void *__gp __asm__("$29"); #define TLS_LD(x) \ ({ int *__l; \ - __asm__ ("movi a8, " #x "@TLSFUNC\n\t" \ - "movi a10, " #x "@TLSARG\n\t" \ - "callx8.tls a8, " #x "@TLSCALL\n\t" \ + __asm__ ("movi a8, _TLS_MODULE_BASE_@TLSFUNC\n\t" \ + "movi a10, _TLS_MODULE_BASE_@TLSARG\n\t" \ + "callx8.tls a8, _TLS_MODULE_BASE_@TLSCALL\n\t" \ "movi %0, " #x "@TPOFF\n\t" \ "add %0, %0, a10\n\t" \ : "=r" (__l) \ -- cgit v1.2.3 From 449109519492266410421310ee09ff4a10d7c175 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Sun, 5 Jul 2015 15:33:06 +0200 Subject: fix parallel build issue when LOCALES are enabled --- Makefile.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile.in b/Makefile.in index 245649cd0..f432760ea 100644 --- a/Makefile.in +++ b/Makefile.in @@ -183,11 +183,12 @@ menuconfig-clean-y: HEADERCLEAN_config headers-y += $(target-headers-sysdep) headers: $(top_builddir)include/bits/uClibc_config.h | subdirs + $(Q)$(if $(UCLIBC_HAS_LOCALE),$(MAKE) -C extra/locale locale_headers) + subdirs: $(addprefix $(top_builddir),$(subdirs)) $(pregen-headers-y): $(headers_dep) pregen: headers $(pregen-headers-y) $(headers_dep) - $(Q)$(if $(UCLIBC_HAS_LOCALE),$(MAKE) -C extra/locale locale_headers) $(top_builddir)include/bits/sysnum.h: $(top_srcdir)extra/scripts/gen_bits_syscall_h.sh | $(top_builddir)include/bits @$(disp_gen) -- cgit v1.2.3