From patchwork Wed Nov 2 13:10:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Lyon X-Patchwork-Id: 14221 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp3609712wru; Wed, 2 Nov 2022 06:11:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6eQEg4UMux/5JWMZYxbGPH2AUPGs+7utRwUl/UddDFUQJshprQdp35XM8+EVVaumYYVANF X-Received: by 2002:aa7:c6cd:0:b0:461:87ab:3255 with SMTP id b13-20020aa7c6cd000000b0046187ab3255mr24699698eds.193.1667394689856; Wed, 02 Nov 2022 06:11:29 -0700 (PDT) Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id g6-20020a056402320600b0045caa1628c6si13905231eda.216.2022.11.02.06.11.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Nov 2022 06:11:29 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="SLKez/mv"; arc=fail (signature failed); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 233F0385829C for ; Wed, 2 Nov 2022 13:11:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 233F0385829C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1667394681; bh=n3yfJQD8Q8Wq9GrvK6s0+AKHJpSNflrqR1IWJ0gug20=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=SLKez/mv0jjAMxGAZWCQX1PTU36GJeqWyto7fv4yTVN+wYFTi/bg1WT8nGCLmQAMi Z7khXa5mXwCQHAW2zfBfiufU+ehPGtUwLOZPd+7HEoHfRhuJZLI9bC5/NqnmO+6SXq vgmwuj8RbJkTqLSb4KcbPxKgcNs2M18ldrMxHGbw= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2082.outbound.protection.outlook.com [40.107.247.82]) by sourceware.org (Postfix) with ESMTPS id 0DFEB3858C50 for ; Wed, 2 Nov 2022 13:10:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0DFEB3858C50 ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=ElwitH1DYk6yr0EIVNRjcjAkkP/l/hbkJKmiOMLUqo/++qXNVfVg/+ktY1Pq+RP2NfxB+Auaw1JI9xhWe/YIxtRYQ0f8OdQungxmT+BO0llteFX/iQU1Cf61cPo5KQbLLCW66Xm1Xq0Rum680Eh5/DL6AGREVp73OhEnFRz/fD9F1ba2fQK7B3/VACN6HZfkEH1hJHyXV8LGK4TKoO2PJuuzzv/f/UILAGVzJJj7x8iAaniBo9fPnU102XND1WuGn1P7gm9WE3RdG9ppLdcbh7G/9x/aUxDT9eeE+VBWB0lQ8vrVMczCyXRv7xPm49M9TrOkrVtBBQ6ZzvURDqdiIg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=n3yfJQD8Q8Wq9GrvK6s0+AKHJpSNflrqR1IWJ0gug20=; b=YFCRcsLlDOMwV3vtZWop8K1MNoLo6ykV+ieCk+GV/LaUIWc6UKVkhwMR56D9gvgg9OHDLGl0hr2AvBjnV1CeeH78vy3dWd9EhDps+03M/T+O2gCLa+7uRmHUM6fFUnL9vpH1b7/FO9hc9LHugWrxQWIKtY/T0I71CpGwZSmSlPlheP+0OPFqTN0D2ujmnAf/eydY4Z/S2yTPBwOf9RyRTh6S7yDhKgermv3NwW1J/ByPiW8EQIvO+bsxZNgOYYMhDJPTPnzepWSpH4zhyBmksTLsZexw9/RcClyT/lQeJy4vIvZHoNg2H5S7kTfLKMzF+hmR/vLwXJYr21ui7ARd1Q== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dmarc=[1,1,header.from=arm.com]) Received: from DU2PR04CA0219.eurprd04.prod.outlook.com (2603:10a6:10:2b1::14) by PAVPR08MB9673.eurprd08.prod.outlook.com (2603:10a6:102:31c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.21; Wed, 2 Nov 2022 13:10:28 +0000 Received: from DBAEUR03FT046.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:2b1:cafe::5b) by DU2PR04CA0219.outlook.office365.com (2603:10a6:10:2b1::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.15 via Frontend Transport; Wed, 2 Nov 2022 13:10:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DBAEUR03FT046.mail.protection.outlook.com (100.127.142.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.20 via Frontend Transport; Wed, 2 Nov 2022 13:10:27 +0000 Received: ("Tessian outbound b4aebcc5bc64:v130"); Wed, 02 Nov 2022 13:10:27 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 24e75bbda15eb595 X-CR-MTA-TID: 64aa7808 Received: from 1b635297428f.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id BEE992EC-DB1F-4EF0-8CA3-D45AEB9DA089.1; Wed, 02 Nov 2022 13:10:16 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 1b635297428f.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 02 Nov 2022 13:10:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XqjIXR95e/RbEIvZq9xNkWlpUCN2qlqp8ELNtTZpEAXN+LiFOyUfB5ym1ahz25QpRuaWF+aIlyzGtNNqVg8DgCJKFa9bR1H3ZCK4/1omTXVwcbAGKCjV99HNNfRsO6836xnCMnJ+s832Mzy7BUT+2iGHRclVCMs9ir2jqNjj4K29/jTfAFQwLIWGbJbPaLS9Qrme5FmbtUKFYnRYUYwtqvWuI617kRT0lzzaS4vhCDuLaYj39qhO0wV42xW/YM2b5gYYc2mZIck5RLJNMbyitxOr1ahVkhYNpE7KdGcq1uGzqca0KXq++vqz/glmjZn+dwwzLsBgd4SNJtDHY/jHtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=n3yfJQD8Q8Wq9GrvK6s0+AKHJpSNflrqR1IWJ0gug20=; b=F2xDyVGRx6tWV2yHdncagvkeWceSIXT+dZxcIFusN1+CpNwfcAA3DGEmpNHG0CDai16goN5Zyh3Z3u0qVFMw8IwV1xK3e3uQsYlAYM8QAgO21qlp/4wSoT8A5EXSqlSA2AHv6WY//pi3HCpE0l9wIuBOAC8s4vEaO5MWZCVp802qVSWC6JjedahuA2+E/KI+MUpb5IQHCyjJn0NxZgU7SF7/RG0Koo4cuTWnc/5C03BMU+RA3+Ddy0GgsnNWYEc1qA4vERfiVmxMing0IvRYr96geUU9s114HeM5kKAVWFZC5MAT4nklIxeM1r4wrUxo+Dt6SIaGbYraFVHohQ0Qsw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none Received: from ZR0P278CA0069.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:21::20) by AS2PR08MB10033.eurprd08.prod.outlook.com (2603:10a6:20b:644::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.19; Wed, 2 Nov 2022 13:10:14 +0000 Received: from VI1EUR03FT018.eop-EUR03.prod.protection.outlook.com (2603:10a6:910:21:cafe::82) by ZR0P278CA0069.outlook.office365.com (2603:10a6:910:21::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.21 via Frontend Transport; Wed, 2 Nov 2022 13:10:13 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; pr=C Received: from nebula.arm.com (40.67.248.234) by VI1EUR03FT018.mail.protection.outlook.com (100.127.144.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5791.20 via Frontend Transport; Wed, 2 Nov 2022 13:10:13 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Wed, 2 Nov 2022 13:10:13 +0000 Received: from gnu-x86-64-dev-02-dev.lab.cambridge.arm.com (10.7.24.25) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Wed, 2 Nov 2022 13:10:12 +0000 To: Subject: [PATCH] genmultilib: Add sanity check Date: Wed, 2 Nov 2022 13:10:04 +0000 Message-ID: <20221102131004.3816486-1-christophe.lyon@arm.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: VI1EUR03FT018:EE_|AS2PR08MB10033:EE_|DBAEUR03FT046:EE_|PAVPR08MB9673:EE_ X-MS-Office365-Filtering-Correlation-Id: 54d20fc6-e51f-4cf5-b9f0-08dabcd39c55 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: +JP0vzqig3VTMWPF45L2kdND3NOfcPhiiIxXwiHM8tP9apCny/Jo+UemPq+fOdXz5Dy/IVgyNbBj8ufpSXqEosuhWi1D0gTra33oUuGUu0oDnrTgyo1xk5VISwVB5PMGgq+fnLpstqx4ATWi/wSVzxx7N/19kQDmWiuX1i5PY8i3o6FXKRzqihO037thMHVuWI7jp7dYo1Hop7Z5UBT9rrvM32cJ6vAXEAsOz9xpOP6AJ59uzk9RW3E71TZlqA4vN8BP6at1nA9PI/MFK4dgqxZsHSdBnVCt4cIiwVE5v6ld/RJB/c2GRg2PzDhbppxsb8se0BJmnWTNzq1K0McAayxGlWzSifeLB52RrHuBHHRZyz0SVXwkDKoG4V60B5yYFbRpnUR0Uf4addHoG9/L7R0ewDol55n6G+UCv/x141nKzSLWc0H5mqRqU8DhicFcKsQenf9Rvx0vH1ek2wNHGAMjFqu4/RYXCWpOyjaG4IFsEaxY2t9LwQnuKSZQDQHtn9mrtvmTebTtccO2RumCrM8wHLlzJgaY6K9wr4bKI+w72P6jDphYea+Kyubj5OvnZ7c+KxDoiRIN7tJncpRCYBS+19M9uIehNdXzHCIjevhntR+w05COW8X26GUYBPvg0hU6bi+1Y2zMXOIIFmTMGTXzvOItqdP9xl0G2ZnqCn4bBF861M+2U06hdxd8HT3e5Axx2Pa8oWBYNNEFByfw1LwnqZ6oVsGBB56/XKKLAqA4QpG5ZE5fh7tF2PeMyerfLgxvfCMnL9s7MToKAkiZe/bgnVXhDxU368nGblNx2MWdimNY+iIA6F5L9rg75Am7 X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:nebula.arm.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(396003)(346002)(136003)(39860400002)(376002)(451199015)(40470700004)(46966006)(36840700001)(82310400005)(2616005)(36756003)(81166007)(1076003)(40460700003)(186003)(47076005)(7696005)(336012)(426003)(41300700001)(5660300002)(8936002)(356005)(86362001)(6666004)(70586007)(8676002)(36860700001)(6916009)(4326008)(478600001)(2906002)(44832011)(26005)(82740400003)(40480700001)(316002)(70206006)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS2PR08MB10033 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT046.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 62bde89b-84cd-4501-6aec-08dabcd3941c X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fVaE23PEkf0uhbR/uoq6BQAO1Et3CyqsAZwbM2rp18wzi/GTS8An/WfSfD6HhOO6F7qbc0/aJBlQmsbvo+vaUns+/Cl+JWWe54EwNqoJEgIPR05dFZqzcoLNn3XyVxRnOzPedLZsm9je05eU3+Q+CZNSWbzHmf7RYq0h3bX8JVGwE6x/JlyVmLZv3rBq3YifqJWaskNxOgBJM/G6Gg1dwDyiXd+aGA+NTPkORp9cDF5/VhBpaTAVAU2jg5WlGAfQYxuEJnANPY6hdTmQIQi57hs5/LLSStRxdfTFqfIHrEkKJqerSKGRbB68flSyIcCOMp2PV2tDCfMaXSkhQo+YHuDxz9WM9CiIqEe+TtmVXOJSggqqHe1h63rXRPQcLbo7JODvtoP74wxDWIS9SwIEHAa4GGkIyEOCj3oOE+zdMJM/WK7CqGrgt1dbaERpJX5EfawXXN+y33uROCi70WGnHFnMT000ogk7fe0+zc7jWMnReZQHKsECCSPMW9KrqszxySrAWPyVXL+0DyfR/Ob5Hj8iNIHFwX7crFU3Gz03HH+5RnnDfXbKLgOcRq3pM/OFS4CczWyCo9piJvDxBoqA/Vm6KNo6ijHJv2NhL+y7M6kw2DA99/3jHZULJAqURgZxX+T2az+Ny4PAEX5mExKF6Zgr1MVRl1WI50a6xNddGp/OdMiF02i68mG467uIEs5LXp30zPHNDIbCKsUGzBL5Xbt+QMWYpmyXnT0Dz7FAC47AXErYYtQaO4Hd4Eehlv8qvDnydS917npwo7emW+lVig== X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230022)(4636009)(39860400002)(376002)(346002)(136003)(396003)(451199015)(40470700004)(46966006)(36840700001)(478600001)(1076003)(186003)(2906002)(2616005)(44832011)(336012)(6916009)(82740400003)(4326008)(36756003)(8676002)(6666004)(316002)(7696005)(70586007)(40480700001)(41300700001)(70206006)(40460700003)(8936002)(5660300002)(47076005)(82310400005)(86362001)(26005)(426003)(36860700001)(81166007); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Nov 2022 13:10:27.3331 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 54d20fc6-e51f-4cf5-b9f0-08dabcd39c55 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DBAEUR03FT046.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAVPR08MB9673 X-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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-Patchwork-Original-From: Christophe Lyon via Gcc-patches From: Christophe Lyon Reply-To: Christophe Lyon Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748390054049499020?= X-GMAIL-MSGID: =?utf-8?q?1748390054049499020?= When a list of dirnames is provided to genmultilib, its length is expected to match the number of options. If this is not the case, the build fails later for reasons not obviously related to this mistake. This patch adds a sanity check to help diagnose such cases. Tested by adding an option to t-aarch64 and no corresponding dirname, with both bash and dash. OK for trunk? gcc/ChangeLog: * genmultilib: Add sanity check. --- gcc/genmultilib | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/gcc/genmultilib b/gcc/genmultilib index 1e387fb1589..ef121e77d17 100644 --- a/gcc/genmultilib +++ b/gcc/genmultilib @@ -141,6 +141,20 @@ multiarch=$9 multilib_reuse=${10} enable_multilib=${11} +# Sanity check: make sure we have as many dirnames as options +if [ -n "${dirnames}" ]; then + options_arr=($options) + dirnames_arr=($dirnames) + nboptions=${#options_arr[@]} + nbdirnames=${#dirnames_arr[@]} + if [ $nbdirnames -ne $nboptions ]; then + echo 1>&2 "Error calling $0: Number of dirnames ($nbdirnames) does not match number of options ($nboptions)" + echo 1>&2 "options: ${options}" + echo 1>&2 "dirnames: ${dirnames}" + exit 1 + fi +fi + echo "static const char *const multilib_raw[] = {" mkdir tmpmultilib.$$ || exit 1