From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 3CACE385BF92 for ; Wed, 1 Apr 2020 16:20:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 3CACE385BF92 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 031GFQTD053456 for ; Wed, 1 Apr 2020 12:20:14 -0400 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0b-001b2d01.pphosted.com with ESMTP id 304h3wgbwa-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 01 Apr 2020 12:20:13 -0400 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 1 Apr 2020 17:19:55 +0100 Received: from b06avi18878370.portsmouth.uk.ibm.com (9.149.26.194) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 1 Apr 2020 17:19:53 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 031GK8e320382150 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 1 Apr 2020 16:20:08 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AB153AE055; Wed, 1 Apr 2020 16:20:08 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6F001AE04D; Wed, 1 Apr 2020 16:20:08 +0000 (GMT) Received: from oc4452167425.ibm.com (unknown [9.145.41.185]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 1 Apr 2020 16:20:08 +0000 (GMT) Subject: Re: [PATCH] S/390: Fix PR91628 To: Iain Buclaw , GCC Patches References: <0afe1b58-2544-98c2-b056-a724f1a5fa6d@linux.ibm.com> <349a43fc-2a10-19ee-c7f0-ee18b29722e4@linux.ibm.com> <15b5b45f-de91-91df-3fb7-3befc0a6ffa4@gdcproject.org> From: Stefan Liebler Date: Wed, 1 Apr 2020 18:20:08 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <15b5b45f-de91-91df-3fb7-3befc0a6ffa4@gdcproject.org> Content-Type: multipart/mixed; boundary="------------9130B1352DAEC77BAE424BBC" Content-Language: en-US X-TM-AS-GCONF: 00 x-cbid: 20040116-0020-0000-0000-000003BFB52B X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20040116-0021-0000-0000-000022185C0C Message-Id: <8c0973a2-58c6-fb2b-9511-406047001639@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.676 definitions=2020-04-01_03:2020-03-31, 2020-04-01 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 bulkscore=0 phishscore=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 mlxlogscore=999 suspectscore=2 spamscore=0 clxscore=1015 mlxscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004010139 X-Spam-Status: No, score=-22.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_DMARC_STATUS, KAM_NUMSUBJECT, KAM_SHORT, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Apr 2020 16:20:16 -0000 This is a multi-part message in MIME format. --------------9130B1352DAEC77BAE424BBC Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 4/1/20 12:50 PM, Iain Buclaw wrote: > > > On 01/04/2020 08:28, Stefan Liebler wrote: >> ping >> > > Hi Stefan, > > As I've already said, I think that the name should be __ibmz_get_tls_offset to make clear that it is an internal function. > > Other than that, looks good to me. > > Iain. > Hi Iain, Sorry. I've missed your comment in the bugzilla. I've updated the name to __ibmz_get_this_offset. Nothing else is changed in the attached patch. Please commit the patch upstream. Do you also close the bugzilla as soon as committed? Regarding the mentioned musl-patch in your bugzilla comment: Yes, the diff looks like not conflicting. Thanks, Stefan --------------9130B1352DAEC77BAE424BBC Content-Type: text/x-patch; charset=UTF-8; name="20200401_fix_PR91628.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="20200401_fix_PR91628.patch" commit 98dd0351159449228df6069c8b9a9c2b1e31d683 Author: Stefan Liebler Date: Mon Mar 16 15:06:08 2020 +0100 S/390: Fix PR91628 This patch picks up Robin Dapps patch __tls_get_offset-in-separate.S. See "Bugzilla 91628 - libdruntime uses glibc internal symbol on s390" (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91628) The patch has not applied as is, therefore I've just regenerated the configure and Makefiles. Furthermore 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: 2019-11-27 Robin Dapp 2020-04-01 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. diff --git a/libphobos/configure b/libphobos/configure index 9cad270b2eb..04a6e6aeb0f 100755 --- a/libphobos/configure +++ b/libphobos/configure @@ -683,6 +683,10 @@ DRUNTIME_OS_AIX_FALSE DRUNTIME_OS_AIX_TRUE DRUNTIME_OS_UNIX_FALSE DRUNTIME_OS_UNIX_TRUE +DRUNTIME_CPU_S390_FALSE +DRUNTIME_CPU_S390_TRUE +DRUNTIME_CPU_SYSTEMZ_FALSE +DRUNTIME_CPU_SYSTEMZ_TRUE DRUNTIME_CPU_X86_FALSE DRUNTIME_CPU_X86_TRUE DRUNTIME_CPU_POWERPC64_FALSE @@ -11644,7 +11648,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11647 "configure" +#line 11651 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11750,7 +11754,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11753 "configure" +#line 11757 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -14012,6 +14016,12 @@ fi i[34567]86|x86_64) druntime_target_cpu_parsed="x86" ;; + s390x) + druntime_target_cpu_parsed="s390x" + ;; + s390) + druntime_target_cpu_parsed="s390" + ;; esac if test "$druntime_target_cpu_parsed" = "aarch64"; then DRUNTIME_CPU_AARCH64_TRUE= @@ -14061,6 +14071,22 @@ else DRUNTIME_CPU_X86_FALSE= fi + if test "$druntime_target_cpu_parsed" = "s390x"; then + DRUNTIME_CPU_SYSTEMZ_TRUE= + DRUNTIME_CPU_SYSTEMZ_FALSE='#' +else + DRUNTIME_CPU_SYSTEMZ_TRUE='#' + DRUNTIME_CPU_SYSTEMZ_FALSE= +fi + + if test "$druntime_target_cpu_parsed" = "s390"; then + DRUNTIME_CPU_S390_TRUE= + DRUNTIME_CPU_S390_FALSE='#' +else + DRUNTIME_CPU_S390_TRUE='#' + DRUNTIME_CPU_S390_FALSE= +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for target OS" >&5 @@ -15561,6 +15587,14 @@ if test -z "${DRUNTIME_CPU_X86_TRUE}" && test -z "${DRUNTIME_CPU_X86_FALSE}"; th as_fn_error $? "conditional \"DRUNTIME_CPU_X86\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${DRUNTIME_CPU_SYSTEMZ_TRUE}" && test -z "${DRUNTIME_CPU_SYSTEMZ_FALSE}"; then + as_fn_error $? "conditional \"DRUNTIME_CPU_SYSTEMZ\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${DRUNTIME_CPU_S390_TRUE}" && test -z "${DRUNTIME_CPU_S390_FALSE}"; then + as_fn_error $? "conditional \"DRUNTIME_CPU_S390\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${DRUNTIME_OS_UNIX_TRUE}" && test -z "${DRUNTIME_OS_UNIX_FALSE}"; then as_fn_error $? "conditional \"DRUNTIME_OS_UNIX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 diff --git a/libphobos/libdruntime/Makefile.am b/libphobos/libdruntime/Makefile.am index ef18fb14d0e..b6f43299064 100644 --- a/libphobos/libdruntime/Makefile.am +++ b/libphobos/libdruntime/Makefile.am @@ -98,6 +98,12 @@ else DRUNTIME_SOURCES_CONFIGURED += config/x86/switchcontext.S endif endif +if DRUNTIME_CPU_SYSTEMZ + DRUNTIME_SOURCES_CONFIGURED += config/systemz/get_tls_offset.S +endif +if DRUNTIME_CPU_S390 + DRUNTIME_SOURCES_CONFIGURED += config/s390/get_tls_offset.S +endif # Provide __start_minfo, __stop_minfo if linker doesn't. if !DRUNTIME_OS_MINFO_BRACKETING diff --git a/libphobos/libdruntime/Makefile.in b/libphobos/libdruntime/Makefile.in index 44361f9c818..cbbe6298537 100644 --- a/libphobos/libdruntime/Makefile.in +++ b/libphobos/libdruntime/Makefile.in @@ -130,6 +130,8 @@ target_triplet = @target@ @DRUNTIME_CPU_POWERPC64_TRUE@am__append_17 = config/powerpc64/callwithstack.S @DRUNTIME_CPU_X86_TRUE@@DRUNTIME_OS_MINGW_TRUE@am__append_18 = config/mingw/switchcontext.S @DRUNTIME_CPU_X86_TRUE@@DRUNTIME_OS_MINGW_FALSE@am__append_19 = config/x86/switchcontext.S +@DRUNTIME_CPU_SYSTEMZ_TRUE@am__append_20 = config/systemz/get_tls_offset.S +@DRUNTIME_CPU_S390_TRUE@am__append_21 = config/s390/get_tls_offset.S subdir = libdruntime ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \ @@ -450,17 +452,19 @@ am__objects_25 = core/sys/solaris/dlfcn.lo core/sys/solaris/elf.lo \ @DRUNTIME_CPU_POWERPC64_TRUE@am__objects_31 = config/powerpc64/libgdruntime_la-callwithstack.lo @DRUNTIME_CPU_X86_TRUE@@DRUNTIME_OS_MINGW_TRUE@am__objects_32 = config/mingw/libgdruntime_la-switchcontext.lo @DRUNTIME_CPU_X86_TRUE@@DRUNTIME_OS_MINGW_FALSE@am__objects_33 = config/x86/libgdruntime_la-switchcontext.lo -am__objects_34 = $(am__objects_4) $(am__objects_6) $(am__objects_8) \ +@DRUNTIME_CPU_SYSTEMZ_TRUE@am__objects_34 = config/systemz/libgdruntime_la-get_tls_offset.lo +@DRUNTIME_CPU_S390_TRUE@am__objects_35 = config/s390/libgdruntime_la-get_tls_offset.lo +am__objects_36 = $(am__objects_4) $(am__objects_6) $(am__objects_8) \ $(am__objects_10) $(am__objects_12) $(am__objects_14) \ $(am__objects_16) $(am__objects_18) $(am__objects_20) \ $(am__objects_22) $(am__objects_24) $(am__objects_26) \ $(am__objects_27) $(am__objects_28) $(am__objects_29) \ $(am__objects_30) $(am__objects_31) $(am__objects_32) \ - $(am__objects_33) -am__objects_35 = gcc/config.lo gcc/libbacktrace.lo -am__objects_36 = $(am__objects_1) $(am__objects_2) $(am__objects_34) \ - $(am__objects_35) -am_libgdruntime_la_OBJECTS = $(am__objects_36) + $(am__objects_33) $(am__objects_34) $(am__objects_35) +am__objects_37 = gcc/config.lo gcc/libbacktrace.lo +am__objects_38 = $(am__objects_1) $(am__objects_2) $(am__objects_36) \ + $(am__objects_37) +am_libgdruntime_la_OBJECTS = $(am__objects_38) libgdruntime_la_OBJECTS = $(am_libgdruntime_la_OBJECTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) @@ -729,7 +733,8 @@ DRUNTIME_SOURCES_CONFIGURED = $(am__append_1) $(am__append_2) \ $(am__append_9) $(am__append_10) $(am__append_11) \ $(am__append_12) $(am__append_13) $(am__append_14) \ $(am__append_15) $(am__append_16) $(am__append_17) \ - $(am__append_18) $(am__append_19) + $(am__append_18) $(am__append_19) $(am__append_20) \ + $(am__append_21) # Provide __start_minfo, __stop_minfo if linker doesn't. @DRUNTIME_OS_MINFO_BRACKETING_FALSE@DRTSTUFF = gcc/drtbegin.o gcc/drtend.o @@ -1736,6 +1741,16 @@ config/x86/$(am__dirstamp): @: > config/x86/$(am__dirstamp) config/x86/libgdruntime_la-switchcontext.lo: \ config/x86/$(am__dirstamp) +config/systemz/$(am__dirstamp): + @$(MKDIR_P) config/systemz + @: > config/systemz/$(am__dirstamp) +config/systemz/libgdruntime_la-get_tls_offset.lo: \ + config/systemz/$(am__dirstamp) +config/s390/$(am__dirstamp): + @$(MKDIR_P) config/s390 + @: > config/s390/$(am__dirstamp) +config/s390/libgdruntime_la-get_tls_offset.lo: \ + config/s390/$(am__dirstamp) gcc/config.lo: gcc/$(am__dirstamp) gcc/libbacktrace.lo: gcc/$(am__dirstamp) @@ -1756,6 +1771,10 @@ mostlyclean-compile: -rm -f config/powerpc/*.lo -rm -f config/powerpc64/*.$(OBJEXT) -rm -f config/powerpc64/*.lo + -rm -f config/s390/*.$(OBJEXT) + -rm -f config/s390/*.lo + -rm -f config/systemz/*.$(OBJEXT) + -rm -f config/systemz/*.lo -rm -f config/x86/*.$(OBJEXT) -rm -f config/x86/*.lo -rm -f core/*.$(OBJEXT) @@ -1876,6 +1895,12 @@ config/mingw/libgdruntime_la-switchcontext.lo: config/mingw/switchcontext.S config/x86/libgdruntime_la-switchcontext.lo: config/x86/switchcontext.S $(AM_V_CPPAS)$(LIBTOOL) $(AM_V_lt) $(libgdruntime_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS) -c -o config/x86/libgdruntime_la-switchcontext.lo `test -f 'config/x86/switchcontext.S' || echo '$(srcdir)/'`config/x86/switchcontext.S +config/systemz/libgdruntime_la-get_tls_offset.lo: config/systemz/get_tls_offset.S + $(AM_V_CPPAS)$(LIBTOOL) $(AM_V_lt) $(libgdruntime_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS) -c -o config/systemz/libgdruntime_la-get_tls_offset.lo `test -f 'config/systemz/get_tls_offset.S' || echo '$(srcdir)/'`config/systemz/get_tls_offset.S + +config/s390/libgdruntime_la-get_tls_offset.lo: config/s390/get_tls_offset.S + $(AM_V_CPPAS)$(LIBTOOL) $(AM_V_lt) $(libgdruntime_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS) -c -o config/s390/libgdruntime_la-get_tls_offset.lo `test -f 'config/s390/get_tls_offset.S' || echo '$(srcdir)/'`config/s390/get_tls_offset.S + .c.o: $(AM_V_CC)$(COMPILE) -c -o $@ $< @@ -1899,6 +1924,8 @@ clean-libtool: -rm -rf config/mips/.libs config/mips/_libs -rm -rf config/powerpc/.libs config/powerpc/_libs -rm -rf config/powerpc64/.libs config/powerpc64/_libs + -rm -rf config/s390/.libs config/s390/_libs + -rm -rf config/systemz/.libs config/systemz/_libs -rm -rf config/x86/.libs config/x86/_libs -rm -rf core/.libs core/_libs -rm -rf core/internal/.libs core/internal/_libs @@ -2054,6 +2081,8 @@ distclean-generic: -rm -f config/mips/$(am__dirstamp) -rm -f config/powerpc/$(am__dirstamp) -rm -f config/powerpc64/$(am__dirstamp) + -rm -f config/s390/$(am__dirstamp) + -rm -f config/systemz/$(am__dirstamp) -rm -f config/x86/$(am__dirstamp) -rm -f core/$(am__dirstamp) -rm -f core/internal/$(am__dirstamp) diff --git a/libphobos/libdruntime/config/s390/get_tls_offset.S b/libphobos/libdruntime/config/s390/get_tls_offset.S new file mode 100644 index 00000000000..aaca05cce07 --- /dev/null +++ b/libphobos/libdruntime/config/s390/get_tls_offset.S @@ -0,0 +1,25 @@ +/* IBM Z support code for TLS offsets. + Copyright (C) 2020 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + +#include "../systemz/get_tls_offset.S" diff --git a/libphobos/libdruntime/config/systemz/get_tls_offset.S b/libphobos/libdruntime/config/systemz/get_tls_offset.S new file mode 100644 index 00000000000..e9e6dc7a1ca --- /dev/null +++ b/libphobos/libdruntime/config/systemz/get_tls_offset.S @@ -0,0 +1,79 @@ +/* IBM Z support code for TLS offsets. + Copyright (C) 2020 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + +/* __tls_get_offset expects the GOT pointer in %r12 and adds + it to its argument in %r2. In order to get the offset of + ti, we load it into %r2, subtract the current %r12 from %r2 + so the addition will result in a nop (%r2 - %r12 + %r12). + + Note: This file is shared between systemz and s390 as the + same file is used in multilib case for s390x and s390. */ + +#include "../common/threadasm.S" + + .text + .globl CSYM(__ibmz_get_tls_offset) + .type CSYM(__ibmz_get_tls_offset), @function + .align 8 +CSYM(__ibmz_get_tls_offset): + .cfi_startproc + +#ifdef __s390x__ + .machinemode zarch + stmg %r14,%r15,112(%r15) + .cfi_offset 14, -48 + .cfi_offset 15, -40 + aghi %r15,-160 + .cfi_def_cfa_offset 320 + sgr %r2,%r12 + brasl %r14,__tls_get_offset@PLT + lg %r4,272(%r15) + lmg %r14,%r15,272(%r15) + .cfi_restore 15 + .cfi_restore 14 + .cfi_def_cfa_offset 160 + br %r4 +#else + .machinemode esa + stm %r12,%r15,48(%r15) + .cfi_offset 12, -48 + .cfi_offset 13, -44 + .cfi_offset 14, -40 + .cfi_offset 15, -36 + ahi %r15,-96 + .cfi_def_cfa_offset 192 + larl %r12,_GLOBAL_OFFSET_TABLE_ + sr %r2,%r12 + brasl %r14,__tls_get_offset@PLT + l %r4,152(%r15) + lm %r12,%r15,144(%r15) + .cfi_restore 15 + .cfi_restore 14 + .cfi_restore 13 + .cfi_restore 12 + .cfi_def_cfa_offset 96 + br %r4 +#endif + .cfi_endproc + .size __ibmz_get_tls_offset, .-__ibmz_get_tls_offset diff --git a/libphobos/libdruntime/gcc/sections/elf_shared.d b/libphobos/libdruntime/gcc/sections/elf_shared.d index b28c8dcb9eb..7ff87a8cec7 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]; diff --git a/libphobos/m4/druntime/cpu.m4 b/libphobos/m4/druntime/cpu.m4 index aa5b5ea08fc..4887248fd09 100644 --- a/libphobos/m4/druntime/cpu.m4 +++ b/libphobos/m4/druntime/cpu.m4 @@ -25,6 +25,12 @@ AC_DEFUN([DRUNTIME_CPU_SOURCES], i[[34567]]86|x86_64) druntime_target_cpu_parsed="x86" ;; + s390x) + druntime_target_cpu_parsed="s390x" + ;; + s390) + druntime_target_cpu_parsed="s390" + ;; esac AM_CONDITIONAL([DRUNTIME_CPU_AARCH64], [test "$druntime_target_cpu_parsed" = "aarch64"]) @@ -38,6 +44,10 @@ AC_DEFUN([DRUNTIME_CPU_SOURCES], [test "$druntime_target_cpu_parsed" = "powerpc64"]) AM_CONDITIONAL([DRUNTIME_CPU_X86], [test "$druntime_target_cpu_parsed" = "x86"]) + AM_CONDITIONAL([DRUNTIME_CPU_SYSTEMZ], + [test "$druntime_target_cpu_parsed" = "s390x"]) + AM_CONDITIONAL([DRUNTIME_CPU_S390], + [test "$druntime_target_cpu_parsed" = "s390"]) ]) --------------9130B1352DAEC77BAE424BBC--