From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2058.outbound.protection.outlook.com [40.107.104.58]) by sourceware.org (Postfix) with ESMTPS id 6326A3852C47 for ; Thu, 15 Dec 2022 10:51:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6326A3852C47 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=kFlygPGMB5BXgFWMK70Wqy4qSAJDb2uJptz5tb4QmmvTSAuxx2fg0tFdp/GkUc9zEEc8a1vnviMjvjBr1iFgLDaQMgdwo2FokEXMUoUFjqk2i/hBvfWQog3rAKTt4p/6/Whmjr1ahxpTGjmHmIel+T8trZ1UmYdy1IYayzHZHaFSEzW/RpGz0ejr07zKhCD6XLXWg1/rFsdPwxwLixqT8ytZ85n9dsIVAKnqpLyVhDzmXRjH8cqbSsDHcqJqAZPc/2e9c2UMLZBjmbeUY3aDs84pk+cJYs+RIA0A2AHFiQCP9xR0JSk5bMoTpMs84Yz51ZRyHAucoj/QONEMvAEwBQ== 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=DufwJ5dHqnbO2+Egw4+DPiqnJxxXB0pQxRjahWoFrpQ=; b=XwpE4lhnA/CnAmuB4kXNLxsUlDCADr7IHhy9PuBcHkeyPMEMlwgVGuYx4cdwD7+f/GYp/mVhJROt1G8BMDB8xDBGcvmhs+mRP9YDpOyPz3y4Z+diGZzDSaiypYETc+1O9DT8+w7R6SWW4QNxy9ParKxRDtLghZNnAaOhxeqyR2CdRhftGU3+HyfWh14hBuTWfuxTT+xshZilQqt84PRwzfEtWUXFAfs9KQt0sUVkpqT4brjcIDzuICi7YpMfbjNBKHFIeSuFP0NRO8BbiMFbhMopWCdK1xU/boW7m+1DxLMvssT2ONtyf6hwfjSG9Hnt4ftvYYImx+FnqG7bWJAX5A== 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=DufwJ5dHqnbO2+Egw4+DPiqnJxxXB0pQxRjahWoFrpQ=; b=RgrjIbHXXHOIUlRI4pD+amtXeqPrYpmiVlLjyHryyHY7/O1czKz8qD391M6lPKDqoqLvmlopeygeIFywegO4VTlOFNHrEk1IpEp1EGAQL9hVAMDngauN3Z3LBoCRcgE0SyjLwKpZY67Ycnf9wTzY17CREmtW5+OkhcRI4vEtuGUV6UtNLHPP7vSxWsD0c3hSjL3/wsgWrp7caWn94EqONzau3i00R1JPUAHXOEmGuc3KczmGzf12mBGrzx/3O9ghB5DQyKnsLQ4jBJQC0zgjeHRAy/RMu9w6glHIihTyEX+AEt836AE+nR1HYmE6gFDSCbcZKkPurYcWOSICKPjlAQ== 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 DU0PR04MB9587.eurprd04.prod.outlook.com (2603:10a6:10:317::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.11; Thu, 15 Dec 2022 10:50:58 +0000 Received: from VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::4da2:ea8b:e71e:b8d8]) by VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::4da2:ea8b:e71e:b8d8%4]) with mapi id 15.20.5924.011; Thu, 15 Dec 2022 10:50:58 +0000 Message-ID: Date: Thu, 15 Dec 2022 11:50:56 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.5.1 Subject: Re: [PATCH v2 2/2] gas: re-work line number tracking for macros and their expansions Content-Language: en-US To: Andrew Burgess , Luis Machado Cc: Binutils References: <1d528267-9450-12c7-4c4c-fe4deb3b0617@suse.com> <8eff1de6-871d-24cc-8804-9af7da0a86cf@suse.com> <87edt20ycr.fsf@redhat.com> <87a63p2a81.fsf@redhat.com> From: Jan Beulich In-Reply-To: <87a63p2a81.fsf@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: FR3P281CA0162.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a2::14) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6560:EE_|DU0PR04MB9587:EE_ X-MS-Office365-Filtering-Correlation-Id: 52df6f66-4bc1-4faf-bc35-08dade8a3fa2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Vrfv5r8YujuqN5exdwPpwBNGVHS73AN5HvBdr+VmbgGbfh6kMJVrg/0O0BSrXUpuulJEwJLviwUR2o0sYcN7atTm7XtGfs3vFyBxg2YkyHd2jTvpFnGfMXFdqo2oOx6LpGE2yAT/gTu56I0cisiJ0mpbAsrXuuU9cc+Jre8aST9gzlATFTxp50TfgqFnXMhUlrijHL+4AjiZAp3tUEaYCeOs7dcB1UUO3sgig2ucPKL8S9DV377z7TKxIBT+IW+7zfJyApP3XIADPYGKj5lVc8HjdSuMRD+5/w0TCC/YguZexoZHVSzIzva4PcD9w6hEX0fcNGYpCJBTe8lYeZDysKNe1dSccX7GNOAgSGj3JVEWoRdPQcR089Wkec8oVjURFtCZu4mv9S59Zs4yI64mqatDmYtIETRw9siu826GdXQX49lLekgbxgH/ktqr9/+cpQZIzBB4AAOVriWLA3JEQU6cTYCwgiOUJ/yEOlWjA6QNq9X+m3FqUahrPPfmAXngoguZAMKVNOibr27vvep8xybfd51Mot7okjikYa/QrG/s4HWL1E3HZyW4i0MnGYlSdavJuOkaBzSRoiSm3VKsI4wmDcuRp8J6h6rguyuZEO2VNiwBcldF30hhJf7ZRq2MpdOh4cWVs0CjtGPPdMpDDssc1YdY4Fquz2ftju0hBS3YxLnC57hI6srAoAjWi/4xCJafkdmVwmGoVkkbLvC/jVRJk5llH6qEmtIoPn9geYk= 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:(13230022)(366004)(136003)(396003)(346002)(39860400002)(376002)(451199015)(36756003)(316002)(110136005)(8676002)(4326008)(66556008)(66476007)(41300700001)(66946007)(83380400001)(38100700002)(86362001)(31696002)(31686004)(6506007)(478600001)(5660300002)(2906002)(8936002)(6486002)(2616005)(186003)(26005)(53546011)(6512007)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?aVNXRGRkKy8zbEU4NVV2cVlOM3hVUnYxVzkydzREQlRha1drM2lISktiSHF4?= =?utf-8?B?WnlYOEl1VC93UGgrTGZmbWVYSzdvTFkwc002RXB1Mm1PNlJ6YjdKRURQMWlv?= =?utf-8?B?eFN6VlZjRXU4bTBOcEFUNU1TdFBQUFNmYjUrSVpueVQxNmdSQTA2eURhVFVi?= =?utf-8?B?Q3U5MCsvMklhbmc0V0xONHdUNTBjRi8zcmJmQXpsbnJpTHZCRzl4a0NISng2?= =?utf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dzSlQyaW1wYkdhOThmaHdESGptaUM5STVQM1Z6WXR4MDlhWTdP?= =?utf-8?B?OFpmUk9UM1ZOSi9pNXV2ek5YTTh0aGlOSTJYcWVMMzdjczZRMWtEZUtEWjIr?= =?utf-8?Q?48y78c1d2lZdIR/RjueBVPS4c?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 52df6f66-4bc1-4faf-bc35-08dade8a3fa2 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2022 10:50:58.4110 (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: KhVxFHGP6R8EKytQTFOrz7TTHT6jIkYNNIIiaMlJ6RnoUQSgN4aQa51xHk8LrSu5mTs6x+n2tBYHi4P/3G8vGQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR04MB9587 X-Spam-Status: No, score=-3028.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,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: On 14.12.2022 17:58, Andrew Burgess wrote: > Anyway, hopefully the reproducer helps track down the problem. It did indeed. Below the patch that addresses the issue for me, but before committing I will want to run this through the full set of tests (after extending the testcase which didn't catch the issue). Jan gas: restore Dwarf info generation after macro diagnostic adjustments While 6fdb723799e2 ("gas: re-work line number tracking for macros and their expansions") was meant to leave generated Dwarf as is, it really didn't (and the testcase intended to catch that wasn't covering the case which broke). Its adjustment to buffer_and_nest() didn't go far enough, leading to the "linefile" directive inserted at the top to also be processed later in the PRĀ gas/16908 workaround (which clearly isn't intended - it's being put there for processing during macro expansion only). That unnoticed flaw in turn led me to worked around it by a (suspicious to me already at the time) conditional in as_where(). --- a/gas/input-scrub.c +++ b/gas/input-scrub.c @@ -564,9 +564,6 @@ as_where (unsigned int *linep) do { - if (!saved->is_linefile) - break; - if (expansion != expanding_macro) /* Nothing. */; else if (saved->logical_input_file != NULL --- a/gas/macro.c +++ b/gas/macro.c @@ -120,8 +120,7 @@ buffer_and_nest (const char *from, const size_t from_len; size_t to_len = strlen (to); int depth = 1; - size_t line_start = ptr->len; - size_t more = get_line (ptr); + size_t line_start, more; if (to_len == 4 && strcasecmp (to, "ENDR") == 0) { @@ -147,6 +146,8 @@ buffer_and_nest (const char *from, const xfree (linefile); } + line_start = ptr->len; + more = get_line (ptr); while (more) { /* Try to find the first pseudo op on the line. */