[PATCH] TLS support for s390*.
Jakub Jelinek
jakub@redhat.com
Mon Jan 27 21:12:00 GMT 2003
On Mon, Jan 27, 2003 at 08:44:06PM +0100, Martin Schwidefsky wrote:
> --- libc/linuxthreads/sysdeps/s390/tls.h Sun Jan 5 06:10:50 2003
> +++ libc-s390/linuxthreads/sysdeps/s390/tls.h Sat Jan 25 18:15:17 2003
> @@ -45,19 +45,99 @@
> # include <tcb-offsets.h>
> #endif /* __ASSEMBLER__ */
>
> -#undef USE_TLS
> +/* We can support TLS only if the floating-stack support is available.
> + However, we want to compile in the support and test at runtime whether
> + the running kernel can support it or not. To avoid bothering with the
> + TLS support code at all, use configure --without-tls.
>
> -#if USE_TLS
> + We need USE_TLS to be consistently defined, for ldsodefs.h conditionals.
> + But some of the code below can cause problems in building libpthread
> + (e.g. useldt.h will defined FLOATING_STACKS when it shouldn't). */
>
> -#else
> +#if defined HAVE_TLS_SUPPORT \
> + && (defined FLOATING_STACKS || !defined IS_IN_libpthread)
The comment and the define should be updated. s390 uses FLOATING_STACKS
always, so doesn't have to be tested and doesn't need to be spoken about
in the comment. Furthermore, there is no useldt.h header.
> --- libc/sysdeps/s390/s390-32/dl-machine.h Fri Mar 1 10:43:37 2002
> +++ libc-s390/sysdeps/s390/s390-32/dl-machine.h Sat Jan 25 18:15:17 2003
> + case R_390_TLS_TPOFF:
> + /* The offset is negative, forward from the thread pointer. */
> +# ifdef RTLD_BOOTSTRAP
> + *reloc_addr = sym->st_value + reloc->r_addend - map->l_tls_offset;
> +# else
> + /* We know the offset of the object the symbol is contained in.
> + It is a negative value which will be added to the
> + thread pointer. */
> + if (sym != NULL)
> + {
> + *reloc_addr = (sym->st_value + reloc->r_addend
> + - sym_map->l_tls_offset);
> + CHECK_STATIC_TLS (map, sym_map);
CHECK_STATIC_TLS needs to come before *reloc_addr assignment.
> --- libc/sysdeps/s390/s390-64/dl-machine.h Fri Mar 1 10:43:37 2002
> +++ libc-s390/sysdeps/s390/s390-64/dl-machine.h Sat Jan 25 18:15:17 2003
> + case R_390_TLS_TPOFF:
> + /* The offset is negative, forward from the thread pointer. */
> +# ifdef RTLD_BOOTSTRAP
> + *reloc_addr = sym->st_value + reloc->r_addend - map->l_tls_offset;
> +# else
> + /* We know the offset of the object the symbol is contained in.
> + It is a negative value which will be added to the
> + thread pointer. */
> + if (sym != NULL)
> + {
> + *reloc_addr = (sym->st_value + reloc->r_addend
> + - sym_map->l_tls_offset);
> + CHECK_STATIC_TLS (map, sym_map);
Likewise.
Jakub
More information about the Libc-hacker
mailing list