Message ID | 89f892c8-e378-b81c-7b13-322a7876a252@suse.com |
---|---|
State | Accepted |
Headers |
Return-Path: <binutils-bounces+ouuuleilei=gmail.com@sourceware.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp770536wrd; Fri, 10 Mar 2023 01:28:35 -0800 (PST) X-Google-Smtp-Source: AK7set+NSbZ0fq29IDZZ5QdrQoqkNK3SCCU9YUeAElSUowF56um0iiP7a5pgd3enwgC7eiHmpcSb X-Received: by 2002:a17:907:608b:b0:873:1b57:b27f with SMTP id ht11-20020a170907608b00b008731b57b27fmr33504215ejc.61.1678440514870; Fri, 10 Mar 2023 01:28:34 -0800 (PST) Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id jp4-20020a170906f74400b008da5d744f15si1511578ejb.815.2023.03.10.01.28.34 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Mar 2023 01:28:34 -0800 (PST) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=ggN5ptDf; arc=fail (signature failed); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 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 7A3AB3851AB8 for <ouuuleilei@gmail.com>; Fri, 10 Mar 2023 09:28:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7A3AB3851AB8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1678440499; bh=BIB725LlYOkZ3qCJi3o5WZr1x6hVlG2TJadW97ORhO8=; h=Date:Subject:To:Cc:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=ggN5ptDfFRbYtAVSQKGT/+qxwDWvbgDZweC/DCm51iLQMUtfZpG6F2gV4WcK32aqA mqUQPAHphit0WmZSw0MTSZBSH0Ou59bnMyvgE+kJOGxldX8TPwkClUwmktNcgcNB25 rh6gghuDpkxddVQEFVqiDC5NOy//v4A2ZIgK1LCM= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2071.outbound.protection.outlook.com [40.107.20.71]) by sourceware.org (Postfix) with ESMTPS id 5AEA73858002 for <binutils@sourceware.org>; Fri, 10 Mar 2023 09:27:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5AEA73858002 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LZSbwlmGcE5binAZAZyJ7+ZbONroMvEizq6mzLwg3TfWRbPhD1U24YWwpnDy3DaW3ozf71qH9kYdEYh1HqXudFo+kkgoHO6OdHKzjjtvgWvinJyc2aya8OR94s7YdId1sRsID5iU1/gIqDZyfHUxZ5VvpojIYQFdUOXE4zHoToDqIGdIGAQe73inhOsHCqu7XasbiFN5tGb6VoY1r7jsHxLytCLDk2S7hjr5rcjuBA6kQS9ITgEOwWZ8syW7OmAwv75VsTlICbuueKI6m4r7/+C1bZTcMxj2G+lq1KPx1yynu9u+oPId0yoAEtWF0RaTp6YnkVwBfqIvvnIyuvZPsg== 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=BIB725LlYOkZ3qCJi3o5WZr1x6hVlG2TJadW97ORhO8=; b=U2+VY/XDWffK67AmlcTRRCfrPWMjidl+Vh1soN64ZnT/6yXQ8FtLXWjf6Q1Tt2oWxmAxNDFDmERVaAaSKTCdSGAto9mO185Qa2BQBXpogwuMtaFpD8JTRYgUzqqPSSbzgt4+thtIxbENQOVJhF6ACP3MclsMfCs1EdnHV1tJ5XUmvMRylFDi+YZMyKez3dUakWJdcpEyMuVFHfU8YWoK3rNcjdtTm/PUnaECBpIuuGhy8YXYocbuak6bVPjVjkC3RPXI99FF85nvjTQjPtp2OZrLePDwUKRoD4OONn59VOiI4soHtSrT/Q7lPLYL/JyVel70kTw91X+7ofzaJJo4Bw== 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 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:27:28 +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:27:28 +0000 Message-ID: <89f892c8-e378-b81c-7b13-322a7876a252@suse.com> Date: Fri, 10 Mar 2023 10:27:26 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: [PATCH v2 5/7] RISC-V: relax post-relocation-operator separator expectation Content-Language: en-US To: Binutils <binutils@sourceware.org> Cc: Palmer Dabbelt <palmer@dabbelt.com>, Andrew Waterman <andrew@sifive.com>, Jim Wilson <jim.wilson.gcc@gmail.com>, Nelson Chu <nelson@rivosinc.com> References: <ba68222c-7de6-280d-e98e-503e3c27addc@suse.com> In-Reply-To: <ba68222c-7de6-280d-e98e-503e3c27addc@suse.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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_|PA4PR04MB9464:EE_ X-MS-Office365-Filtering-Correlation-Id: bd1318b3-95d5-4678-434b-08db2149aab1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zwcfXW5ZCgaQoY8bcsdR/nFfWx+8Weso3lpD2vKX3/Vibp8PO63dAS+2lAwDKr4dimFTZmhtUCCDfkg5uIovcYE8HEb/djDaaJKPRX9gI3R9aZpIbTo+IVuF2ZwTXVHc73KxltXhRITmdbcYncT+8RTmMv3S5zAxkWhwAqTdnaIHX6sN0anE23kmcQoBgvjRGaGDtSI88t9HHUp8Tpn+BrT31HpnLFjdg430mE5tUxbTR2KJQlHYNiNxvbSqxcS6eUYGjn/0hFV7Uqqq/09iUUo49utPhtaoTzFw71K+OInzj1AAKNUTGN3fG2p0lrGRJtIPYHk9xkaAwY40bdrGsbjZq2NmcLATmZpPxmUId6l9LsMd8HHNFLd8eGin7a1GMl+p7nPUSfK5m0qAdtyNKuEKh7eX5zSLNHc4iQFyDm/+YwP54Zhnk8fnBLZSc7EqRODhUQ07K3UKB5ylKx/eyeoEgWJe6PqSg620rNAXxSXuoXIM9sLcmbYwyvoVGQEIHa1BJZyKXfwxyru9uxbXJW1Voh6oeVGjqddrZc5j9vOmpAkiWCZwaqWyXX8x9iSAxAJH98raHQUIe/FOnwvAmgdpp020uCjdHxUwb+O1IQFOB8bAbpA17lh4s7A+9Ws5LdsuEddhx0XfPetq8LK3xnNt9G0iQkaI0mUH7+4DhTcGZSyMtNFBqSarHFAP5x8eh3CHvrJZc5zm5pKhlpGZVwIBWFvcVUpIFmyQr1fezxQ= 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)(346002)(366004)(39860400002)(396003)(136003)(376002)(451199018)(36756003)(54906003)(478600001)(6486002)(316002)(5660300002)(2906002)(8936002)(66946007)(66476007)(8676002)(66556008)(4326008)(41300700001)(6916009)(31696002)(86362001)(38100700002)(186003)(2616005)(6506007)(26005)(6512007)(31686004)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?Dn74kvHfF6e89Tcc/t8FH8pU26mU?= =?utf-8?q?wLbmllX1mOHwyBqqdK5YjHZZg4XZgSxX8poGCIWmFK1cZlfSIL2pzQ7vWl6uLYoa6?= =?utf-8?q?iv6T9+4b7oLcbe/uw2LwyiQ1m7UC4ALHDD2u9eMyxhtTm8I7W6qc2wnSNdNajklRm?= =?utf-8?q?W8DSNLGkIid+5oJG0eQoQgxslQx/C3ONCMpXBY/9a9HzLFg5yP+ofRiVZXhKmhL6N?= =?utf-8?q?Hcgg3Hi2V7A3FbeSX53fATGuxeD2Z2azOgEYcruD6+tmBoxSNkA3Bm12x1iJolztx?= =?utf-8?q?SJ06aagHB9GnEFyOzviYxnrSm9GhvlvY4QRglkSgOYM9NX9wTzVG4dtsIkPx72aVk?= =?utf-8?q?UPam3XZCryG3CP6AOjb9RCjRSj61R6a4vOJCB8z2BQWAOoWzjyHE7aUQGfhggQ9NK?= =?utf-8?q?Leryr9PliCczFQPXaq5Ksl1bfjJOHBeioLkxytoVNU7Kxt7I87jQvRijTFL4ldDr1?= =?utf-8?q?RA8IN3FClr9ow1IWt4gNXG6pnqEF+7vvoevXifIDKt/VsLkXvql2XJj9y3MwLHYb0?= =?utf-8?q?gEBPnKG9gE8aQ5KscIxCR2IByEnUHWupf91NSuUd17Fzcn3Nf+h8aZTqQlb/kUNgS?= =?utf-8?q?ZSik2PCuHZolSwktCtCxYezsSJKb1XOJRavudInfTtRp0sWfltEbxwxtn72S+dCTy?= =?utf-8?q?0TWQHl3jRZD4T201tiXoftIIOsAGYKJDnOrm74Kn29z8jZh8urBnk9+gzJ6QljJ97?= =?utf-8?q?GyYfJHESbKuHNlMwwsyywrq46VYGOenddWtS58kuT4JTgnF0Wo0yBTC+ub8PiGdFj?= =?utf-8?q?JkOkGEcduXo0FmsPX1OXFv74PJI/6CuW7UhFR/HBP6ZjgbQa2OVW4arI9IEHQdFqe?= =?utf-8?q?fqK17X4enn6DcJyptHvemhmTQp+wLP+iUapmqkqlM3K6QtL07SVU6ip1mrUMv8Crx?= =?utf-8?q?y3pMOq9PihQZg10P2b8vUCEqke4YzAMcNbnTCuyh3blbmPl7vgos6Fp7jg9yAzVHl?= =?utf-8?q?UCwHrGyS590HFpWrrduXiFE63t/iwcrcwjSaNwNXH7Ujx2pJd7Pd3tVHStZOPBemq?= =?utf-8?q?U2cW4SKqhGXNQfu4Nbfi8bg4Q9FKk5B9DZ/ecpe50OA2geyIQtnalBTpe6v4buuat?= =?utf-8?q?onQDswRewg3ItcdvfhWcN1MHAZ+1tFNOVmznV+wOKnQo+5q5vGzLLYHn2FcscFZh9?= =?utf-8?q?C+QTQJTDLBBCWzAszkXTbeE2OTSWLHz6RIt6eT8UUdAPpPJGLhgedZZZhdXQuI/lf?= =?utf-8?q?SIzGl2N9AYC4Cw/ajKa5qot/aCJtbpc5dAZW/hGDxlflntiwvNwdMCiEM9ryz0fuk?= =?utf-8?q?50DvzBOLwGMsA50CwI2ywO3qN2XXBThOyjxsm7sR7ErwLcWL/w8mFEVFBAWThchmq?= =?utf-8?q?v9NwWXA5whDL8qJtVXtS6xdXUSY+Ot7X+hERZxPURg7EV7c0XfoInNimsQ7IS+Wpj?= =?utf-8?q?Lr/yaH3ZRvWIhs4gtnxP7rsmNWzn7gPx0VUzvsoWfSRwy196KWPjNRQ8hS1CQ1HTX?= =?utf-8?q?vGHmq5xoZ3T/CvafX5e1In8hwihdKul6dE2j+dlye2kug6oLN1OAeQs54QBPmjN08?= =?utf-8?q?A07hJpc782lA?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: bd1318b3-95d5-4678-434b-08db2149aab1 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:27:28.4536 (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: k/IsENxDCjdk8Wm81FBBriE548X4raiM3U/01PwbUK2/uYn+B9LiQR+xhMKrHeTW28i3XAcLsT7U0P7JIfwxag== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB9464 X-Spam-Status: No, score=-3028.2 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?1759972441248038834?= X-GMAIL-MSGID: =?utf-8?q?1759972441248038834?= |
Series |
RISC-V/gas: insn operand parsing
|
|
Checks
Context | Check | Description |
---|---|---|
snail/binutils-gdb-check | success | Github commit url |
Commit Message
Jan Beulich
March 10, 2023, 9:27 a.m. UTC
With a blank being okay as a separator, constructs like lui t0, %hi sym lui t0, %hi 0x1000 are accepted. But then it makes little sense to not also accept e.g. lui t0, %hi +sym lui t0, %hi -0x1000 Therefore instead of looking for a blank or opening parenthesis, merely check whether what follows wouldn't continue an identifier. Note that we don't need to also check is_name_ender(), as LEX_END_NAME isn't used for any character. --- v2: New.
Comments
On Fri, Mar 10, 2023 at 5:27 PM Jan Beulich <jbeulich@suse.com> wrote: > With a blank being okay as a separator, constructs like > > lui t0, %hi sym > lui t0, %hi 0x1000 > I never noticed this kind of usage. I always thought we should have a () after the %hi/%pcrel_hi/..., so perhaps this is just a mistake that should be fixed. Maybe other experts can help to clarify this behavior. Thanks Nelson > are accepted. But then it makes little sense to not also accept e.g. > > lui t0, %hi +sym > lui t0, %hi -0x1000 > > Therefore instead of looking for a blank or opening parenthesis, merely > check whether what follows wouldn't continue an identifier. > > Note that we don't need to also check is_name_ender(), as LEX_END_NAME > isn't used for any character. > --- > v2: New. > > --- a/gas/config/tc-riscv.c > +++ b/gas/config/tc-riscv.c > @@ -2184,7 +2184,7 @@ parse_relocation (char **str, bfd_reloc_ > { > size_t len = 1 + strlen (percent_op->str); > > - if (!ISSPACE ((*str)[len]) && (*str)[len] != '(') > + if (is_part_of_name ((*str)[len])) > continue; > > *str += len; > --- a/gas/testsuite/gas/riscv/auipc-parsing.d > +++ b/gas/testsuite/gas/riscv/auipc-parsing.d > @@ -1,3 +1,3 @@ > -#as: > +#as: -al > #source: auipc-parsing.s > #error_output: auipc-parsing.l > --- a/gas/testsuite/gas/riscv/auipc-parsing.l > +++ b/gas/testsuite/gas/riscv/auipc-parsing.l > @@ -3,3 +3,7 @@ > .*: Error: illegal operands `lui x10,x11' > .*: Error: illegal operands `auipc x12,symbol' > .*: Error: illegal operands `lui x13,symbol' > +#... > + *[0-9]+[ ]+# Accept unary .* > + *[0-9]+[ ]+\?\?\?\? 17070000[ ]+auipc x14,%hi \+symbol > + *[0-9]+[ ]+\?\?\?\? B7B7CBED[ ]+lui x15,%hi -0x12345678 > --- a/gas/testsuite/gas/riscv/auipc-parsing.s > +++ b/gas/testsuite/gas/riscv/auipc-parsing.s > @@ -4,3 +4,6 @@ > # Don't accept a symbol without %hi() for 'u' operands. > auipc x12,symbol > lui x13,symbol > +# Accept unary operators starting the subject expression. > + auipc x14,%hi +symbol > + lui x15,%hi -0x12345678 > >
On Mär 10 2023, Jan Beulich via Binutils wrote: > With a blank being okay as a separator, constructs like > > lui t0, %hi sym > lui t0, %hi 0x1000 > > are accepted. But then it makes little sense to not also accept e.g. > > lui t0, %hi +sym > lui t0, %hi -0x1000 https://github.com/riscv-non-isa/riscv-asm-manual/blob/master/riscv-asm.md always includes the parens around the expression, and I don't think it should be accepted without them.
Thanks for the information, Andreas. The riscv-asm should be the right place to see the expected behaviors, and discuss the related stuff :-) Nelson On Tue, Apr 25, 2023 at 4:37 PM Andreas Schwab <schwab@linux-m68k.org> wrote: > On Mär 10 2023, Jan Beulich via Binutils wrote: > > > With a blank being okay as a separator, constructs like > > > > lui t0, %hi sym > > lui t0, %hi 0x1000 > > > > are accepted. But then it makes little sense to not also accept e.g. > > > > lui t0, %hi +sym > > lui t0, %hi -0x1000 > > https://github.com/riscv-non-isa/riscv-asm-manual/blob/master/riscv-asm.md > always includes the parens around the expression, and I don't think it > should be accepted without them. > > -- > Andreas Schwab, schwab@linux-m68k.org > GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 > "And now for something completely different." >
On 25.04.2023 10:44, Nelson Chu wrote: > Thanks for the information, Andreas. The riscv-asm should be the right > place to see the expected behaviors, and discuss the related stuff :-) Just to clarify: Is this a request to replace this patch by one insisting on the use of a parenthesis? If so, I can certainly do that, and commit only the remaining patches (as per your other reply). Jan > On Tue, Apr 25, 2023 at 4:37 PM Andreas Schwab <schwab@linux-m68k.org> > wrote: > >> On Mär 10 2023, Jan Beulich via Binutils wrote: >> >>> With a blank being okay as a separator, constructs like >>> >>> lui t0, %hi sym >>> lui t0, %hi 0x1000 >>> >>> are accepted. But then it makes little sense to not also accept e.g. >>> >>> lui t0, %hi +sym >>> lui t0, %hi -0x1000 >> >> https://github.com/riscv-non-isa/riscv-asm-manual/blob/master/riscv-asm.md >> always includes the parens around the expression, and I don't think it >> should be accepted without them. >> >> -- >> Andreas Schwab, schwab@linux-m68k.org >> GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 >> "And now for something completely different." >> >
Sorry for missing this one. No, not a request. I'm fine with both, since this patch won't break the risc-gnu-toolchain regression, so most of the stuff already used looks good. It seems that the risc v-asm doesn't say we "must '' use a parenthesis after the modifiers, it just shows examples that all use it. Thanks Nelson On Tue, Apr 25, 2023 at 4:52 PM Jan Beulich <jbeulich@suse.com> wrote: > On 25.04.2023 10:44, Nelson Chu wrote: > > Thanks for the information, Andreas. The riscv-asm should be the right > > place to see the expected behaviors, and discuss the related stuff :-) > > Just to clarify: Is this a request to replace this patch by one insisting > on the use of a parenthesis? If so, I can certainly do that, and commit > only the remaining patches (as per your other reply). > > Jan > > > On Tue, Apr 25, 2023 at 4:37 PM Andreas Schwab <schwab@linux-m68k.org> > > wrote: > > > >> On Mär 10 2023, Jan Beulich via Binutils wrote: > >> > >>> With a blank being okay as a separator, constructs like > >>> > >>> lui t0, %hi sym > >>> lui t0, %hi 0x1000 > >>> > >>> are accepted. But then it makes little sense to not also accept e.g. > >>> > >>> lui t0, %hi +sym > >>> lui t0, %hi -0x1000 > >> > >> > https://github.com/riscv-non-isa/riscv-asm-manual/blob/master/riscv-asm.md > >> always includes the parens around the expression, and I don't think it > >> should be accepted without them. > >> > >> -- > >> Andreas Schwab, schwab@linux-m68k.org > >> GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 > >> "And now for something completely different." > >> > > > >
On 28.04.2023 03:29, Nelson Chu wrote: > Sorry for missing this one. No, not a request. I'm fine with both, since > this patch won't break the risc-gnu-toolchain regression, so most of the > stuff already used looks good. It seems that the risc v-asm doesn't say we > "must '' use a parenthesis after the modifiers, it just shows examples that > all use it. Hmm, interesting. My interpretation of especially the table in the doc (not so much the examples) would be that it pretty much mandates parentheses. One might even go as far as taking it to mandate no blank between reloc specifier and paren (but I wouldn't feel well going that far without it being said explicitly). So my plan was to make the alternative patch, and then leave it to you (incl other maintainers) to decide (with my personal preference being the yet to be created alternative one, now that I've seen the doc). Jan
On Thu, Apr 27, 2023 at 11:05 PM Jan Beulich via Binutils <binutils@sourceware.org> wrote: > > On 28.04.2023 03:29, Nelson Chu wrote: > > Sorry for missing this one. No, not a request. I'm fine with both, since > > this patch won't break the risc-gnu-toolchain regression, so most of the > > stuff already used looks good. It seems that the risc v-asm doesn't say we > > "must '' use a parenthesis after the modifiers, it just shows examples that > > all use it. > > Hmm, interesting. My interpretation of especially the table in the doc (not > so much the examples) would be that it pretty much mandates parentheses. One > might even go as far as taking it to mandate no blank between reloc specifier > and paren (but I wouldn't feel well going that far without it being said > explicitly). So my plan was to make the alternative patch, and then leave it > to you (incl other maintainers) to decide (with my personal preference being > the yet to be created alternative one, now that I've seen the doc). > > Jan I agree that rejecting `%hi sym` shall be a reasonable change in gas. The LLVM integrated assembler (used by Clang and llvm-mc) rejects the syntax. % cat a.s lui t0, %hi sym % clang --target=riscv64 -c a.s a.s:1:18: error: expected '(' lui t0, %hi sym ^ a.s:1:18: error: unknown operand lui t0, %hi sym ^
On 25.04.2023 10:37, Andreas Schwab wrote: > On Mär 10 2023, Jan Beulich via Binutils wrote: > >> With a blank being okay as a separator, constructs like >> >> lui t0, %hi sym >> lui t0, %hi 0x1000 >> >> are accepted. But then it makes little sense to not also accept e.g. >> >> lui t0, %hi +sym >> lui t0, %hi -0x1000 > > https://github.com/riscv-non-isa/riscv-asm-manual/blob/master/riscv-asm.md > always includes the parens around the expression, and I don't think it > should be accepted without them. Just to mention it: Someone (validly) said that much of this code (and the underlying syntax) was derived from MIPS. Just now it happened that I had to look at the MIPS testsuite for a different reason, when it caught my eye that they're actually testing cases like the earlier two above (and I'm pretty sure they would similarly fail on the latter two). Jan
--- a/gas/config/tc-riscv.c +++ b/gas/config/tc-riscv.c @@ -2184,7 +2184,7 @@ parse_relocation (char **str, bfd_reloc_ { size_t len = 1 + strlen (percent_op->str); - if (!ISSPACE ((*str)[len]) && (*str)[len] != '(') + if (is_part_of_name ((*str)[len])) continue; *str += len; --- a/gas/testsuite/gas/riscv/auipc-parsing.d +++ b/gas/testsuite/gas/riscv/auipc-parsing.d @@ -1,3 +1,3 @@ -#as: +#as: -al #source: auipc-parsing.s #error_output: auipc-parsing.l --- a/gas/testsuite/gas/riscv/auipc-parsing.l +++ b/gas/testsuite/gas/riscv/auipc-parsing.l @@ -3,3 +3,7 @@ .*: Error: illegal operands `lui x10,x11' .*: Error: illegal operands `auipc x12,symbol' .*: Error: illegal operands `lui x13,symbol' +#... + *[0-9]+[ ]+# Accept unary .* + *[0-9]+[ ]+\?\?\?\? 17070000[ ]+auipc x14,%hi \+symbol + *[0-9]+[ ]+\?\?\?\? B7B7CBED[ ]+lui x15,%hi -0x12345678 --- a/gas/testsuite/gas/riscv/auipc-parsing.s +++ b/gas/testsuite/gas/riscv/auipc-parsing.s @@ -4,3 +4,6 @@ # Don't accept a symbol without %hi() for 'u' operands. auipc x12,symbol lui x13,symbol +# Accept unary operators starting the subject expression. + auipc x14,%hi +symbol + lui x15,%hi -0x12345678