From patchwork Tue May 5 20:31:14 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schulze Frielinghaus X-Patchwork-Id: 134512 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 6E42F4BA23F8 for ; Tue, 5 May 2026 20:33:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6E42F4BA23F8 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=JzXCna+s X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 65A304BA7990 for ; Tue, 5 May 2026 20:31:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 65A304BA7990 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 65A304BA7990 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1778013089; cv=none; b=LD9soenl3ShM5lEMridYnIeIFq5QNzcZQJ3a+MBm2H+fhtm1jwzKTCWrLlXEsEMh0JCm2043xiP3205vgSzSCN9p5QFC0TubpEFNsZOPPT/O62cMxyhs04nG3ZttouRZKRsl8xCpCjRKN2MejvWW+VKpUJcIFd/YhE1rrdmd9c8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1778013089; c=relaxed/simple; bh=Q8sh0A606nWyzxDUOa8qpQhaOxHWlrhD7vGeYnbwtVU=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=oalrL96Izasr1rY7NlJ+RKKDcfG030Vd3Jnemv9Y5pWjzzkMRwEfOcCmkfdCQuhhgU4W+NvUOzADhi4ztustKyYb8bgjICZXSb9mGStgpSwY5Y7BrpO4aLcStOhbSEpmTLYOlzaYIkvQGJvvWCT9y8A8XpCbjJ0g7DqvtxqhyZM= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 65A304BA7990 Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 645HrJmQ3011871; Tue, 5 May 2026 20:31:28 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:message-id:mime-version :subject:to; s=pp1; bh=J+jZNJkkWiN+YRUV6ri45cKrNcJfznI1VvG/K5zLm Zo=; b=JzXCna+sJZp1/eFJiLWyWuDfV5l5OMO3yEzu9ITYFpzL1Hs2K9hdAJOIN 5DiCnLD7BbJCeBEt91P2v+mqV1XO7WhWDKrlvazk5to/4EWfkMJntrQzmcstawPq 7eiUcNUM64VpUFfVmX5Vu3NZ9cwcIlJx5WMiO06zFNgRqK7fLaB81f06zPXuNIBH BhPO0eiIWxJHXTF+a9asJkEgvq45Xn/bC+MC/4J4oHYkYeE8sN2BgOXQPJiulo/z 63eXzmAqzxL3rxtY6OPv/gLCeDvgVgFqCzGSri7m5BmVwMSG/7Dq1Eb5tBruPLcW T+MnRm96M4Ubnf+wyiQOosOxFNk4A== Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4dw9w6d812-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 05 May 2026 20:31:28 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 645KOeYe020106; Tue, 5 May 2026 20:31:27 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4dwvkjubj2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 05 May 2026 20:31:27 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 645KVOWD42467640 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 5 May 2026 20:31:24 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 02BC52004B; Tue, 5 May 2026 20:31:24 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DF97F20043; Tue, 5 May 2026 20:31:23 +0000 (GMT) Received: from b3545007.lnxne.boe (unknown [9.87.84.240]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTPS; Tue, 5 May 2026 20:31:23 +0000 (GMT) From: Stefan Schulze Frielinghaus To: gcc-patches@gcc.gnu.org Cc: Matthias Klose , Stefan Schulze Frielinghaus Subject: [PATCH] Dealing with multiarch only Date: Tue, 5 May 2026 22:31:14 +0200 Message-ID: <20260505203114.1903026-1-stefansf@linux.ibm.com> X-Mailer: git-send-email 2.53.0 MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Authority-Analysis: v=2.4 cv=XPQAjwhE c=1 sm=1 tr=0 ts=69fa53a0 cx=c_pps a=GFwsV6G8L6GxiO2Y/PsHdQ==:117 a=GFwsV6G8L6GxiO2Y/PsHdQ==:17 a=NGcC8JguVDcA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=Y2IxJ9c9Rs8Kov3niI8_:22 a=mDV3o1hIAAAA:8 a=b6DKepVLRKjznqpb0f8A:9 X-Proofpoint-ORIG-GUID: 4F1YkZv44fCAkrtk8fmqpzbSNINTwRFG X-Proofpoint-GUID: 4F1YkZv44fCAkrtk8fmqpzbSNINTwRFG X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNTA1MDE5NSBTYWx0ZWRfX/4J4yl0wW56R dTiDZORwnqrSqHMDSBnQG/WQv2K/3Ge7+bdEWRTpro+o5QeMaOMb8oDjwAXrvQEp5NGL6ToEOmP K7+nuU+WTuH6igzwTgtZp6xJld7rLsj0Ug3DPwotmTfKk2Kw9tVrBrOWkRQB2r+qRWhx4EX19qf HigKmRN0Lp8DPXBqZ3e2JvrvjGhyDX7qYxgiba+G9ToTJR/PEkr0gOkz/qfGSwXF1GDBT97byrp OBDxci/4begz5fVzqTkTpaZtmEhjDXqkBD3ulTtce+8Dm0oO+qsbokfFk6iaFqGy4M5qMKZqWb2 68IN7cnl5xYTFtORM2QuiMUrmvxO7XKCzJOKDe4lz1B7MvONgyOUjQOBEa/kTdXwnntQ9EvzIoz KA44jQgmMmbHLm/qdEUPEL4PbbBs2zQbhCUVIBPs18VaH/hLe+wc1ot3w8/admcj0WquAeV1lAW fqq5MWi51rvs2Dfx6pg== 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-05-05_02,2026-04-30_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 lowpriorityscore=0 suspectscore=0 adultscore=0 spamscore=0 priorityscore=1501 impostorscore=0 phishscore=0 malwarescore=0 clxscore=1011 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604200000 definitions=main-2605050195 X-Spam-Status: No, score=-8.6 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, 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org From: Stefan Schulze Frielinghaus While removing multilib support on s390, we still want to maintain a directory structure where 64-bit libraries end-up in directories named "lib64" instead of "lib". In order to do so only make use of MULTIARCH_DIRNAME = ../lib64$(call if_multiarch,:s390x-linux-gnu) and remove MULTILIB_{OPTIONS,DIRNAMES,OSDIRNAMES}. This in turn means multilib.h is generated by running genmultilib "" "" "" "" "" "" "" "" "../lib64:s390x-linux-gnu" "" "false" "yes" Note, the last argument "yes" is due to configure defaulting to enabling multilib, if it is not explicitly disabled. Independent on whether multilib is explicitly disabled or not we end up with static const char *const multilib_raw[] = { ".::../lib64:s390x-linux-gnu ;", NULL }; in the generated file multilib.h. On Debian/Ubuntu, the two consecutive colons lead to parsing the wrong multiarch_dir "../lib64:s390x-linux-gnu" instead of "s390x-linux-gnu" in set_multilib_dir() from driver gcc.cc. This is fixed by removing the superfluous colon if [ -n "${multiarch}" ]; then defaultosdirname=::${multiarch} fi from generator genmultilib. This restores bootstrap. However, the driver passes "-imultilib ." to cc1, now, which wasn't the case previously. If multilib is not supported, all multilib directories are encoded by a dot which is why "-imultilib ." looks rather erroneous to me. If I'm not mistaken, then add_standard_paths() from incpath.cc simply appends the argument from -imultilib to a path separated by a directory separator. Therefore, in this case it just takes "$some_path" and returns "$somepath/." which could be filtered out: case 'I': { struct spec_path info; if (multilib_dir && strcmp (multilib_dir, ".") != 0) { do_spec_1 ("-imultilib", 1, NULL); /* Make this a separate argument. */ do_spec_1 (" ", 0, NULL); do_spec_1 (multilib_dir, 1, NULL); do_spec_1 (" ", 0, NULL); } in do_spec_1() from gcc.cc. For non-Unix-like OSs' this might not be only superfluous but mandatory because a dot might mean something different and doesn't resolve to the same directory. Any thoughts about this? Currently I'm running bootstrap+regtest for the following configurations: {--enable-multilib,--disable-multilib} x {Ubuntu,Fedora} x {s390x-with-m31-removed,s390x-without-m31-removed,x86_64}-linux-gnu which will take some time to complete. --- gcc/gcc.cc | 2 +- gcc/genmultilib | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/gcc.cc b/gcc/gcc.cc index f3e0004cdb8..acf1bb9a136 100644 --- a/gcc/gcc.cc +++ b/gcc/gcc.cc @@ -6588,7 +6588,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part) { struct spec_path info; - if (multilib_dir) + if (multilib_dir && strcmp (multilib_dir, ".") != 0) { do_spec_1 ("-imultilib", 1, NULL); /* Make this a separate argument. */ diff --git a/gcc/genmultilib b/gcc/genmultilib index a00d6d88683..43065c6ba85 100644 --- a/gcc/genmultilib +++ b/gcc/genmultilib @@ -277,7 +277,7 @@ toosdirnames= defaultosdirname= defaultosdirname2= if [ -n "${multiarch}" ]; then - defaultosdirname=::${multiarch} + defaultosdirname=:${multiarch} fi if [ -n "${osdirnames}" ]; then set x ${osdirnames}