From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2124.outbound.protection.outlook.com [40.107.14.124]) by sourceware.org (Postfix) with ESMTPS id ABCA83858D1E for ; Thu, 11 Apr 2024 13:48:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ABCA83858D1E 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 ABCA83858D1E Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.14.124 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1712843293; cv=pass; b=ZNwSnSWTbkieCnzKXrIrNKpJ09T0ExugCX46wCMBv//tvrYw6VprKF5HtJhfyKpUPCnsoVjpwwDXCA8denGz11Y2iTrYTC9NIEmSo/O4W6SICSlegIaR/0tHlzKMURZ+pVIq5Wk+FXRoZs/WDXxT234Y2que1QHRgNFJ043oYio= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1712843293; c=relaxed/simple; bh=3h7pEFiG1NPnf4OSfzvgWFdpKKVf3Lf5PNnfbit5+As=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=qYIrFRB+9QmBflsofl5Lqu9b6Xi6gmawbelAvEJeMwwEuGq4EENa2ztO8aLAgWSK3mgYN5GcmifIIMiUnIR6GDrJ/31lnIlnSEdvYkIlDXhcdDjoKxnHsPFZTGFAUNkLzrmWrtxKYb7HC+7reDltoeCLd+sTbPOlAM7rxmB7qak= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MR/OcBc18y80EzsOBA38pMqzgdmSsTlTVPucGGzR6esRlFIoDFSzsEFUou8Xj04KvCETuGsm17DgCiy1PdD40DIjHqd4haMDVoJPW2FCML4w9qaGeIda9tHV15oZNdlTt2kqqC4ogWXKZYUIpXNXZUNNOBT3CAsoovgTryODBEvFRKvHPU479uRuzBMRUH4XzDfMn3Oef4W/5K5snzklFhKrIpSU8o/tnr+Yd/v2tCx4QlcSMiIcIssUgGUcNaENSuq34EWDfaLZXJY6HYsOWcS0ab1DLWD2xvhf9mOuF76zknQavwOpj9m0XdnSTWUpIm03oLpBC9Sz7gMUdnJWpQ== 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=2QATl/onvOtfns9+3vblaNxC/W6pUmtRjWsmKeF1djE=; b=mJh57UrtYxgKeFiPYHjHGuL0NsaPNKG3Ub/RBDjXi0MWmw6q2a2kBObyaMdD3FVb09kIsx1LqI/UeN3pEIrpPPvvMx739J2ds1JzxnDW/Km/F7CMpqD+DoO38BNykqND+I91M+9r5RJM/mqPB+RY229bakpczSLPjSqhjn041eYZZ4TXKQaGOouppkNN1fMHjtyJBjLCAvuGQXTLJpjGwFlNEmGffM1W5trceZVcAL5qESjKLNu/oJlKB06CiqKBOT5G7/DoRImRg1oRTkZzPNSKKwJ1sIandoz3xAl7STgw5iMqAlve2T03gWMLAToKkzmgEwTdwRRV2QuoMypU7A== 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=2QATl/onvOtfns9+3vblaNxC/W6pUmtRjWsmKeF1djE=; b=RJ2TtnEch09I/xEwk5LUOvj3/pK8k0EjSG2Sfa3SToaND/74WYvdP1G1xZHugqz81V9yAqihsxWDYkK1lJuJYePi3u6rIpWON+TV1K7LhdEdZcpC/dGYkLTXUtIfHHwU4+J0ZPVhvk4u8CJqSp1aV2Gpog6wSUkGfNltkDoakg8= Received: from VI1PR83MB0431.EURPRD83.prod.outlook.com (2603:10a6:800:17f::6) by PA4PR83MB0525.EURPRD83.prod.outlook.com (2603:10a6:102:26a::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7495.12; Thu, 11 Apr 2024 13:48:08 +0000 Received: from VI1PR83MB0431.EURPRD83.prod.outlook.com ([fe80::7147:b7f9:31fb:39f7]) by VI1PR83MB0431.EURPRD83.prod.outlook.com ([fe80::7147:b7f9:31fb:39f7%6]) with mapi id 15.20.7495.011; Thu, 11 Apr 2024 13:48:08 +0000 From: Evgeny Karpov To: Evgeny Karpov , "gcc-patches@gcc.gnu.org" CC: "richard.sandiford@arm.com" , "Richard Earnshaw (lists)" , Maxim Kuvyrkov , Radek Barton Subject: [PATCH v3 02/12] aarch64: Mark x18 register as a fixed register for MS ABI Thread-Topic: [PATCH v3 02/12] aarch64: Mark x18 register as a fixed register for MS ABI Thread-Index: AQHajBbiQGMzAYXS10uSKrv9x9omSg== Date: Thu, 11 Apr 2024 13:48:08 +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=ee10a91a-ecb0-4ef6-a7aa-22b9c54f3645;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-04-11T13:35:01Z;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_|PA4PR83MB0525:EE_ x-ms-office365-filtering-correlation-id: 8dfa9a30-054d-4592-3765-08dc5a2e0556 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 7L4Nm3m9Ly3uRQY5KtvXkZ5s2qcAQy9RhaSxEuivF1k1OyRyvaD3hMwTK81lr0AKy6hjrzi8of92vRPKiaIc6eXiUK4T9tDj6ndSgB+Hj11iH1w6CmbCCAYhTt1rhV5BoUAekTKg2khNG27fK+7ICAgryKGFgepBSEuksERmD3E9X5bfE6A+mmM9sOERlFTk95JTT1TO3Q0ZzzSxY078dyUQoFJUx1AbrR5Ynx0NZwVXrJ+sKOgGE9CwHt0tbDDJhqssKFjhXzCbktGRPcPfcgXmDJLTzzOftJbh0SAZnudq27R7+oC+HPQU43st3lJxGFboTVsZ3xWhTJMPGGktjuHH/x7drtYaI2aAJRZtbGjv1iv+Ms+QFNU4nfLldbFFqTtZTp9sLJD8m/5UOC63kVaCmXDgneNm5546yq6xhwFGTPH85pLTfuRPiB+7Igzec/yc+YijcPJtQ/ZtEZa+eOtUMUAbqWBHeyy5sOwzYtOO2CJLHbOFcsCfFcpddkx8LE9e9GaEf1CyDLcl9Ntkz6p+hJAGMrUl/5Boj6Z6iLBazxjoMuVj+5su/LPEjLOziJCuBqaceYS8vNpVfQHivOz/KDUoeEz1Ko31KzKFHFTYqCdqhFZH1eftSV+4J2ABu3jWgSeeRMoiUSDReq98uOAgwq5qAFkiokJVgUD7kZM= 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)(1800799015)(376005)(366007)(38070700009);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?P6hs3K8YLHvRzumUYUC4ixW+gyXIdWQqdtUGN8CzS/wC84yORLWa0HkqsF8z?= =?us-ascii?Q?HKwD8qNAplu/FtNglR/coYosB99fF63f0JamRjjYU8TzLCo8PHnm7TYri2SG?= =?us-ascii?Q?gyCXZfxJBAcN/rrfgG1U4yp68CONdEWnYkClS4vQ2sOFQzEI6mxgt0KD6Q3T?= =?us-ascii?Q?rEvF9/jPL7LCyeN6jZNUulXmMymUOblYkCeh9kBBUmQclalf/F7VCN/p0PhI?= =?us-ascii?Q?Z89m562gcZRLBw6v8ps0TWHSB9FWrUXEjdGEsVNnNFirRU2jZwkQX5B0C1Yl?= =?us-ascii?Q?C1X/DMMtkeHo2eNAMSmcdmZplw7aUiJmpC38tZiADvJHZrAqxByyBCfYPs7S?= =?us-ascii?Q?XpyVIiLEwp3LVcBTWdqMaczI3A9Tu2g3LGQ02SsbxtSEgfr21Z4xltYiG5R2?= =?us-ascii?Q?u42rswcXEVAeb5RpdamcSWMygTP4eTo+z6HXHo6vXMAXC/R4srZZxo7JKIC8?= =?us-ascii?Q?Qx7/VJhrSa8moIIya+LBmiqubPIuyFnwWyqT9UVu4R3k6r+GzRKufs7sOO+B?= =?us-ascii?Q?9Gu27dcAFgXXGbfZ5Aek4AQPLYuFQ2yIpG3zpx+ffDpvX2U+T/Ig7XNMK2lv?= =?us-ascii?Q?tWiUwXGwu9fKU+PCIt0s6WIflbaVo8hIy4NABG9B99Il8GCQEtTtmTLY0T6W?= =?us-ascii?Q?Et6ZdSlVPD6kBGFHrKDebKEKd/mSoGzz6F6Z5KNP+3o7OnDenKmxYFwm36ts?= =?us-ascii?Q?X+C2sW4rC22YnpndMRtrjgxXBskH7OtxRGz4vRv5V0PqGfZHOzmiPyV+IfAD?= =?us-ascii?Q?0dJFIOJioTLQvWUvxtmHQyRwwxkiOf1pPfsMn468N3NH8rfaS/485ciEdne5?= =?us-ascii?Q?GROZfZxzOZCECIu3x4a3jSWQnfjtDWfpPbLWZwa91SxZ+h9zlh+NADx2jvbX?= =?us-ascii?Q?dmwpGoEVXbLPmo4qPeffWcDDv5gvUj5QhGGwCbb6YXsM1Zam2jRokblwKj6C?= =?us-ascii?Q?I2fKjUpcMRnWxZW5PUWGsI7eONnTjnik88YvJmnLVzNEizARM6aUpa9l7Ob4?= =?us-ascii?Q?+DbRxy2xx0LR/VQF7xj254oIaIecsbOU2TD5BjvEwuej0Bs/YOoumhAXgJVZ?= =?us-ascii?Q?XIlIuWesy3MmgGgYcX6nZK+xhKv54LlHkFWGS9ei2vQ2ZMDCEKfe0CR3efPk?= =?us-ascii?Q?8Nsa96DGNGK9qLlQ3TVO0kH3EXIhNp8rPm7W2m72KRpTOuQulPDnGHos37oo?= =?us-ascii?Q?4p46nfN0c5IktTFmuKY3MbMpt8a0EfROHHY3uJH7+qAus9xr7XYWdQ9H8ycG?= =?us-ascii?Q?71V5puRW6v7S8S/qe9VOJ3aX8HQLmrR/ozzMpNuXE5wtwhZpr9819ME4Blsv?= =?us-ascii?Q?Z7Ol5Lndu406IrV+2inmhy+WU4KXva3w75EdekoHBtmYQg8MPYGrsCt1k4/U?= =?us-ascii?Q?Le1jr1nBXlD4muHU/3EeRXtTkffRB6WRJ22jHCaXCYJNDNqzO2fC3hJpWO8+?= =?us-ascii?Q?qPatJZvT18XSsnzPFdHoeY2yafuJvTzaph+Ui1jv0lp3uRt+Ow2EkLPtlWy/?= =?us-ascii?Q?VqNmpWDSO8vAU0+7O2jOvkRXt1ionEeWm+2NINGq4OLTxdWRA1QcD9yXwbVh?= =?us-ascii?Q?zPwTCfvUNGra/nhxc8zLM7psX43XwsrkwAU4rZ1G?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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: 8dfa9a30-054d-4592-3765-08dc5a2e0556 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Apr 2024 13:48:08.3749 (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: 7OUPf+CvWyO8yQKZHzS2EKaJTXgkTSwrcC/MNbI52h8Lp4xfMtir9iGxpfztLe8OAT2yeK0NWVcC1IFcP7xKGA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR83MB0525 X-Spam-Status: No, score=-11.1 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 autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: From: Zac Walker Date: Thu, 11 Apr 2024 13:30:27 +0200 Subject: [PATCH v3 02/12] aarch64: Mark x18 register as a fixed register fo= r 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.h (FIXED_X18): Adjust FIXED_REGISTERS, CALL_REALLY_USED_REGISTERS and STATIC_CHAIN_REGNUM for AArch64 MS ABI. (CALL_USED_X18): Likewise. (FIXED_REGISTERS): Likewise. * config/aarch64/aarch64-abi-ms.h: New file. --- gcc/config.gcc | 1 + gcc/config/aarch64/aarch64-abi-ms.h | 34 +++++++++++++++++++++++++++++ gcc/config/aarch64/aarch64.h | 7 ++++-- 3 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 gcc/config/aarch64/aarch64-abi-ms.h diff --git a/gcc/config.gcc b/gcc/config.gcc index 6f97f24af10..0aeb5641461 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -1272,6 +1272,7 @@ aarch64*-*-gnu*) tm_defines=3D"${tm_defines} TARGET_DEFAULT_ASYNC_UNWIND_TABLES=3D= 1" ;; aarch64-*-mingw*) + tm_file=3D"${tm_file} aarch64/aarch64-abi-ms.h" tmake_file=3D"${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/aarch= 64-abi-ms.h new file mode 100644 index 00000000000..15dc33d0474 --- /dev/null +++ b/gcc/config/aarch64/aarch64-abi-ms.h @@ -0,0 +1,34 @@ +/* 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_X18 +#define FIXED_X18 1 + +#undef CALL_USED_X18 +#define CALL_USED_X18 0 + +#undef STATIC_CHAIN_REGNUM +#define STATIC_CHAIN_REGNUM R17_REGNUM + +#endif /* GCC_AARCH64_ABI_MS_H. */ diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h index 45e901cda64..6d360ca3e33 100644 --- a/gcc/config/aarch64/aarch64.h +++ b/gcc/config/aarch64/aarch64.h @@ -536,11 +536,14 @@ constexpr auto AARCH64_FL_DEFAULT_ISA_MODE =3D AARCH6= 4_FL_SM_OFF; register. GCC internally uses the poly_int variable aarch64_sve_vg instead. */ =20 +#define FIXED_X18 0 +#define CALL_USED_X18 1 + #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, 0, 0, 0, 0, 0, 0, /* R16 - R23 */ \ + 0, 0, FIXED_X18, 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 */ \ @@ -564,7 +567,7 @@ constexpr auto AARCH64_FL_DEFAULT_ISA_MODE =3D AARCH64_= FL_SM_OFF; { \ 1, 1, 1, 1, 1, 1, 1, 1, /* R0 - R7 */ \ 1, 1, 1, 1, 1, 1, 1, 1, /* R8 - R15 */ \ - 1, 1, 1, 0, 0, 0, 0, 0, /* R16 - R23 */ \ + 1, 1, CALL_USED_X18, 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 */ \ --=20 2.25.1