From patchwork Mon Mar 4 17:36:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evgeny Karpov X-Patchwork-Id: 1907814 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=microsoft.com header.i=@microsoft.com header.a=rsa-sha256 header.s=selector2 header.b=c4eZxUEY; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TpQr41Csnz23cm for ; Tue, 5 Mar 2024 04:37:24 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 262643858D28 for ; Mon, 4 Mar 2024 17:37:22 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2122.outbound.protection.outlook.com [40.107.21.122]) by sourceware.org (Postfix) with ESMTPS id 16DE93858D28 for ; Mon, 4 Mar 2024 17:37:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 16DE93858D28 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=microsoft.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=microsoft.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 16DE93858D28 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.21.122 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1709573824; cv=pass; b=OzjlgRmAsxs6YfeIcrBGu4MMUli749mytMAvxOgT7yzfvUCWowyh82/6tNI09wbIJLfc1m94tM36mfsohbwUxGb5lu/UKF0X7vHbpb5trBeimQLTHaEq5BnPXjOTNvk8BR+osNfv+hafj2ZAVgAErCLKSuXgljGaKPMvrBEGp8s= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1709573824; c=relaxed/simple; bh=SWoWQOyu41/pYok7gEwthdA/iUOqOZH7RHymAyPGDt8=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=i/8VaNymx3BQScrbn3Xv4IXW4Fh9K4fSrX5fSgQiszRswgLUuiErP6yxYqllWxBnYS2pMmdrBeDO3zERN3dPyeL38EOzvGg09ZCuZI2LH2d0GW9Yu+VI87OYSovTWqQ3DPfxl73uVFz57m1GiGLXDP30YINbYt5XyY/vRY0HMjQ= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZvANlGBcfGKB83pfoBFeBIJgKOo2RwNLBK9nimrKYMVBoQxhoJYgSteauFwlq9htNFQqGfIb63gHNsiN6EEWe/pCDKdaoZQyEyjSGV9jQiV6eYj57oaNLTH9UtHojSr8o9BIKQ0wkFCBqK7UTcEaipW6pxaVgqOZfr790VSI6F6ma9YuQDb2go/OPzVu1TC4GWENg1zdzwdyhImrU1NaYlozzNxMme3iF7aAZ/3RKTMkG2efBqLVuSWTpflwFuPvOyU0aksaoj+mQFWzfFGIxHUCt0H+p2gRWWOBUOVk8cTAI4OoCauRGd379bCb7aqrqt1IGdwoUN3y8pvN68aXdw== 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=aKBefbW3izw8bAl6oul6mbNwxfTXjuZECeB153idPcw=; b=n19iXfiC10UF4/MfZQtQ66YbyIfBeEGms2SeEWtSPm23BcmxB8NMGMpXpAdyeAWf5Wsc+pf7Z4mYuKIR843MMuI/FaRNwncNbC6hngNkE8XENBTFnYKsQp3io2A0Pgbv1OT9aroCd/3N6JMXZL+ZS7vDP2xu7Y/jkfYyXmtYXhWCeKkFMRrbZ4RNXkCUvEPlM8acHOyCpyuZGWxEMAddFEhVD8fJ597qMrW2G/wkxOzBEcytwQJUdwjrHcjaq/NCOhY+M/bP/Ny/tgz1/aE0g6UAnPIx8iiIdraGSJd/1ae4XA8M2CcK4jGYbfEkT48BuBqrTwbIdadX5TDjJY5t5g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aKBefbW3izw8bAl6oul6mbNwxfTXjuZECeB153idPcw=; b=c4eZxUEYzlPfF8LCeyvzm00hzfLrvm3JovY8PhwZWaivuIfUU1VyIsPX/L91zHqLdetxT/hwu4+nQpCr07+SNTw38yLtrllnV6yBWqVRuutIn/lwBMXfWVcP/8cnIR98PCkScga0uG+AcHoV3bnPQBzF3ejjlOWGOqIbCXZmkAM= Received: from VI1PR83MB0431.EURPRD83.prod.outlook.com (2603:10a6:800:17f::6) by GVXPR83MB0607.EURPRD83.prod.outlook.com (2603:10a6:150:154::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.3; Mon, 4 Mar 2024 17:36:58 +0000 Received: from VI1PR83MB0431.EURPRD83.prod.outlook.com ([fe80::7279:eea0:8540:a0f5]) by VI1PR83MB0431.EURPRD83.prod.outlook.com ([fe80::7279:eea0:8540:a0f5%7]) with mapi id 15.20.7386.002; Mon, 4 Mar 2024 17:36:58 +0000 From: Evgeny Karpov To: Evgeny Karpov , "gcc-patches@gcc.gnu.org" CC: "richard.sandiford@arm.com" , "Richard Earnshaw (lists)" , "Andrew Pinski (QUIC)" , Maxim Kuvyrkov , Radek Barton Subject: [PATCH v2 03/13] aarch64: Mark x18 register as a fixed register for MS ABI Thread-Topic: [PATCH v2 03/13] aarch64: Mark x18 register as a fixed register for MS ABI Thread-Index: AQHablqOcTlrCnDWmkGJrIQEWv0miQ== Date: Mon, 4 Mar 2024 17:36:57 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ActionId=804f8e78-f263-4809-bbd5-d515c5934d44; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ContentBits=0; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=true; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Method=Standard; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=Internal; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2024-03-04T17:10:26Z; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=microsoft.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: VI1PR83MB0431:EE_|GVXPR83MB0607:EE_ x-ms-office365-filtering-correlation-id: b855eb9c-6141-4a61-68b5-08dc3c71b0e0 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 8uPR6rTa6Im+dHNZ/hnOWR6eGZmqFO9w/iSN1zpicBEN7Dt0LrDaYv1gRuQdRdxeTYrJorTOgpGIL3sef0M7SyyRIQLTZHgsl5o6yuq/R9wk3dct4X3aaUtnOIQ2g4gNLQrIk3uxUSJaDDTUej1U1ZA7xNEoE5TbXZd4AL8nmGCpGu6HQDJmFrK896cqiHl/kNDVsYwSD8o6J2EAf71yBL6QRs1tDNX7gcwqzAB8VwiZNSormJ55CtEZNGl0wcc5YYcmNfwpbZmlhH5uxjh80ldN99aNAGx+qXFlhbo1HFz36PE+FstmQAx60a+NM50NbD3mIci3n/PGV0slvEfAYqUOvSStyLFPzvInaMxH/TQ/Y76DR5bmJBqF0uckIy0D51zwKwv+sfleC6ooOpmXZSsdRucmB1B2Axkdhyp7i0usPCDvkcjV9ztLp5Wsvl2hKZrekIye7r6OJa/WhuxXcRF8jFVVFvmt2ox+41kKiksSW08vNIMG16F633f2PEKE+7TEoxhnbTsL6crMBLrimjhb6L4e9vs9/5LUiNnTtxoz60D/v1SwFHqZZ+6qLt+WuzBPg1eqN6Y+ELI0NqmRalTAM7mgsqjA4dNAvqMjKBCesgdWQ2dbxkTKP3JzWEw8xE2tyqqSyLvqdWxKfKlKV9LLuBPDTT7wq+Byv+dbpXk= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR83MB0431.EURPRD83.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376005)(38070700009); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: IYNfKl3jXgSO+VxcPnrbk8r5WcYxgUTtrFGKB48Qrsdqr4QSNbuG8XcdBeYCPh+IYX6AUGDdm0WU2McXL3+DZGeRZyOfmjWoldy0OdVjVdIWPe+8ohL6JpXUSWS98YobJRvSP+tjbm9Jvp+674PnGzkf4Ct2Km+jQNOpm8f9qclzbTwx+4rB2QXgyTasHcWfDB8RQq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tNDGLHRXkeagR80moLADKjmxwTAaq1A7mj2XgyZTmVVPdF8seg9IleCL7XZrshLBJfm1obxljgkDtnx+VgT7woQGDfXhxZkKAHLNBKWUFasHfMTDOr8tF3h+6md9x+cSvLnasZO//lOEsyUXKRxm5Sb1MbFPFI2i+qp8YkGoLvU0/6a2kev/wxLc2lVitu7O1sXbmP/AXMNo7VQ7JMDML7eFRRp3D3pOWsGeqeuUP8THw2kKf9J4wSoqvRqWe1Ox/TilMZ/Vx49FMF+mIaeXsqzZUIOH8xNRAk+KIlZcoj8yT1IatFRF46u0KYYgraMaDUclvaAiUF1DoInUYmp MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: VI1PR83MB0431.EURPRD83.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b855eb9c-6141-4a61-68b5-08dc3c71b0e0 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Mar 2024 17:36:57.6081 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: wzsj7zxqvedCjTapkrMmsgo8TR36WTFyAHLTlSvH9oWbFvbJKLemD/Z/3ncr12N6Dzfqme84jleeQwjlgCjaVw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR83MB0607 X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_SPF_HELO, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org From: Zac Walker Date: Fri, 1 Mar 2024 09:56:59 +0100 Subject: [PATCH v2 03/13] aarch64: Mark x18 register as a fixed register for MS ABI Define the MS ABI for aarch64-w64-mingw32. Adjust FIXED_REGISTERS, CALL_REALLY_USED_REGISTERS and STATIC_CHAIN_REGNUM for AArch64 MS ABI. The X18 register is reserved on Windows for the TEB. gcc/ChangeLog: * config.gcc: Define TARGET_AARCH64_MS_ABI when AArch64 MS ABI is used. * config/aarch64/aarch64-abi-ms.h: New file. Adjust FIXED_REGISTERS, CALL_REALLY_USED_REGISTERS and STATIC_CHAIN_REGNUM for AArch64 MS ABI. --- gcc/config.gcc | 1 + gcc/config/aarch64/aarch64-abi-ms.h | 64 +++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 gcc/config/aarch64/aarch64-abi-ms.h diff --git a/gcc/config.gcc b/gcc/config.gcc index 2756377e50b..b762393b64c 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -1265,6 +1265,7 @@ aarch64*-*-linux*) TM_MULTILIB_CONFIG=`echo $TM_MULTILIB_CONFIG | sed 's/^,//'` ;; aarch64-*-mingw*) + tm_file="${tm_file} aarch64/aarch64-abi-ms.h" tmake_file="${tmake_file} aarch64/t-aarch64" case ${enable_threads} in "" | yes | win32) diff --git a/gcc/config/aarch64/aarch64-abi-ms.h b/gcc/config/aarch64/aarch64-abi-ms.h new file mode 100644 index 00000000000..90b0dcc5edf --- /dev/null +++ b/gcc/config/aarch64/aarch64-abi-ms.h @@ -0,0 +1,64 @@ +/* Machine description for AArch64 MS ABI. + Copyright (C) 2024 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. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_AARCH64_ABI_MS_H +#define GCC_AARCH64_ABI_MS_H + +/* X18 reserved for the TEB on Windows. */ + +#undef FIXED_REGISTERS +#define FIXED_REGISTERS \ + { \ + 0, 0, 0, 0, 0, 0, 0, 0, /* R0 - R7. */ \ + 0, 0, 0, 0, 0, 0, 0, 0, /* R8 - R15. */ \ + 0, 0, 1, 0, 0, 0, 0, 0, /* R16 - R23. */ \ + 0, 0, 0, 0, 0, 1, 0, 1, /* R24 - R30, SP. */ \ + 0, 0, 0, 0, 0, 0, 0, 0, /* V0 - V7. */ \ + 0, 0, 0, 0, 0, 0, 0, 0, /* V8 - V15. */ \ + 0, 0, 0, 0, 0, 0, 0, 0, /* V16 - V23. */ \ + 0, 0, 0, 0, 0, 0, 0, 0, /* V24 - V31. */ \ + 1, 1, 1, 1, /* SFP, AP, CC, VG. */ \ + 0, 0, 0, 0, 0, 0, 0, 0, /* P0 - P7. */ \ + 0, 0, 0, 0, 0, 0, 0, 0, /* P8 - P15. */ \ + 1, 1, /* FFR and FFRT. */ \ + 1, 1, 1, 1, 1, 1, 1, 1 /* Fake registers. */ \ + } + +#undef CALL_REALLY_USED_REGISTERS +#define CALL_REALLY_USED_REGISTERS \ + { \ + 1, 1, 1, 1, 1, 1, 1, 1, /* R0 - R7. */ \ + 1, 1, 1, 1, 1, 1, 1, 1, /* R8 - R15. */ \ + 1, 1, 0, 0, 0, 0, 0, 0, /* R16 - R23. */ \ + 0, 0, 0, 0, 0, 1, 1, 1, /* R24 - R30, SP. */ \ + 1, 1, 1, 1, 1, 1, 1, 1, /* V0 - V7. */ \ + 0, 0, 0, 0, 0, 0, 0, 0, /* V8 - V15. */ \ + 1, 1, 1, 1, 1, 1, 1, 1, /* V16 - V23. */ \ + 1, 1, 1, 1, 1, 1, 1, 1, /* V24 - V31. */ \ + 1, 1, 1, 0, /* SFP, AP, CC, VG. */ \ + 1, 1, 1, 1, 1, 1, 1, 1, /* P0 - P7. */ \ + 1, 1, 1, 1, 1, 1, 1, 1, /* P8 - P15. */ \ + 1, 1, /* FFR and FFRT. */ \ + 0, 0, 0, 0, 0, 0, 0, 0 /* Fake registers. */ \ + } + +#undef STATIC_CHAIN_REGNUM +#define STATIC_CHAIN_REGNUM R17_REGNUM + +#endif /* GCC_AARCH64_ABI_MS_H. */