Message ID | 40e89395-1438-6cbe-aa37-1a04a724c8c7@suse.com |
---|---|
State | Accepted |
Headers |
Return-Path: <binutils-bounces+ouuuleilei=gmail.com@sourceware.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp595615wru; Thu, 10 Nov 2022 23:32:32 -0800 (PST) X-Google-Smtp-Source: AA0mqf6dcYZKfAlb6WOrSMvvl7cN4kIN++ULP3iDc2AXGuDkYaRskjdY+KGM/N3vtAyFQOaOwpY5 X-Received: by 2002:a17:907:c207:b0:7ad:79c0:46f4 with SMTP id ti7-20020a170907c20700b007ad79c046f4mr911742ejc.363.1668151952599; Thu, 10 Nov 2022 23:32:32 -0800 (PST) Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id g3-20020a170906868300b0073c14b6560bsi1254457ejx.177.2022.11.10.23.32.32 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Nov 2022 23:32:32 -0800 (PST) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=xIbmp0az; arc=fail (signature failed); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 69FC23858434 for <ouuuleilei@gmail.com>; Fri, 11 Nov 2022 07:32:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 69FC23858434 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1668151951; bh=ZfVdLkSlU2EWk6dKgujKtxqAZzwsDKp5++J+yR0y9JY=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=xIbmp0azrgClXFGRZkqXNTDjKPfNUfEa+qK3SVy4Yu6Ls/VkLr4S+ldtpyocxymMy 63aQgyrGnDv9pTX6D3Dw80VHL8+QacYuu8yWZA1A3skHj0kc7Zg/2T3CudLcTUR0eJ FiqOw2hFtzzXWFGOZklfkNHjBwbJG5D2rD1nTKzg= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140089.outbound.protection.outlook.com [40.107.14.89]) by sourceware.org (Postfix) with ESMTPS id F33683858C52 for <binutils@sourceware.org>; Fri, 11 Nov 2022 07:32:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F33683858C52 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LKOgw/RUkvgo+Hti+qP/DPivszl9z8+hpD6bP5GyFn3WeBV+gkOj5TJVsyEQkAJr71T9x28oKxZNHyD6XA0HSdCd9t5glsHBo1TgljVPTBuXHjp/ta3TglE7BPfJm8D+Zr9VWi4QdPQxp8PL0LjPA4C5UrSWcHXKU8N2BlAu7B4/xDs7wsltL1JkVP4H24EjUr3SN1q0Klw5CVN4lt0KdmTivwX0+CdxFtBR7FUtB5quBR9gYUzAsKuEo7trSi+puAFJVYJdceGmjinZJnjlqQRCoEjkYIuRRl2qq2d1UCafJB2xUVT8E6QfmGq75hxxXItavQ2cSNkLEu/VXfvAEg== 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=ZfVdLkSlU2EWk6dKgujKtxqAZzwsDKp5++J+yR0y9JY=; b=ZsVL5kyYPqqUlqcZFk12jgZQTJn7mDq/KAnq4MBNCUyPhxMfJPnXEMaRz8JnCZWa6nJNA5V6G2kVe7oQtLUx1XfeFjuXfEtWMO/sScqEv5s2xMuOuOanYYwHgbIFK0aCgqnsILNjSm2fzmP8KhS3iZVLHe0EeYU2ng9U7oGX6oIvea4jRvESFWfDxU76nS+DxhEiwaf5gx26SyuEbrHRiTa5Cgd8q/t5s2w2btQaZRdvKQhDfoX9Z7T5rVYEmLjiOjnhZKNBXL++kPGEUAsqwzsyl30LHGHBRMUrGSCGOPq5UGs9RqGXpe2zJ9s7u3+FiuRwgN8V1h72SSaRVXrWug== 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 Received: from VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) by AS4PR04MB9268.eurprd04.prod.outlook.com (2603:10a6:20b:4e3::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.13; Fri, 11 Nov 2022 07:32:18 +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.5791.027; Fri, 11 Nov 2022 07:32:18 +0000 Message-ID: <40e89395-1438-6cbe-aa37-1a04a724c8c7@suse.com> Date: Fri, 11 Nov 2022 08:32:17 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.4.1 Content-Language: en-US To: Binutils <binutils@sourceware.org> Subject: [PATCH] gas: accept custom ".linefile <n> ." Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: FR0P281CA0127.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:97::8) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6560:EE_|AS4PR04MB9268:EE_ X-MS-Office365-Filtering-Correlation-Id: 71df6838-1d0c-4c1e-36c0-08dac3b6dccb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: A/mVjHxFoK2Otcd3I29C1VqqML3GFu0lsSiiJ79lacYbm8dzVdd8/ZL2hX3QA/5+xwOp0F+x6UWnkNPDDplPHx+ZdflcjX3JcFy8O7YlT5P7FJ4C30599y4dmVn/sxkxr+sLUSQ4SjRAvBg9shvD/9Bd8ottKHDJI1USb9n+3UoMe9SMfzq3MdkND6yePXg5Lhib1+CWLbv+z/tPYm0mvwY8kCd/MwgV8ojohROP1E6e+H0H9e17SNhIotZUHM/BVxfSrusI1lK15ZUZrr2WWw+kRlq13g/WRYRGbkQsTLi6kF2iIT0aggTiRdSvAvLWr6e0+JoH4UsZ8dOJf6Frn+geHVB8gmTFWgxVyPEjvzAI9dN04j127F7F9LHE/OQoqApQbQ77dh/K8+BRz7CEzys2mZW4tzGz9ukSp/n4WKL8O7ulEHH/8GX6uDC3s/WPMYMHv5WYE13XEBeEeaEk1/pDiAIWGnfIl/soqOs9rRPWLlpy0poeHiVoGoewIKbTb8bM5k0QM7Mf/JW6jcq/shZ4V1atQn+x1vpN8Egb4tzkRei52ZfLZ+FC6UE8HrxJDtjQa//0f0HUQ1sxSQxTEmBOQwfbaOdwFLtZ+V0jrHnKpbLKDaABccUZ0tc9ViiCoZW6RqCpJFjpHc2aFWbqASUKMtyB8E9YxVRpNuSecURzXQaqjRhkdBoCUkmSOX3EstvDAjSZg4R9F+ntpvstavNFDNtfc9EgNcsORt1mUXS5JfpLsW8jlo1rOcDSdOOq+Qi0/LNyvrpNqItwjRilZn4B0X1QH4a6zXNwb9kn+7Q= 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)(396003)(346002)(376002)(136003)(366004)(39860400002)(451199015)(83380400001)(31686004)(186003)(6486002)(2906002)(38100700002)(86362001)(31696002)(66556008)(478600001)(6916009)(316002)(2616005)(5660300002)(6506007)(4744005)(36756003)(66476007)(66946007)(6512007)(26005)(8676002)(8936002)(41300700001)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?wHOR6dXyYvr8Ho8iYPmkzF+Q/9Ge?= =?utf-8?q?3s8Sg4iZcILK6MhLt2e1Kl0gMD/AWbpz1aSmm8Aw733aaydNIn5Jzhmp22SsjdSa3?= =?utf-8?q?dL8Z5lHeap5Bmtomm8aqQcoC2SBkiY+rvUS2rqOUYS8Oxeb055g9+PiTG8pCq0QIP?= =?utf-8?q?JtTgskoE3Ld0Hkvy0+xvHfspLtGzo/D+iqoMW3CY3ynTNeUuPuP9CfxLKdwg5KCTV?= =?utf-8?q?DrTBm9Kp/r7yAms4KaYVzfWbgdUYgg8xp3Fr0lJBuguhuAj6AiCijJbhfEpyKJfdt?= =?utf-8?q?0wiYR+O+xkrXJYyyCCLQeAJBjhf4MrqcdgTuKsdzDMOUx4WEsVKqvmfxa0+E8ntmN?= =?utf-8?q?+SCR/4MuLYYFX5S+2SLl6qouMLX8EdGSRD32QArKxkF3Defben+PdQc5mbWKgcQt0?= =?utf-8?q?qyHiZTRopUlhEyw2mSYf4RriqyKrt/xxWMzi7Wh0q61pZ0PWX6vjG8L5i+KWjxFhr?= =?utf-8?q?VJgOtex7hIgccCk1TA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SR+saCe36wzDebnWEu4BNyb4k4S9YvvkILZKCyaeHa?= =?utf-8?q?B6kTnbAM/DG0/5qEUpfgvlw1LPcYsMynp8mQm8eMsJ0xaociGUvrQ9HNxtSpodH9i?= =?utf-8?q?7S9XfK6Ad8SaphmvG7X8vxwyIHjuYJP0WvTUbREAwOdt7PDGNVJtAAwlXebI9rD9w?= =?utf-8?q?2Mefc++c5xSC?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 71df6838-1d0c-4c1e-36c0-08dac3b6dccb X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2022 07:32:18.6334 (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: I+4I4niLJcgPAimSjcDHikXbquOmFDotozqdWxYZUMEiKrRdO5LQ4NMw2iIriv8nLj7OtYXMB6/ZwGCtjkkXRg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR04MB9268 X-Spam-Status: No, score=-3029.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, 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 X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list <binutils.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/binutils>, <mailto:binutils-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/binutils/> List-Post: <mailto:binutils@sourceware.org> List-Help: <mailto:binutils-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/binutils>, <mailto:binutils-request@sourceware.org?subject=subscribe> From: Jan Beulich via Binutils <binutils@sourceware.org> Reply-To: Jan Beulich <jbeulich@suse.com> Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" <binutils-bounces+ouuuleilei=gmail.com@sourceware.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749184102008521383?= X-GMAIL-MSGID: =?utf-8?q?1749184102008521383?= |
Series |
gas: accept custom ".linefile <n> ."
|
|
Checks
Context | Check | Description |
---|---|---|
snail/binutils-gdb-check | success | Github commit url |
Commit Message
Jan Beulich
Nov. 11, 2022, 7:32 a.m. UTC
While .linefile is generally intended for gas internal use only, its use in a source file would better not result in an internal error. Give use of it outside of any macro(-like) construct the meaning of restoring the original (physical) input file name.
Comments
Hi Jan, > While .linefile is generally intended for gas internal use only, its use > in a source file would better not result in an internal error. Agreed. > Give use > of it outside of any macro(-like) construct the meaning of restoring the > original (physical) input file name. We should document this behaviour in the as.texi file then, so that it is "official"... > --- a/gas/input-scrub.c > +++ b/gas/input-scrub.c > @@ -469,13 +469,15 @@ new_logical_line_flags (const char *fnam > /* FIXME: we could check that include nesting is correct. */ > break; > case 1 << 3: > - if (line_number < 0 || fname != NULL || next_saved_file == NULL) > + if (line_number < 0 || fname != NULL) > abort (); I still hate having calls to abort() in code. Much better to have a helpful error message IMHO. Not important for this patch though. Cheers Nick
On 14.11.2022 14:43, Nick Clifton wrote: >> While .linefile is generally intended for gas internal use only, its use >> in a source file would better not result in an internal error. > > Agreed. > >> Give use >> of it outside of any macro(-like) construct the meaning of restoring the >> original (physical) input file name. > > We should document this behaviour in the as.texi file then, so that it > is "official"... Do you really think we should? .linefile as a whole is undocumented. If people use it, then at their own risk (if we made things "official", later we couldn't later behavior anymore). The point of the change here was merely to avoid an internal error that I had noticed. The particular behavior chosen was simply the one easiest to implement (and at least halfway sensible) while addressing the issue. I am, btw, doing further work in this area, which includes zapping .linefile from listings (where I think it should never have appeared, but I didn't think of that aspect several months ago). Such zapping would imo also be unreasonable if the directive became "official". Jan
Hi Jan, >> We should document this behaviour in the as.texi file then, so that it >> is "official"... > > Do you really think we should? .linefile as a whole is undocumented. If > people use it, then at their own risk (if we made things "official", > later we couldn't later behavior anymore). Alright - in which case we should document it as being unsupported/not for use. I am just trying to avoid the situation where a future binutils user discovers the directive, tries it out and then complains about it not working as expected/documented/whatever. Cheers Nick
On 14.11.2022 17:02, Nick Clifton wrote: >>> We should document this behaviour in the as.texi file then, so that it >>> is "official"... >> >> Do you really think we should? .linefile as a whole is undocumented. If >> people use it, then at their own risk (if we made things "official", >> later we couldn't later behavior anymore). > > Alright - in which case we should document it as being unsupported/not > for use. > > I am just trying to avoid the situation where a future binutils user > discovers the directive, tries it out and then complains about it not > working as expected/documented/whatever. Okay, if you could give me a hint where undocumented stuff is to go in as.texi, I could see about making a patch. Otherwise if you would make one, it could still educate me in case something else needs similar treatment going forward. Jan
On 14.11.2022 14:43, Nick Clifton wrote: >> --- a/gas/input-scrub.c >> +++ b/gas/input-scrub.c >> @@ -469,13 +469,15 @@ new_logical_line_flags (const char *fnam >> /* FIXME: we could check that include nesting is correct. */ >> break; >> case 1 << 3: >> - if (line_number < 0 || fname != NULL || next_saved_file == NULL) >> + if (line_number < 0 || fname != NULL) >> abort (); > > I still hate having calls to abort() in code. Much better to have > a helpful error message IMHO. Not important for this patch though. So do you consider gas_assert() better? I've been using abort() (here and elsewhere) only because of pre-existing adjacent uses and H.J. at some point (in x86 code) asking me to use that in favor of gas_assert(). Personally I'd prefer making things like the above assertions. But perhaps such could also be as_fatal(). Jan
Hi Jan, >> Alright - in which case we should document it as being unsupported/not >> for use. > Okay, if you could give me a hint where undocumented stuff is to go > in as.texi, I could see about making a patch. There isn't one. :-) There is however a node called "AS Sections" which details the assembler specific sections like .expr. So there is a (very small) precedence for this kind of thing. > Otherwise if you would > make one, it could still educate me in case something else needs > similar treatment going forward. OK, I will look into it. In the meantime please consider my suggestion withdrawn. Cheers Nick
Hi Jan, >>> abort (); >> >> I still hate having calls to abort() in code. Much better to have >> a helpful error message IMHO. Not important for this patch though. > > So do you consider gas_assert() better? Not really. It still does not tell the user what has gone wrong, nor does it help them avoid the problem. Sure they can report it, and having an abort makes it easier for an investigator to use a debugger to catch the problem, but in the meantime the user is still left wondering what went wrong. The assembler (and other tools) already have a well understood way of telling the user that something has gone wrong - the exit status code, along with, hopefully, an error message. So I think that it is best to make use of it. > But perhaps such could also be as_fatal(). Given a choice, I would definitely prefer as_fatal() over gas_assert() or abort(). But this is just my preference. I am not laying down the law here, and I am not going to reject patches just because they contain calls to abort. Cheers Nick
--- a/gas/input-scrub.c +++ b/gas/input-scrub.c @@ -469,13 +469,15 @@ new_logical_line_flags (const char *fnam /* FIXME: we could check that include nesting is correct. */ break; case 1 << 3: - if (line_number < 0 || fname != NULL || next_saved_file == NULL) + if (line_number < 0 || fname != NULL) abort (); /* PR gas/16908 workaround: Ignore updates when nested inside a macro expansion. */ if (from_sb_expansion == expanding_nested) return; - if (next_saved_file->logical_input_file) + if (next_saved_file == NULL) + fname = physical_input_file; + else if (next_saved_file->logical_input_file) fname = next_saved_file->logical_input_file; else fname = next_saved_file->physical_input_file;