From: Jan Beulich <jbeulich@suse.com>
To: Alan Modra <amodra@gmail.com>, Michael Matz <matz@suse.de>
Cc: binutils@sourceware.org
Subject: Re: [PATCH] Let '^' through the lexer
Date: Thu, 13 Jul 2023 09:54:46 +0200 [thread overview]
Message-ID: <19b0a86d-1c18-3f3d-3763-74c6ab08c676@suse.com> (raw)
In-Reply-To: <ZK8xIvI+cKyCY/z6@squeak.grove.modra.org>
On 13.07.2023 01:02, Alan Modra via Binutils wrote:
> On Wed, Jul 12, 2023 at 01:56:54PM +0000, Michael Matz via Binutils wrote:
>> so that the (existing) code in parser and expression evaluator
>> actually get to see it and handle it as XOR.
>> ---
>>
>> A colleague was asking me about why XOR is missing from linker scripts and
>> I initially wanted to say "but it is supported, only undocumented",
>> because I distinctly remembered the code handling XOR in the expression
>> parser and evaluator. But ... he was right. The lexer unhelpfully
>> doesn't let '^' through and just spits out a "unrecognized character"
>> error.
>>
>> This is the case since the dawn of time it seems (ldgram end ldexp
>> handling it, but ldlex not), but I don't see a reason. While '^'
>> might also be a meta-character in other lexer modes, that's no different
>> from, say, '?' and '*'. So, let's just handle it as well, document it,
>> and leave it be :-)
>>
>> (I have looked around for a testcase that systematically tests the
>> expression syntax in linker scripts. I can't find one, so I haven't added
>> a case for this one either).
>>
>> This is regtested on x86-64-linux only, my test-everything setup is
>> missing right now. Assuming that that works as well, okay for master?
>
> OK, but..
>
>> --- a/ld/ld.texi
>> +++ b/ld/ld.texi
>> @@ -6826,11 +6826,12 @@ precedence associativity Operators Notes
>> 4 left >> <<
>> 5 left == != > < <= >=
>
> Since you're adjusting this table, can you fix the precedence above?
> == and != are lower precedence than the other relational operators.
>
>> 6 left &
>> -7 left |
>> -8 left &&
>> -9 left ||
>> -10 right ? :
>> -11 right &= += -= *= /= (2)
>> +7 left ^
>> +8 left |
>> +9 left &&
>> +10 left ||
>> +11 right ? :
>> +12 right &= += -= *= /= (2)
>
> This line misses some assignment operators supported by ldgram.y.
> It should be += -= *= /= <<= >>= &= |=
At which point, considering the subject of the patch, I'm inclined
to ask: What about ^=?
Jan
next prev parent reply other threads:[~2023-07-13 7:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-12 13:56 Michael Matz
2023-07-12 23:02 ` Alan Modra
2023-07-13 7:54 ` Jan Beulich [this message]
2023-07-13 10:20 ` Alan Modra
2023-07-13 16:02 ` Michael Matz
2023-07-14 3:32 ` Alan Modra
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=19b0a86d-1c18-3f3d-3763-74c6ab08c676@suse.com \
--to=jbeulich@suse.com \
--cc=amodra@gmail.com \
--cc=binutils@sourceware.org \
--cc=matz@suse.de \
/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).