From 88e508f9f112acd07d0c49c53589160db8c85fcd Mon Sep 17 00:00:00 2001 From: Robin Dapp Date: Tue, 7 Apr 2020 21:05:38 +0200 Subject: S/390: Fix PR91628 With this patch we get rid of the usage of the glibc-internal symbol __tls_get_addr_internal. If build with multilib, the file gcc/libphobos/libdruntime/config/systemz/get_tls_offset.S is used for both configurations: systemz and s390. Therefore both implementations are now in the systemz file which uses an "#ifdef __s390x__" in order to distinguish both cases. The s390 file is just including the systemz one. libphobos/ChangeLog: 2020-04-07 Robin Dapp Stefan Liebler * configure: Regenerate. * libdruntime/Makefile.am: Add s390x and s390. * libdruntime/Makefile.in: Regenerate. * libdruntime/config/s390/get_tls_offset.S: New file. * libdruntime/config/systemz/get_tls_offset.S: New file. * libdruntime/gcc/sections/elf_shared.d: Use ibmz_get_tls_offset. * m4/druntime/cpu.m4: Add s390x and s390. --- libphobos/libdruntime/gcc/sections/elf_shared.d | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'libphobos/libdruntime/gcc') diff --git a/libphobos/libdruntime/gcc/sections/elf_shared.d b/libphobos/libdruntime/gcc/sections/elf_shared.d index b28c8dc..7ff87a8 100644 --- a/libphobos/libdruntime/gcc/sections/elf_shared.d +++ b/libphobos/libdruntime/gcc/sections/elf_shared.d @@ -1028,7 +1028,7 @@ struct tls_index } extern(C) void* __tls_get_addr(tls_index* ti) nothrow @nogc; -extern(C) void* __tls_get_addr_internal(tls_index* ti) nothrow @nogc; +extern(C) void* __ibmz_get_tls_offset(tls_index *ti) nothrow @nogc; /* The dynamic thread vector (DTV) pointers may point 0x8000 past the start of * each TLS block. This is at least true for PowerPC and Mips platforms. @@ -1086,9 +1086,11 @@ void[] getTLSRange(size_t mod, size_t sz) nothrow @nogc auto ti = tls_index(mod, 0); version (IBMZ_Any) { - auto idx = cast(void *)__tls_get_addr_internal(&ti) - + cast(ulong)__builtin_thread_pointer(); - return idx[0 .. sz]; + // IBM Z only provides __tls_get_offset instead of __tls_get_addr + // which returns an offset relative to the thread pointer. + auto addr = __ibmz_get_tls_offset(&ti); + addr = addr + cast(c_ulong)__builtin_thread_pointer(); + return addr[0 .. sz]; } else return (__tls_get_addr(&ti)-TLS_DTV_OFFSET)[0 .. sz]; -- cgit v1.1