From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2049.outbound.protection.outlook.com [40.107.20.49]) by sourceware.org (Postfix) with ESMTPS id C898F3857349 for ; Fri, 29 Jul 2022 15:41:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C898F3857349 ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=S0v/M6cl9tV0LX/Ufln1tdsTWqfOj93hf5t1oL7buP02BxjdtKEFDvJZeU3JOQOP7dM6dU/qSunH+oIWKn/c3DJ6u/kHJMzF8bfk1lHmdbqurJHMy56UPuh9pQiIxitgaAU8gaVgvh73ICi10AYlB3m+5bpuX96/S77bDYy4WRG4R8v47U5b4RvJvqXD2uG1sIvg/WdjF2Ix3Fx/Q3yeqih7khEZ7PKt2bWr+paWqRAoXNAnJmNinoQCKEFaWsnKBx0vNRfnKUyBWR9z7w4GoaggId3VsJAsciHqZxws6eQ4a1b/qaKPlPyygO7k5WOnJRTap23KB1c+XpwMGVTfJg== 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=BvMCpdDlKQx4RgxQXAgry0KcNfHbDvIIEUf1uCplpiY=; b=cEM4Z1hx3EgroKEPuNle8345s0NzetgOfEvMqtPu4bo5luGYvaLxC1BjV8Fq28P/MK91j8741aLVzQExcr1AlNygHJU1y5aRHIplm0ljUyo5QPzEhBJ+E3hhnHC5myY/oJcByXjhIGxznllqtyQ4SN4Wk1SfWq2AD5w6De1+4mJ/LWcUJSQoyMI8rngo//xe3c+zH0TT8NHIVqQJ69OSVxzWvLZF2JQ1eS0JY9j25D3pwcQCjyaE5XiJ33wgJ90pTDC8O82FUQKzE8PNgigFbJg2gvpEo2SdjHTUcUsYV5tjiBdzS2ihDWA85LMcrH3XCe70bcB/xXp16QDw8vCY1Q== 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 AM7PR04CA0015.eurprd04.prod.outlook.com (2603:10a6:20b:110::25) by VI1PR0801MB1853.eurprd08.prod.outlook.com (2603:10a6:800:5a::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.20; Fri, 29 Jul 2022 15:41:14 +0000 Received: from AM5EUR03FT009.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:110:cafe::54) by AM7PR04CA0015.outlook.office365.com (2603:10a6:20b:110::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.12 via Frontend Transport; Fri, 29 Jul 2022 15:41:13 +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 AM5EUR03FT009.mail.protection.outlook.com (10.152.16.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.12 via Frontend Transport; Fri, 29 Jul 2022 15:41:13 +0000 Received: ("Tessian outbound 63c09d5d38ac:v123"); Fri, 29 Jul 2022 15:41:13 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 7700d14f44025ec4 X-CR-MTA-TID: 64aa7808 Received: from b8953ee80e92.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 1CDF05AE-BF83-48F2-816E-09E73608A31D.1; Fri, 29 Jul 2022 15:41:06 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id b8953ee80e92.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 29 Jul 2022 15:41:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Su+huaFe0HNQxuLelEglCKBPazmEAh/FGIZcQcpUhQ2JES3Zvz/X3aydulOyeszOb9HBxcyw5RIAYiMYLSc3s4/2OlYCErwr/RrDn+7UXqU2fszHFCeOM0HTWErz2B+FmPFZk3QLnOH7PUebIVox1v+lgEEeX9GuWoiVIPeVDG3L/fJJFqzLRKEeVJZTOFEPq/Tg84ElrSk1YQwdVhfkauugSgflz7f8J12NYwcHCrPk8V1ougy03CK4PoSIgMqNImujGYy50oAn5ZrQL+7BOs7p9MHEGjtAzb5zXFdmiQBgU8SmwLQS8ivkskPd9TUFrDJhLcr6Tp9y+x9U2VlYQQ== 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=BvMCpdDlKQx4RgxQXAgry0KcNfHbDvIIEUf1uCplpiY=; b=WVOtqzZpRwr868h5lLgiJAuBYsBuHa7cmk7ktleji4xB9pdzpx+FyvXvhMHHKb4EzloX46rA3DHMUCLV8pF5DywEnUfBOU0xAnxPNet8mhgreS8nte+4HSXQz1AjPZOMu2w2pmb3bik1JjgAZKx3RiCO6yAarK1Aq5g0BGnx76qAiqfV87tzY/3OjDPuARM1YSvQJQFjFEdlWu48sR+iE0VnyrdDlBYDU+KoliUa4i5JyBovnuZ2hEo9lMNPacvFyN53TNE6gpugOcQlWJDk5y3Dw5ND9Y5j2IFQftUdMOCgUsx4ySyRJf4rSUiOvieZ2v1wQNHIEZ3nnPCs32lcAA== 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 AM6P191CA0024.EURP191.PROD.OUTLOOK.COM (2603:10a6:209:8b::37) by AM9PR08MB7072.eurprd08.prod.outlook.com (2603:10a6:20b:416::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.6; Fri, 29 Jul 2022 15:41:05 +0000 Received: from VE1EUR03FT041.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:8b:cafe::1e) by AM6P191CA0024.outlook.office365.com (2603:10a6:209:8b::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.10 via Frontend Transport; Fri, 29 Jul 2022 15:41:05 +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 VE1EUR03FT041.mail.protection.outlook.com (10.152.19.163) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5482.12 via Frontend Transport; Fri, 29 Jul 2022 15:41:04 +0000 Received: from AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2507.9; Fri, 29 Jul 2022 15:41:04 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.9; Fri, 29 Jul 2022 15:41:03 +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; Fri, 29 Jul 2022 15:41:03 +0000 From: Victor Do Nascimento To: CC: , Victor Do Nascimento Subject: [PATCH v3][Binutils][GAS] arm: Use DWARF numbering convention for pseudo-register representation Date: Fri, 29 Jul 2022 16:40:49 +0100 Message-ID: <20220729154049.23063-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: ad6ef6f5-3973-4571-f4d0-08da7178c4bf X-MS-TrafficTypeDiagnostic: AM9PR08MB7072:EE_|AM5EUR03FT009:EE_|VI1PR0801MB1853: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: L0qrPWgJujxG70yQXNkjNUf2LZ9TDcdAea7rjvdZ7y6zCr5cINvorGsgZ0CwQ3K+hdUYN8FV7ptGlAsuRMu0KRZ8SffWxQYXewrRalD3vq5Uvbye0zYoafFtuXOjP3rskSbQlxuFhZ8meVj7tM6L4EJbwl2JDXuH7kXjVcVj1kVXjAieknw6kV7WLSUgr1QiyhdR6T8UjZZN4DqiqmfGN1umb99Ga58SrmBXKvvarQtCiTrED6I2biSSQSdPpJhBwHeHXKb5wcP2VD3BVQ0asv+u1gKiG/jRgI7tLJcOpLf7MapbsjqBFcBZbh4ldadP5f9olrhPNkQJLq9Eg+lKxpzX40fqSet/lwEiEjBE0HjZ3e7sScfjW7q5uqIMVMe9HECl0MUJHkDmOnCr6iEFkez4YVI8aQ1sj815DUgqW2nkjvVLrT4LYqXFbjh6yZcurEKmQwwd7TKfzJkUUm50BX0b/+KXKieKt7s4RQ2oOkUaUG0v9I55sAkljkrJrA3OoyH8qkWaf/ciz5gUSGDde/oC7hIkXacYAzG066UbeD2lrV0wCtrDQ21Zo1dWhs6eitqMGoITGTwUBZcP2clR8MV/7+nfGiNlhYWnw8Av/V8hgIRa51hdMTfRBLcaD3Z8I/eXRN/X6hWeMBJ7S1pjbmS/NdnA5M93grnHlTJGFvw22bpwZEh5aDGMQBZdeS1Mb2TuQguEkIP3GJ6U48zx5Woy+MV7xtlD9YI9IefFbk4rIq+XjN7HvWD2ij3ZFjKMXgSKFtF79aT8SEtzProwX/Eg3mvZXOfEGE2EJxPS23WqmQdEx9iObAc4WHwu1WGaci/7XPJ9ASxP2yNEiJ00j2m8RUAV3w/o1snTurc3sHS5IbTF94gIqgbIZrkPvNDL+SconISxfJLMX1uaXyllkQ== 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)(396003)(39860400002)(346002)(376002)(136003)(40470700004)(46966006)(36840700001)(41300700001)(5660300002)(82740400003)(356005)(81166007)(478600001)(70206006)(70586007)(83380400001)(2616005)(4326008)(316002)(8676002)(426003)(1076003)(54906003)(6666004)(336012)(47076005)(186003)(6916009)(36860700001)(8936002)(26005)(36756003)(86362001)(2906002)(40480700001)(82310400005)(40460700003)(7696005)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR08MB7072 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT009.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 4066b8b7-e728-402c-e9f4-08da7178bf82 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: q/ila6jxuS+JFexjVjsXCk672bCyVQhGN8UTGvvoKTAE7XwxGux/GSfnaOmuDR1DYQDx2juYBRxMnueVWTmQR7TdnVEXnuBSc7SuH9cGM3dfHQ0uh2EER1oIr/DsH+DpUQTSyy9L7kM2O9UZGDJDywdIbUbsX87t7hbBhRQDVzY6IPPl2x6Ezul410gUbL/6xMPynBXToVeoCD65yWJsSYJRdObSxf4bxNbFZQoxeRXrBPO1oEge5E5GgT0+RSrMlqqKdmsgDYXCyAbirCTGILXu8jMJis5XmlwEx1gesJb+tOYtKKqcR2gVzQ3HG4ZIw0Xl2SHipQT6slilKn06YEoeZBsVdH33wVc5twu/MiswiNYRoJO48nBFEbneqCsrYjeeFk2k6vwAZYu3vMTQeVxyfQtxwtpxDHbf7ZRmqQBS3hJ3TCGOQTaOcEHPpCqy9M7J7YJjEIZNUG4LWKD/rTe29v6iI502Iy3DmtmGqKO5d/noeHPdU7KWr+A2YyF3tehfDTsWs3WDOjtxXJJ2UljJyNxOj15YJckow4Esw66HBiwKeJtZwTjwSm6TFYszG7wcE1mfzUTn79unDcfPh3koSBA33d5+1L3AIxaEWkTEiyh3I/caVuBus1L3VvCKYqCCNuCQFqyA7v8KJWEfDvpg2OtICRLI2lmUUx5qnOMT5CJAoMqxtm2pgnnDM41zAv4aZs4E3dOe5s1qOWYN1tekpVmOrWiQkakWBLU0SSuMvofu2M1nWnteZceaa99sOKkVoHAtk+RYu3gtJq0n8zb/tvYqDCmDNTmTTSzd32UJRzIUNJTLvGsWU9iddxADAa0MDA0kbw33MQfrmpRRGKvKXaURPWV8EvvF7W7tBx9jyQLOTFW2TMqBRRythzzR 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)(376002)(346002)(136003)(39860400002)(396003)(36840700001)(46966006)(40470700004)(82310400005)(8676002)(36756003)(40480700001)(5660300002)(8936002)(54906003)(316002)(2906002)(70206006)(70586007)(4326008)(6916009)(86362001)(40460700003)(41300700001)(6666004)(7696005)(186003)(1076003)(26005)(2616005)(478600001)(36860700001)(82740400003)(426003)(81166007)(336012)(47076005)(83380400001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jul 2022 15:41:13.6493 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ad6ef6f5-3973-4571-f4d0-08da7178c4bf 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: AM5EUR03FT009.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB1853 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: Fri, 29 Jul 2022 15:41:21 -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 one 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