public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Nelson Chu <nelson@rivosinc.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: Binutils <binutils@sourceware.org>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	 Andrew Waterman <andrew@sifive.com>,
	Jim Wilson <jim.wilson.gcc@gmail.com>
Subject: Re: [PATCH] RISC-V: tighten post-relocation-operator separator expectation
Date: Thu, 4 May 2023 16:16:09 +0800	[thread overview]
Message-ID: <CAPpQWtA2JT6dtQs5H7h4EK8mtm5i41WFF2Dvyp+GVaSN__5Q9w@mail.gmail.com> (raw)
In-Reply-To: <e1da592f-5c5b-418b-a25b-afeeb0691ea7@suse.com>

[-- Attachment #1: Type: text/plain, Size: 1638 bytes --]

Thanks for helping to fix this :)

Nelson

On Fri, Apr 28, 2023 at 8:57 PM Jan Beulich <jbeulich@suse.com> wrote:

> As per the spec merely a blank isn't okay as a separator, the operand
> to the relocation function ought to be parenthesized. Enforcing this
> then also eliminates an inconsistency in that
>
>         lui     t0, %hi sym
>         lui     t0, %hi 0x1000
>
> were accepted, but
>
>         lui     t0, %hi +sym
>         lui     t0, %hi -0x1000
>
> were not.
>
> --- a/gas/config/tc-riscv.c
> +++ b/gas/config/tc-riscv.c
> @@ -2200,7 +2200,9 @@ parse_relocation (char **str, bfd_reloc_
>        {
>         size_t len = 1 + strlen (percent_op->str);
>
> -       if (!ISSPACE ((*str)[len]) && (*str)[len] != '(')
> +       while (ISSPACE ((*str)[len]))
> +         ++len;
> +       if ((*str)[len] != '(')
>           continue;
>
>         *str += len;
> --- a/gas/testsuite/gas/riscv/auipc-parsing.l
> +++ b/gas/testsuite/gas/riscv/auipc-parsing.l
> @@ -3,3 +3,5 @@
>  .*: Error: illegal operands `lui x10,x11'
>  .*: Error: illegal operands `auipc x12,symbol'
>  .*: Error: illegal operands `lui x13,symbol'
> +.*: Error: illegal operands `auipc x14,%hi symbol'
> +.*: Error: illegal operands `lui x15,%hi symbol'
> --- 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
> +# Don't accept reloc functions without parentheses.
> +       auipc   x14,%hi symbol
> +       lui     x15,%hi symbol
>

      reply	other threads:[~2023-05-04  8:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-28 12:57 Jan Beulich
2023-05-04  8:16 ` Nelson Chu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPpQWtA2JT6dtQs5H7h4EK8mtm5i41WFF2Dvyp+GVaSN__5Q9w@mail.gmail.com \
    --to=nelson@rivosinc.com \
    --cc=andrew@sifive.com \
    --cc=binutils@sourceware.org \
    --cc=jbeulich@suse.com \
    --cc=jim.wilson.gcc@gmail.com \
    --cc=palmer@dabbelt.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).