From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2076.outbound.protection.outlook.com [40.107.20.76]) by sourceware.org (Postfix) with ESMTPS id 254CA3858C5E for ; Fri, 10 Mar 2023 09:36:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 254CA3858C5E Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CXYlWcnWCfX7BFmzg0grMH4V636uvbyhqBRo6BKrnPUoSXJSNrZyHZ0nOXUAdwerdMBwpxbdPy70qsYMJ0l51cr6ku8QpogN0lm1i8UgJRIPzcmgcBzrLZoqM3d3LipHNRibyDNBoMZPnMm2OVG7hFFJy19xl302EM4gQ+ZcpA9Mi+JG/v2JlFunJ9ErT7lncmTjbKixDuLHm54X5jGKHguY3y/Bzvm3yC3pmHNHbHjDofMGVq1nXZiLeeYJur/WGnx/naCB6k86dXcARRt1DYjgGj+JY1ekBBG9h1BP9kj68eOig5EIk2cVBYuyvmmfdea03AfNnHdk09v+MovuKg== 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=x7qD1TsN+up11/6Gxp1s9N0LhIdQ7v9dxeNN9lyjZ4s=; b=JLFILmFQS8s/yEPTRyDg1G+0JezwupXxAJ/5MHoOfEAigQisRqbZl3ntNAj6Uwwxfv1kWw1bb4m7Ffkai8Zm9jhhvvhK0oetzQBS9MRZqeDE9eJib8ft/Ei6yrpSwH1EF1E4smCQIvmiIFqJKTbvKqeeB7GNdPIx3xAhlQJ8sERotVvHYlaIP2jTOUvzdfBfVwwhgqXH6538aRojJFM1YarqYvq3dc+/XQmC7jF7MEFWLmGQrXrFwZbkRhRHhgwTFt/to1kCC+0c4GvmaucWM/uuvOO/zU92njxJI1vnbb2CfuW2z7FqMXkBpNpxrXth4hbqA+vnG2oxSqVfr5H/wg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=x7qD1TsN+up11/6Gxp1s9N0LhIdQ7v9dxeNN9lyjZ4s=; b=4Ad+n1NElfSb+Ab1h5yJijV1MGy16f5K/sC4WhZcLPtz2FgRCWJ7e1uhHCKRHUHxSk2jIlMYQEeK7tGcwZSeDqIdvzqsarqemd4hHr0rSCNjJ3p/O1gWw1SzA2TITRr+AyhFeDq1blHF5VC7VL42Qz14vt6mfwkrRuhtYAhaTqzphV2NwewuWD0Haz5Ai3JK7YHT5baZNPEL2YWhWFeEurZZgZoJWFF0onFNEE9RaocFp8fWDALiNM4FEhMm6M3FX/QKIJHCU1sM6BM0Nyd7z4zF0kkReBPU/26UXLCOoCfsJgT0rqmjbsQQ3CEutWxRlEB8Un64q2tygyKejLv0/w== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) by PA4PR04MB9464.eurprd04.prod.outlook.com (2603:10a6:102:2ac::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.19; Fri, 10 Mar 2023 09:36:33 +0000 Received: from VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::154e:166d:ec25:531b]) by VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::154e:166d:ec25:531b%5]) with mapi id 15.20.6178.019; Fri, 10 Mar 2023 09:36:33 +0000 Message-ID: <150b4184-62af-3f5c-c07b-24b0c2ae788f@suse.com> Date: Fri, 10 Mar 2023 10:36:31 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Content-Language: en-US To: Binutils Cc: Palmer Dabbelt , Andrew Waterman , Jim Wilson , Nelson Chu From: Jan Beulich Subject: [PATCH RFC] RISC-V: alter the special character used in FAKE_LABEL_NAME Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: FR3P281CA0156.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a2::17) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6560:EE_|PA4PR04MB9464:EE_ X-MS-Office365-Filtering-Correlation-Id: 9226922f-cd60-4406-2b23-08db214aef76 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: S6Op21+yWT1aboh4Io8gigDpFygyI/xCBMXrwaFsmxV0k299ZPWopb1YujO5LQghUEL5ME+8anM7JfGhyXRhAgtKDs7AQ/HkAK/QKvlIXMyb1y7Y29U500yuWesLqeho9Pcr6lVJY0VTKaPCmty4HWvS8jNKuHCoZFi+5tMupbjlj40MwiA5vSeOe+zKI3IjBhLSv5AgtS/E3gPn+FduTBB/L/zyCEWgfJDHtV2MciPUbZGRiMzsTI/jPM+Uj4a0XllAErJgQy2v8C5Qzzq4x0xgR0r/BA+NUGXv3TEkC57/Ctta9uq6veetWjdsU02CW2lWgnS8gZ8N2f40K43pPTM4jjZUQlrxHbGwxPhqoSnyEPdxPnKEcMfgj8jWyJGcT+7gyndEc9RQMVl8Lwjj2vKyAGQdDz4ZAPHbbpZgusiqo6K+1O3sCLZdZFGXKSAeC/tIoAQx1ZER70cnCeCCD2+691jsgCzdiaTXfGd3No55exkvUCAnu2nFge/QCIq8mczZRTMd19FvIPDtl6fcoRQneVGUoxzoeYO6U5TophrrzakjMtDVh9Q4aJW6C+HCLpTVxBHGE9CYljma9g9m8zPd0gKM97vWIr8fQww1mNz/d2LKzksHuAz9NggIjkwiBD91buoQpfFyfLgDPuQe++bbZ/rbASeM2u5Jlhl0I2HxMU9DeV7L/ZD96A6i98czGkFmgbGubz8NOI6fFHaPFdSlH1Edl+AKDgirsoCmnM0= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR04MB6560.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(376002)(136003)(396003)(366004)(346002)(39860400002)(451199018)(31686004)(54906003)(36756003)(31696002)(38100700002)(86362001)(6512007)(26005)(83380400001)(186003)(2616005)(6506007)(316002)(5660300002)(478600001)(6486002)(41300700001)(6916009)(66556008)(4326008)(8936002)(2906002)(66946007)(66476007)(8676002)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?bWZlOEYwZnI4RHg5WDR3M0xYWHhkQ24zMkNGbTNodkFzWk5KeHlmTU9HbEpU?= =?utf-8?B?WTAxYjEwcG93ZmR0SVkzWjRMQTE0bmV0bmNhSXFuUmlDZWNic0haYTdaT3gy?= =?utf-8?B?MllIZEQ5UUEyaU5XZ0JYTGJTSVQvY1ovbjAzR0ZBWFdzVWlMa1dmcDI1R3pk?= =?utf-8?B?MWtTYW5yNjFCam02ZjhtaXVCMFRkSWpCNWFRM1BkZDIrM0lVbmlxRWJkLzIv?= =?utf-8?B?cWI1cTNJZmFmZDAzN3BUOXFsSW5jWkR3UE9hanRNd1kwSmpja2JaN2VONmxO?= =?utf-8?B?S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jVEFi?= =?utf-8?Q?O7a9aBqL9SdLFR+kEIxwy8t14?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9226922f-cd60-4406-2b23-08db214aef76 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2023 09:36:33.3258 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: wgxPRU1EHka35OaqSB8BAEQY+ZAPIkh5w0ACPzUFLXNuqnLaNL9r8GN1cSvWl7O+heoFUm2k6IzffZ+QSk2cKA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB9464 X-Spam-Status: No, score=-3027.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_STOCKGEN,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: The use of a space char there collides with anything using temp_ilp(), i.e. at present at least with the special % operator available in alternate macro mode. Further uses of the function may appear at any time. This likely is a result of write.h's comment not properly spelling out all the constraints placed on the selection of the special character used. Then again RISC-V anyway violates a constraint which has been properly spelled out there: Such labels _do_ appear in assembler output. --- RFC: Of course this breaks interoperability between older gas / new objdump and vice versa. But I don't see a way to resolve the issue at hand without introducing such a discontinuity. To limit "damage" a little, riscv_symbol_is_valid() could of course be tought to also ignore old style fake label names. (Personally I view this tying of functionality between assembler and disassembler as problematic anyway.) Thoughts? I question the use of FAKE_LABEL_NAME in make_internal_label(). The comment in tc-riscv.h isn't correct anyway because of (at least) this use - the symbols generated there are never used for Dwarf. And them all being the same makes it rather hard to associate relocations resolved to symbol names (e.g. "objdump -dr" output) with the actual instance that's referenced. Their naming should imo rather follow the model of {fb,dollar}_label_name(). Considering the special casing of FAKE_LABEL_CHAR in read_symbol_name() and get_symbol_name() I wonder in how far LOCAL_LABEL_CHAR and/or DOLLAR_LABEL_CHAR don't also need recognizing there (and then also be marked in lex[] just like done here). I can't point out a specific case though where there could be a problem. The checking for *_LABEL_CHAR in S_IS_LOCAL() looks to collide with uses of these characters in quoted symbol names. --- a/gas/app.c +++ b/gas/app.c @@ -200,6 +200,11 @@ do_scrub_begin (int m68k_mri ATTRIBUTE_U lex['-'] = LEX_IS_SYMBOL_COMPONENT; #endif + /* If not otherwise used (which it shouldn't be - see write.h), mark the + fake label character as a possible part of symbol names. */ + if (!lex[(unsigned char) FAKE_LABEL_CHAR]) + lex[(unsigned char) FAKE_LABEL_CHAR] = LEX_IS_SYMBOL_COMPONENT; + #ifdef H_TICK_HEX if (enable_h_tick_hex) { --- a/gas/config/tc-riscv.h +++ b/gas/config/tc-riscv.h @@ -38,8 +38,7 @@ struct expressionS; #define LOCAL_LABELS_FB 1 /* Symbols named FAKE_LABEL_NAME are emitted when generating DWARF, so make - sure FAKE_LABEL_NAME is printable. It still must be distinct from any - real label name. So, append a space, which other labels can't contain. */ + sure FAKE_LABEL_NAME is printable. See write.h for constraints. */ #define FAKE_LABEL_NAME RISCV_FAKE_LABEL_NAME /* Changing the special character in FAKE_LABEL_NAME requires changing FAKE_LABEL_CHAR too. */ --- a/gas/testsuite/gas/all/altmacro.d +++ b/gas/testsuite/gas/all/altmacro.d @@ -8,4 +8,4 @@ Contents of section .data: 0000 01020912 61626331 32332121 3c3e2721 .* - 0010 3c3e27.* + 0010 3c3e27a2 11.* --- a/gas/testsuite/gas/all/altmacro.s +++ b/gas/testsuite/gas/all/altmacro.s @@ -33,3 +33,9 @@ m4 "!!<>'" .altmacro m3 "!!<>'" + + .macro m2b v1, v2 + m1 %v2-v1 17 + .endm + + m2b 81 243 --- a/gas/write.h +++ b/gas/write.h @@ -30,7 +30,8 @@ /* This is a special character that is used to indicate a fake label. It must be present in FAKE_LABEL_NAME, although it does not have to be the first character. It must not be a character that would be - found in a valid symbol name. + found in a valid symbol name, nor one that starts an operator, nor + one that's a separator of some kind. Also be aware that the function _bfd_elf_is_local_label_name in bfd/elf.c has an implicit assumption that FAKE_LABEL_CHAR is '\001'. --- a/include/opcode/riscv.h +++ b/include/opcode/riscv.h @@ -323,9 +323,10 @@ static inline unsigned int riscv_insn_le /* These fake label defines are use by both the assembler, and libopcodes. The assembler uses this when it needs to generate a fake - label, and libopcodes uses it to hide the fake labels in its output. */ -#define RISCV_FAKE_LABEL_NAME ".L0 " -#define RISCV_FAKE_LABEL_CHAR ' ' + label, and libopcodes uses it to hide the fake labels in its output. + See gas/write.h for constraints. */ +#define RISCV_FAKE_LABEL_NAME ".L0?" +#define RISCV_FAKE_LABEL_CHAR '?' /* Replace bits MASK << SHIFT of STRUCT with the equivalent bits in VALUE << SHIFT. VALUE is evaluated exactly once. */