From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130081.outbound.protection.outlook.com [40.107.13.81]) by sourceware.org (Postfix) with ESMTPS id EC78C3858D33 for ; Thu, 28 Jul 2022 15:44:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EC78C3858D33 ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=QP+3DWGtde/VzSj8tNsBkZeEE/1EhYLDyyRzq0bPWQfHg0QNe19Q9iUXxsf85Ou+58AXD6UajlqQq1E3IPBZFBwb+Ueo0nLJkjSf3MKwK1e2+ycB/1dpwYySQk0NkivTGuR3IQ1JMZoCeh57lUf5tq9lQmNrfuWLxaKZvNrDzoDxU4uwy3bWnMaxEyZaYtD0mvzbkvT7mslcd5cSeOF/gHSz5I6HzdQXj8R4Tbl90h7Q47Cs4K4hh6eOO+oVzCE5xrDwjz9aP9vglDWKAd0QBVURO+ffIBKX2JpeW5VvyeTKkPi3Mn47rlu561Oarp/4CYZD7+aSuy2MR7115mGAhw== 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=gI4kZouu3TBgI9e1ML1/jX7iDCIi7JU4ZHKLglBqJgA=; b=ZRu2Clr+1aJRuV77tqrjsNqdyuzm3hulq7skgWKmYBSHYEUz/jylVEBTvcIWTTfNSyA76xuWBb5QvCbIgYf6SdjkR8f38r/MvplBQt41/WTWgZglb0a2Ejh+qVClDb+nH4lVVMObjZoWHqrhB0GiPGGcwJVxvEdmLLXvms2/mOAD1LPPU5WdRbPuf8TyuG6+QlkP8P4m83ML6qwLdWlxHQ5aNpn1UOtCmzyOrRUgqb8wTsv6nhkJSoDFTFKcAsSDx4sN9tc3t5kz5h6oDBRtFSWgkAr1mhaxwpcIMKKvhGCSW9jZP4OxmRDcAc3WXCJgHUO9ezDmoXnRI3rqRpuSuw== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=sourceware.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 DB7PR03CA0075.eurprd03.prod.outlook.com (2603:10a6:10:72::16) by AM0PR08MB4401.eurprd08.prod.outlook.com (2603:10a6:208:13a::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.24; Thu, 28 Jul 2022 15:44:47 +0000 Received: from DBAEUR03FT012.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:72:cafe::51) by DB7PR03CA0075.outlook.office365.com (2603:10a6:10:72::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.10 via Frontend Transport; Thu, 28 Jul 2022 15:44:47 +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 DBAEUR03FT012.mail.protection.outlook.com (100.127.142.126) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.12 via Frontend Transport; Thu, 28 Jul 2022 15:44:47 +0000 Received: ("Tessian outbound c883b5ba7b70:v123"); Thu, 28 Jul 2022 15:44:47 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 9cbdb77df8e91721 X-CR-MTA-TID: 64aa7808 Received: from f820811346d8.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 6763F4B6-0B8F-42C2-B6EA-AFE07D1C824A.1; Thu, 28 Jul 2022 15:44:40 +0000 Received: from EUR03-DBA-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id f820811346d8.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 28 Jul 2022 15:44:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fSm+7IH3P81b+vM97duARewXISuR9BoI4CKElJRT/VaHDRIX8sH+cNEOcFpgTofHYKiqA4iEoo9yRIAnXn1Fjpj3Y262++iu0fvMhvpssqCEZ9VphCr6/064T2zpWqqXfJPruKJCjSdfdaMwp8wgai/e+N6Uxfd9cUMARQrbcaN4OSGtkB8MXwcpmu83mGhw0Bfpx3zKBpE3IsQmnC5tnriAuxBus0gHqtBkXbZdfsVALgG5JchyQjYYFfn2x49VWD2dY9kt1qB4Trd7CTjPOsbdrk2ZyEoOPGo5UFGtngeJjOqJvaAsCzUxT5MOOrGgWXouimzbNwFqiGp+K8LWnA== 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=gI4kZouu3TBgI9e1ML1/jX7iDCIi7JU4ZHKLglBqJgA=; b=WVgIIxQ1tnI0UNNCsTCu2YxetKT3Kemda8x4tIgj3xyvcLMbe2vy3hDo9s/WCBLEvHQiHQQ4zoP3Qfs8ggrOUX8Gp0rQ7n2SScvLcxfOR5YhA2nZVbTOCLKcC13zW249Bje+vuX7QMLhAz7gEX6W3uaqgoajPwVGRcttTfdptxmPYlilb3QJuIhP8Zh71nDiVSSaMTBG70zvpDdfFO577EZwetY+MlIMMCMTBmhOFd/BFXxjRsLWhszbo6sl5Z/5dYAoVxIOymZaNZC6i97sFbzMLTQUuggAXrV0Iag2rkA3fWE5xC2TF6n5s0kkmXqZgJcMG9IwUQUIZBziuI0hjA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=sourceware.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 AS9PR06CA0167.eurprd06.prod.outlook.com (2603:10a6:20b:45c::19) by AM0PR08MB3426.eurprd08.prod.outlook.com (2603:10a6:208:dd::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.20; Thu, 28 Jul 2022 15:44:37 +0000 Received: from VE1EUR03FT043.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:45c:cafe::b6) by AS9PR06CA0167.outlook.office365.com (2603:10a6:20b:45c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.10 via Frontend Transport; Thu, 28 Jul 2022 15:44:36 +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 VE1EUR03FT043.mail.protection.outlook.com (10.152.19.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5482.12 via Frontend Transport; Thu, 28 Jul 2022 15:44:36 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) 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.9; Thu, 28 Jul 2022 15:44:35 +0000 Received: from e125768.cambridge.arm.com (10.2.78.50) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2507.9 via Frontend Transport; Thu, 28 Jul 2022 15:44:35 +0000 From: Victor Do Nascimento To: CC: , Victor Do Nascimento Subject: [PATCH v2][Binutils][GAS] arm: Use DWARF numbering convention for pseudo-register representation Date: Thu, 28 Jul 2022 16:44:07 +0100 Message-ID: <20220728154407.49962-1-victor.donascimento@arm.com> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: aa8741b2-da9e-49a6-4f3f-08da70b019d6 X-MS-TrafficTypeDiagnostic: AM0PR08MB3426:EE_|DBAEUR03FT012:EE_|AM0PR08MB4401:EE_ 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: PQ4zxa6A1ep+3n3MX3UbzZ98WRvy8TMh8/9I2h+vOpF3KkWwHHUr985YI9BPa7FN8woypvTHd/U/VtTiFNQtjMYZq4OJ5qcMryXRuZUTH5UajNLEMubK8030p7O7d07Pdl4rUoHZuWdywmySRTl8HZSMPxsv+OzegJiFqVc4rFt3JOudJJMjuwzP/2YRSauMm9WqyEqn4EH9vmXAzo5KC/w4ivHi7ec4KMqB4fjuO6x9tQSKDWyQ0YABCyT+M/Hr6oAaGcWAZ2+4/a8qyriNCYZ6iYrXAbjYe2PZFUai5yNhFcTbQDE/XdZQEzJ7RDqYvSJ8yOKBXyM06n3j/hpMZkGIYY9WVqNZeQetcIhiaOJeb4Fi+TPGJ0v/NbWbJWtn3DylLOi6VIP17n7FTlX4YcJfu5k0+nblWxfmvkBJKZTlNTr9U7DxeDxms1KOMuCsSwEp5RFR0rW1EKtMAE7AHRrewWrwtBGSWJkxGoJ50dHF3rdT8xqsBawSvR7HnvSAqpF0AsWxeHrAGxK9el1pyruYKiRdHfG5ePTqRnTCtkNtcIcNm4UMpXKBi4g+/z+htT8ubHGbUjkWOsieKBVOhOQrpHv1A3id6xTZlfmKGxdo/BAEoTxqgjXI2fxcl7rdVTyVQgI0IbPEiTm9OTJfWtAsxZUOmDkx40CN+EzXX/F0HjsvOIPGbvzjq1eB/fLZE1SRe+aQu3ADtGzP1xUcAtRfPSxiCyWYv3Y3g4WHJ58O3uiBTbAoxbaZndHyBKKMMa5kcPsAJDPPYeDnH4Yu7AI77WFnWgFAt5sYHrnZ36TkbGpIz6j3aC00VU8ZnB3PT8WzmuXpR3FxJokWHs/1zymtv0JqTE0h5rQ8p06a+piUlYHfhMu1tVMVEoWHt8dwdw7LoRbI7vXBcLRIVu4NdA== 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:(13230016)(4636009)(39860400002)(136003)(346002)(376002)(396003)(46966006)(40470700004)(36840700001)(82740400003)(356005)(82310400005)(70586007)(81166007)(36860700001)(54906003)(316002)(70206006)(2906002)(8676002)(6916009)(8936002)(186003)(4326008)(1076003)(2616005)(47076005)(426003)(336012)(5660300002)(83380400001)(40460700003)(41300700001)(7696005)(6666004)(478600001)(26005)(40480700001)(86362001)(36756003)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3426 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT012.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: ec9aedb9-9ad2-415a-63b6-08da70b0134f X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: W7xRAMFbXJjSL1e2EtH0xfItMA9eYVRZ0rSnrfM7n3v7VRhN/9IlLhvcV3zrKwjvmhGZ+0nCspapUSPKzCRbfS9bOASTywvVFn1lE9YVA9O5c03RzNQoJNRDxuNcffUm7GyM9n/1V2/z6+65J0KgHx1Pi8rrFT8ADnLeP8hWVQ3g1VtQjbl4J94HB/2qnYGOaoxlvD9jeIZ8YqoZPCZvMyR4APQqM3vv5FDVIuyJS9LRrP2LYhGHzSbUHBKekJVeJ+lQpcs3UgGfcBIUsM2MbjB+j4rhesBXvMgPZZM+koL3U2XWYNVTdEYvuQakk08ZbubVuuBWwlVVmul4Ua7Cj9K0kG6hadD3q+rRHvaBsHHFRsD+s/Oh99aTJVhHyQJpI1vYIqZoAOTEPb0p6i5C5WEi4asax1Uz89YFBCaBgGpDypNT5nagXQZ/il3TpvqS/uKsis60sCkvWjqAvUYSHtEem/LDh5TW8vchmc39Wm0SyruupIWI1/kJLTSyVp+Vn7fOBD0GrAa82jCmLWnxS18gdv9sJu08+lLbkNxa0OnwgBpcW/5ATu79tRmTLFfWyrMAusoYjSt428DOSrrUifMdYZ4DlWDFusLFIGaPf3U3UugFLGiW8Iy0Hyr4Gg2EVqOsm51tLO/1Ahd83Oj7kDoIELIXIipKZE0JPmtdHUswvYdTa8TLqbO918Hd3Z4YoAJBcuY41ap+D19ppNGe4R2dBA5iVHU5IQayU1//x1wlSwgK81ehBMrJ5rlHSBWzQt0HEL4By/UwkrA43JEXuaqN8nuJKzn2BQKp3p2R2c/mIMuGl27WCDa/3ARLsNOGLbE853gSXKViTxkbST1nGlI36vsOt2LiVHYP1NwcMk0cHuOGrJf1vTmu3BqXy+le 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:(13230016)(4636009)(136003)(346002)(39860400002)(396003)(376002)(36840700001)(40470700004)(46966006)(47076005)(426003)(2906002)(5660300002)(8676002)(1076003)(70586007)(8936002)(336012)(83380400001)(36860700001)(86362001)(81166007)(70206006)(4326008)(82740400003)(26005)(7696005)(54906003)(6666004)(40460700003)(2616005)(6916009)(82310400005)(41300700001)(40480700001)(316002)(478600001)(36756003)(186003); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jul 2022 15:44:47.6376 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: aa8741b2-da9e-49a6-4f3f-08da70b019d6 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: DBAEUR03FT012.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4401 X-Spam-Status: No, score=-13.2 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: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jul 2022 15:44:54 -0000 Hi all, This patch modifies the internal `struct reg_entry' numbering of DWARF pseudo-registers to match values assigned in DWARF standards (see "4.1 DWARF register names" in [1]) and amends the unwinder .save directive-processing code to correctly handle mixed register-type save directives. The mechanism for splitting the register list is re-written to comply with register ordering on push statements, being that registers are stored on the stack in numerical order, with the lowest numbered register at the lowest address [2]. Consequently, the parsing of the hypothetical directive .save{r4-r7, r10, ra_auth_core, lr} has been changed such as rather than producing .save{r4-r7, r10} .save{ra_auth_code} .save{lr} as was the case with previous implementation, now produces: .save{lr} .save{ra_auth_code} .save{r4-r7, r10} Tested for arm-none-eabi on x86_64 and aarch64 hosts. Best regards, Victor [1] [2] gas/Changelog: * config/tc-arm.c (REG_RA_AUTH_CODE): New. (parse_dot_save): Likewise. (parse_reg_list): Remove obsolete code. (reg_names): set ra_auth_code to 143. (s_arm_unwind_save): Handle core and pseudo-register lists via parse_dot_save. (s_arm_unwind_save_mixed): Deleted. (s_arm_unwind_save_pseudo): Handle 1 register at a time. * testsuite/gas/arm/unwind-pacbti-m-readelf.d: Fix test. * testsuite/gas/arm/unwind-pacbti-m.d: Likewise. --- gas/config/tc-arm.c | 160 ++++++++++-------- .../gas/arm/unwind-pacbti-m-readelf.d | 4 +- gas/testsuite/gas/arm/unwind-pacbti-m.d | 2 +- 3 files changed, 96 insertions(+), 70 deletions(-) diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index 2e6d175482e..f2e7f73cc2d 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -742,6 +742,7 @@ const char * const reg_expected_msgs[] = #define REG_SP 13 #define REG_LR 14 #define REG_PC 15 +#define REG_RA_AUTH_CODE 143 /* ARM instructions take 4bytes in the object file, Thumb instructions take 2: */ @@ -1943,21 +1944,6 @@ parse_reg_list (char ** strp, enum reg_list_els etype) reg = arm_reg_parse (&str, rt); - /* Skip over allowed registers of alternative types in mixed-type - register lists. */ - if (reg == FAIL && rt == REG_TYPE_PSEUDO - && ((reg = arm_reg_parse (&str, REG_TYPE_RN)) != FAIL)) - { - cur_reg = reg; - continue; - } - else if (reg == FAIL && rt == REG_TYPE_RN - && ((reg = arm_reg_parse (&str, REG_TYPE_PSEUDO)) != FAIL)) - { - cur_reg = reg; - continue; - } - if (etype == REGLIST_CLRM) { if (reg == REG_SP || reg == REG_PC) @@ -4139,7 +4125,6 @@ s_arm_unwind_fnstart (int ignored ATTRIBUTE_UNUSED) unwind.sp_restored = 0; } - /* Parse a handlerdata directive. Creates the exception handling table entry for the function. */ @@ -4297,15 +4282,19 @@ s_arm_unwind_personality (int ignored ATTRIBUTE_UNUSED) /* Parse a directive saving pseudo registers. */ static void -s_arm_unwind_save_pseudo (long range) +s_arm_unwind_save_pseudo (int regno) { valueT op; - if (range & (1 << 12)) + switch (regno) { + case REG_RA_AUTH_CODE: /* Opcode for restoring RA_AUTH_CODE. */ op = 0xb4; add_unwind_opcode (op, 1); + break; + default: + as_bad (_("Unknown register no. encountered: %d\n"), regno); } } @@ -4375,6 +4364,81 @@ s_arm_unwind_save_core (long range) } } +/* Implement correct handling of .save lists enabling the split into +sublists where necessary, while preserving correct sublist ordering. */ + +static void +parse_dot_save (char **str_p, int prev_reg) +{ + long core_regs = 0; + int reg; + int in_range = 0; + + if (**str_p == ',') + *str_p += 1; + if (**str_p == '}') + { + *str_p += 1; + return; + } + + while ((reg = arm_reg_parse (str_p, REG_TYPE_RN)) != FAIL) + { + if (!in_range) + { + if (core_regs & (1 << reg)) + as_tsktsk (_("Warning: duplicated register (r%d) in register list"), + reg); + else if (reg <= prev_reg) + as_tsktsk (_("Warning: register list not in ascending order")); + + core_regs |= (1 << reg); + prev_reg = reg; + if (skip_past_char (str_p, '-') != FAIL) + in_range = 1; + else if (skip_past_comma (str_p) == FAIL) + first_error (_("bad register list")); + } + else + { + int i; + if (reg <= prev_reg) + first_error (_("bad range in register list")); + for (i = prev_reg + 1; i <= reg; i++) + { + if (core_regs & (1 << i)) + as_tsktsk (_("Warning: duplicated register (r%d) in register list"), + i); + else + core_regs |= 1 << i; + } + in_range = 0; + } + } + if (core_regs) + { + /* Higher register numbers go in higher memory addresses. When splitting + a list, right-most sublist should therefore be .saved first: use + recursion for this. */ + parse_dot_save (str_p, reg); + /* We're back from recursion, so emit .save insn for sublist. */ + s_arm_unwind_save_core (core_regs); + return; + } + /* Handle pseudo-regs, under assumption these are emitted singly. */ + else if ((reg = arm_reg_parse (str_p, REG_TYPE_PSEUDO)) != FAIL) + { + /* Recurse for remainder of input. Note: No assumption is made regarding + which register in core register set holds pseudo-register, thus it's + not considered in ordering check beyond ensuring it's not sandwiched + between 2 consecutive registers. */ + parse_dot_save (str_p, prev_reg + 1); + s_arm_unwind_save_pseudo (reg); + return; + } + else + as_bad (BAD_SYNTAX); +} /* Parse a directive saving FPA registers. */ @@ -4716,39 +4780,13 @@ s_arm_unwind_save_mmxwcg (void) ignore_rest_of_line (); } -/* Convert range and mask_range into a sequence of s_arm_unwind_core - and s_arm_unwind_pseudo operations. We assume that mask_range will - not have consecutive bits set, or that one operation per bit is - acceptable. */ - -static void -s_arm_unwind_save_mixed (long range, long mask_range) -{ - while (mask_range) - { - long mask_bit = mask_range & -mask_range; - long subrange = range & (mask_bit - 1); - - if (subrange) - s_arm_unwind_save_core (subrange); - - s_arm_unwind_save_pseudo (mask_bit); - range &= ~subrange; - mask_range &= ~mask_bit; - } - - if (range) - s_arm_unwind_save_core (range); -} - /* Parse an unwind_save directive. If the argument is non-zero, this is a .vsave directive. */ static void s_arm_unwind_save (int arch_v6) { - char *peek, *mask_peek; - long range, mask_range; + char *peek; struct reg_entry *reg; bool had_brace = false; @@ -4756,7 +4794,7 @@ s_arm_unwind_save (int arch_v6) as_bad (MISSING_FNSTART); /* Figure out what sort of save we have. */ - peek = mask_peek = input_line_pointer; + peek = input_line_pointer; if (*peek == '{') { @@ -4788,20 +4826,13 @@ s_arm_unwind_save (int arch_v6) case REG_TYPE_PSEUDO: case REG_TYPE_RN: - mask_range = parse_reg_list (&mask_peek, REGLIST_PSEUDO); - range = parse_reg_list (&input_line_pointer, REGLIST_RN); - - if (range == FAIL || mask_range == FAIL) - { - as_bad (_("expected register list")); - ignore_rest_of_line (); - return; - } - - demand_empty_rest_of_line (); - - s_arm_unwind_save_mixed (range, mask_range); - return; + { + if (had_brace) + input_line_pointer++; + parse_dot_save (&input_line_pointer, -1); + demand_empty_rest_of_line (); + return; + } case REG_TYPE_VFD: if (arch_v6) @@ -23993,12 +24024,8 @@ static const struct reg_entry reg_names[] = /* XScale accumulator registers. */ REGNUM(acc,0,XSCALE), REGNUM(ACC,0,XSCALE), - /* DWARF ABI defines RA_AUTH_CODE to 143. It also reserves 134-142 for future - expansion. RA_AUTH_CODE here is given the value 143 % 134 to make it easy - for tc_arm_regname_to_dw2regnum to translate to DWARF reg number using - 134 + reg_number should the range 134 to 142 be used for more pseudo regs - in the future. This also helps fit RA_AUTH_CODE into a bitmask. */ - REGDEF(ra_auth_code,12,PSEUDO), + /* DWARF ABI defines RA_AUTH_CODE to 143. */ + REGDEF(ra_auth_code,143,PSEUDO), }; #undef REGDEF #undef REGNUM @@ -27905,7 +27932,6 @@ create_unwind_entry (int have_data) return 0; } - /* Initialize the DWARF-2 unwind information for this procedure. */ void diff --git a/gas/testsuite/gas/arm/unwind-pacbti-m-readelf.d b/gas/testsuite/gas/arm/unwind-pacbti-m-readelf.d index d8d647bb7f0..c40544a5a94 100644 --- a/gas/testsuite/gas/arm/unwind-pacbti-m-readelf.d +++ b/gas/testsuite/gas/arm/unwind-pacbti-m-readelf.d @@ -10,11 +10,11 @@ Unwind section '.ARM.exidx' at offset 0x60 contains 1 entry: 0x0 : @0x0 Compact model index: 1 - 0x84 0x00 pop {r14} 0xb4 pop {ra_auth_code} 0x84 0x00 pop {r14} - 0xb4 pop {ra_auth_code} 0xa3 pop {r4, r5, r6, r7} 0xb4 pop {ra_auth_code} + 0x84 0x00 pop {r14} + 0xb4 pop {ra_auth_code} 0xa8 pop {r4, r14} 0xb0 finish diff --git a/gas/testsuite/gas/arm/unwind-pacbti-m.d b/gas/testsuite/gas/arm/unwind-pacbti-m.d index d178e4c0a44..b021c007b33 100644 --- a/gas/testsuite/gas/arm/unwind-pacbti-m.d +++ b/gas/testsuite/gas/arm/unwind-pacbti-m.d @@ -8,4 +8,4 @@ .*: file format.* Contents of section .ARM.extab: - 0000 (00840281 b40084b4 b0a8b4a3|81028400 b48400b4 a3b4a8b0) 00000000 .* + 0000 (84b40281 84b4a300 b0a8b400|8102b484 00a3b484 00b4a8b0) 00000000 .* -- 2.36.1