From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oa1-x2d.google.com (mail-oa1-x2d.google.com [IPv6:2001:4860:4864:20::2d]) by sourceware.org (Postfix) with ESMTPS id 4F3AD3858D32 for ; Tue, 25 Apr 2023 08:13:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4F3AD3858D32 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-oa1-x2d.google.com with SMTP id 586e51a60fabf-18b5c8c2a49so3361535fac.3 for ; Tue, 25 Apr 2023 01:13:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20221208.gappssmtp.com; s=20221208; t=1682410433; x=1685002433; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Y8ThM9i6ozbfBQJuKx1wWhtBEkndQChkHikTwCc6FOo=; b=cEnQcK/ozMPRPif/jasYWTLbNDpeMRhXGEXMRTEt2Ts/NKig9Xs1yV340bci4mo89H eb/+AmaeKCu3gMw32NIiqErcdgYbN1tqWyZcHRxI2oOyCDtKfsON2vYDDd4ENG4lYN4j 2lIvbM3tD6vYLClgwtdMPAdqoUUOJSGuwRJIHBGAKXO0qFzGeHFjL4Z/N6ddX0Q/o8+7 /kP2MfsJvm5KPztd8mxPszsreQ5l9gsTFtRyYsUYyWZMYBfAYdKQAFgkubJR2v3uXTCH pqJR+Vb0jezijkC8eA8i+askagcpMcnHntjhimMcnn2KKSWo+RfCl8GGv7s8cutU7rWD CfgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682410433; x=1685002433; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Y8ThM9i6ozbfBQJuKx1wWhtBEkndQChkHikTwCc6FOo=; b=LQXt6Kv83eoxIoJxT5UInAtNUMicTpGQzlGhiIgpclzqNHMbuQoDdcJhKrIPr4ggz/ DTRNjp8aH/G/Ly8M27N6llfxMgoLFkoxOkOFJsWYsKkbEVJyg1EUNl61GrX4lOlev65g /dR7nafUhWPjxr8PHlvxEa8oxAfz1XertICpqknJPCOK8lIVsU8pYyBcTmf2kzisbrU1 DPGipe59siXpTTKgkW3vYDvbeO6eGo6ePo4royVzc622jtc/FcG2HZEI3tn/mdmB6k5/ CeBXu3bcidubXb/qon4RaGO5H6R5WzGgsSH7Ybcln00y18jKoC6TJHr98Od2Xni+Xw80 m2BA== X-Gm-Message-State: AAQBX9fCrScLXKgmQj7pxpf2tuNMa2YKlkWdpB3vxd7IlE62E21wVDlP Fe2li1bNubf/vViKhJA50OqWN80DYTX6g4g7xlmdTg== X-Google-Smtp-Source: AKy350ZrCIOMmU7SojjhyIs5VqlILyacPoItyp4VEpSt3NQ00esQFFy9TqARcH4Uql3E3dzDhfvQJ8MaiXvETroDC/Q= X-Received: by 2002:a05:6870:b383:b0:177:dfdb:63 with SMTP id w3-20020a056870b38300b00177dfdb0063mr10371418oap.44.1682410433545; Tue, 25 Apr 2023 01:13:53 -0700 (PDT) MIME-Version: 1.0 References: <89f892c8-e378-b81c-7b13-322a7876a252@suse.com> In-Reply-To: <89f892c8-e378-b81c-7b13-322a7876a252@suse.com> From: Nelson Chu Date: Tue, 25 Apr 2023 16:13:42 +0800 Message-ID: Subject: Re: [PATCH v2 5/7] RISC-V: relax post-relocation-operator separator expectation To: Jan Beulich Cc: Binutils , Palmer Dabbelt , Andrew Waterman , Jim Wilson Content-Type: multipart/alternative; boundary="000000000000421bca05fa24b49d" X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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: --000000000000421bca05fa24b49d Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Mar 10, 2023 at 5:27=E2=80=AFPM Jan Beulich wro= te: > 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 =3D 1 + strlen (percent_op->str); > > - if (!ISSPACE ((*str)[len]) && (*str)[len] !=3D '(') > + if (is_part_of_name ((*str)[len])) > continue; > > *str +=3D 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 > > --000000000000421bca05fa24b49d--