From patchwork Mon Mar 16 13:36:45 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Remus X-Patchwork-Id: 131795 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 284644B1A36F for ; Mon, 16 Mar 2026 13:37:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 284644B1A36F Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=oyIorgpA X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id DCD4E4BAE7E4 for ; Mon, 16 Mar 2026 13:36:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DCD4E4BAE7E4 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linux.ibm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org DCD4E4BAE7E4 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1773668214; cv=none; b=dYgfzq7aoNr8xvjDkwTf/YcNhJxcdKDQew+mry9tzx+A6bjyQFE01SRQVeTRHj+cq44cQM2szXJNcH/YEPVEa6GtVtlX9GT3EnpIf+GIQ3WkFCzC7h3SgwAjBvD4DZWNFVk7xzHvWGuV05aVBM7lrS9sgfyAvz7xEJ+PTvYu4J0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1773668214; c=relaxed/simple; bh=4ppQMQ/n9WQ2Gj+VRqRLqQk5NtEnrGl+HcgfewzRGnY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=ZlMCdp5b1iZm2VaxXQCXYAPOMtHR2PCYcGuxjaub7lcbObhpyiQf9uZm4wHR0fyA+8pmPMudFlBqqWeEIkK9wVcmbBGXiQEjwXqGhCLxbNRe+5hUYU+c19W0udhQekd8k/zn5Aa4jMsLHkA8yDEXU7iazzQYuQQjnJmBmut7eXM= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DCD4E4BAE7E4 Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62FMIP8L1200667 for ; Mon, 16 Mar 2026 13:36:53 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=zrC5Vnq+67an7VMF3 1BkKPNZyzalSxec+odOLFusRJs=; b=oyIorgpA7q/7GtUyoOjKX6JeJVXr9Xxr6 FoCmjDk+MWsnN90K/u3Azl781aSW+85hbXvZUlFCCmaLYGF0YEYjrk24sxUFTEuZ vbAQ/YN0gKW9hA94S+fSII8wgmvQqRvpj+wVitGrAx7Z/bx/mUN5qcuQ69eRr2nY Y8IyUGogiiwRJkrS1uPNMypwCUq41KKnFCtLyeoNxDB5ETXYt7iPDiMnCL9VRlUj MgvFjHuUtmKZupcNDAm0eJJgen9pOR2iMvnL6CGC54QB3Q2vcGKxIycEJiaPuoaR wd17PHqO1z70ZYdOGmqQR9t3Cb0nQVVQEU63Vq4TACzM3CbUw8G7Q== Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4cvy64g3wn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 16 Mar 2026 13:36:52 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 62G9mkD2014024; Mon, 16 Mar 2026 13:36:51 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4cwjcxw2uf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 16 Mar 2026 13:36:51 +0000 Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 62GDalNl27460008 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 16 Mar 2026 13:36:47 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3824F2004F; Mon, 16 Mar 2026 13:36:47 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1FD042004E; Mon, 16 Mar 2026 13:36:47 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.87.85.9]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 16 Mar 2026 13:36:47 +0000 (GMT) From: Jens Remus To: binutils@sourceware.org, Andreas Krebbel , Alan Modra Cc: Jens Remus , Ilya Leoshkevich Subject: [PATCH v2 2/2] s390: Skip non-PIC shared library visibility linker tests Date: Mon, 16 Mar 2026 14:36:45 +0100 Message-ID: <20260316133645.130947-3-jremus@linux.ibm.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260316133645.130947-1-jremus@linux.ibm.com> References: <20260316133645.130947-1-jremus@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-ORIG-GUID: l7OD7TrixX6Dst1U9dlKC5gt84-2SqAb X-Proofpoint-GUID: 3SogASa5WkEskowwlW8CGvht0R9RDbes X-Authority-Analysis: v=2.4 cv=KYnfcAYD c=1 sm=1 tr=0 ts=69b80774 cx=c_pps a=5BHTudwdYE3Te8bg5FgnPg==:117 a=5BHTudwdYE3Te8bg5FgnPg==:17 a=Yq5XynenixoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=iQ6ETzBq9ecOQQE5vZCe:22 a=VnNF1IyMAAAA:8 a=yGJ937bPFte1ib47FHEA:9 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzE2MDEwMSBTYWx0ZWRfXzz2cL/e8ORs2 LOSrBb6UgMbn8SMzH/39IreDY0cVqu7XPu9k2UHf0kvClhkZcVfNwekQoNfn2K605s3KpQcDsd4 JN3HQXNHehy8r3iKsFaZvPp5zUJh9v2+tpnAyaPTrPTcHzvdRZM4Ci2pMuEIyYTHYZZgsSqPh2O xKwILcpyJ+/ipigSjRGzwU6aerOPT6osDuiU2SEF1fwGYS4WZTr699SZH7dHYcdaclyQrvfgzXy iJDMaxiBbyafXdliVVF+xb9T/gK4eKzEticvQIvY/70qrSS9o0owf8YJEQAi7JshoTqui+MvLXT 70RJd1V2RqEHS6Dq54r6huft7XvZaEbrxUjgzif16Nx9V1Ji3O6h2ATtEAL8W6ouBBX29A/24L6 +/YJ+99uoUNdOMA6avbwOshTQl1IK4L93NrnuX7/7kbXxQukqrgI5NFgwSNuHgoJcQ91+Blw3CR foMvCkYd1QNevNA/7+Q== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-16_04,2026-03-16_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 lowpriorityscore=0 priorityscore=1501 suspectscore=0 bulkscore=0 spamscore=0 impostorscore=0 malwarescore=0 adultscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2603050001 definitions=main-2603160101 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces~patchwork=sourceware.org@sourceware.org Some of the "visibility" linker tests that use a non-PIC shared library with load offset (first load segment has a non-zero virtual address) XPASS on s390 64-bit (s390x): PASS: visibility (hidden) (non PIC, load offset) XFAIL: visibility (hidden_normal) (non PIC, load offset) PASS: visibility (hidden_undef) (non PIC, load offset) PASS: visibility (hidden_undef_def) (non PIC, load offset) XPASS: visibility (hidden_weak) (non PIC, load offset) XPASS: visibility (protected) (non PIC, load offset) PASS: visibility (protected_undef) (non PIC, load offset) XPASS: visibility (protected_undef_def) (non PIC, load offset) XPASS: visibility (protected_weak) (non PIC, load offset) XFAIL: visibility (normal) (non PIC, load offset) This is due to Alan Modra's commit 125c64931b97 from 2006, which moved overriddenvar, shlib_overriddencall2, and shared_data from sh1.c to sh2.c, if the shared library is build non-PIC. This prevents GCC from treating them as local symbols, preventing the executable from overriding them, causing the tests to fail because interposition did not work. This actually only became visible due to H.J. Lu's commit fd7728c8a4aa ("ld: Update function prototypes for compilers defaulting to -std=gnu23") from 2025, that fixed the visibility test's function prototypes. Previously all of the "visibility" tests would appear as UNSUPPORTED, as the prerequisite compile of main.c would fail due to the function prototypes not matching with their definitions. In general creating shared libraries from non-PIC compiled code is not supported on s390 64-bit (s390x). This is because shared libraries are inherently position independent. The Glibc dynamic loader common code passes the virtual address from the first load segment as hint to mmap(). As a result a shared library with "load offset" may be loaded at the virtual address used at link-time, but this is not guaranteed. The following visibility tests using a non-PIC shared library with load offset XPASS, if the non-PIC shared library is loaded at its link- time "load offset". This causes the tests to PASS by chance. XPASS: visibility (hidden_weak) (non PIC, load offset) XPASS: visibility (protected) (non PIC, load offset) XPASS: visibility (protected_undef_def) (non PIC, load offset) XPASS: visibility (protected_weak) (non PIC, load offset) The following visibility tests using a non-PIC shared library with load offset still XFAIL: XFAIL: visibility (hidden_normal) (non PIC, load offset) XFAIL: visibility (normal) (non PIC, load offset) This is because visibility_var is local in sh1.c, preventing the executable from overriding it, causing the tests to fail because interposition does not work. Note that all of the visibility tests using a non-PIC shared library without load offset XFAIL, as they are loaded at a random address, which is incompatible with non-PIC code. Skip all non-PIC shared library "visibility" linker tests on s390 64-bit (s390x) as unsupported. In contrast to PowerPC and MIPS do not skip all of the "visibility" linker tests. ld/testsuite/ * ld-vsb/vsb.exp: Skip non-PIC shared library "visibility" tests on s390 64-bit (s390x). Signed-off-by: Jens Remus --- Notes (jremus): Changes in v2: - Skip non-PIC shared library "visibility" linker tests on s390 64-bit (s390x), as these is not supported. (Alan) - Reword commit subject and message accordingly. ld/testsuite/ld-vsb/vsb.exp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/ld/testsuite/ld-vsb/vsb.exp b/ld/testsuite/ld-vsb/vsb.exp index df6aeb9dcefd..c946fa8a1682 100644 --- a/ld/testsuite/ld-vsb/vsb.exp +++ b/ld/testsuite/ld-vsb/vsb.exp @@ -297,6 +297,18 @@ proc visibility_run {visibility} { unsupported "visibility ($visibility) (non PIC, load offset)" unsupported "visibility ($visibility)" } else { + # Non-PIC shared libraries are not supported on s390 64-bit (s390x). + # When compiling without -fpic or -fPIC, GCC will assume quite + # reasonably that it is not compiling for a shared library. It + # can then make optimisations that result in shared library + # functions and variables not being overridable or reachable. + # N.B.: Skipping the non-PIC shared library tests (non-PIC main) + # here will also cause skipping of likewise tests (PIC main) + # further down below. + if { [istarget s390x-*-linux*] } { + unsupported "visibility ($visibility) (non PIC)" + unsupported "visibility ($visibility) (non PIC, load offset)" + } else { # The shared library is composed of two files. First compile them # without using -fpic. That should work on an ELF system, # although it will be less efficient because the dynamic linker @@ -406,7 +418,7 @@ proc visibility_run {visibility} { mainnp.o sh1np.o sh2np.o $datfile \ "-Wl,-T,$srcdir/$subdir/elf-offset.ld,--hash-style=sysv" $NOPIE_LDFLAGS } - } + }} # Now compile the code using -fpic.