public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Nick Clifton <nickc@redhat.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>,
	Andrew Waterman <andrew@sifive.com>,
	Jim Wilson <jim.wilson.gcc@gmail.com>,
	Nelson Chu <nelson@rivosinc.com>,
	Binutils <binutils@sourceware.org>, Alan Modra <amodra@gmail.com>
Subject: Re: [PATCH RFC] RISC-V: alter the special character used in FAKE_LABEL_NAME
Date: Mon, 13 Mar 2023 13:52:05 +0100	[thread overview]
Message-ID: <0a576110-624b-6339-b24d-907d6df72e09@suse.com> (raw)
In-Reply-To: <a1e96518-35bb-d034-c487-2a06799d25ab@redhat.com>

Nick,

On 13.03.2023 13:06, Nick Clifton wrote:
>> On 10.03.2023 10:36, Jan Beulich via Binutils wrote:
>>> Considering the special casing of FAKE_LABEL_CHAR in read_symbol_name()
>>> and get_symbol_name() I wonder in how far LOCAL_LABEL_CHAR and/or
>>> DOLLAR_LABEL_CHAR don't also need recognizing there (and then also be
>>> marked in lex[] just like done here). I can't point out a specific case
>>> though where there could be a problem.
>>>
>>> The checking for *_LABEL_CHAR in S_IS_LOCAL() looks to collide with uses
>>> of these characters in quoted symbol names.
>>
>> while the rest of the open questions is RISC-V specific, these two items
>> are not, and since from the title I suppose you may not notice the generic
>> aspects here, I thought I'd point them out explicitly. Just in case you
>> have any thoughts there (if you don't, I'm not sure how to progress).
> 
> Thanks for bringing this up, and you are right, I had not noticed these
> generic questions.  My thoughts on this topic are as follows:
> 
> I think that the intention of FAKE_LABEL_CHAR is to allow backends to
> generate labels contains characters that are not normally accepted as
> part of a label's name, but which nevertheless should be treated as if
> they were real user-provided names.  The LOCAL_LABEL_CHAR and
> DOLLAR_LABEL_CHAR characters on the other hand are intended solely for
> internal assembler use and should never appear in user-generated, or
> backend-generated labels.  Hence it makes sense to check for
> FAKE_LABEL_CHAR to be checked in functions that read user labels
> (read.c:read_symbol_name(), expr.c:get_symbol_name()) and it also makes
> sense to not check for - and by implication, reject - LOCAL_LABEL_CHAR
> and DOLLAR_LABEL_CHAR.
> 
> There is a special case however.  If a backend does not define
> FAKE_LABEL_NAME (and FAKE_LABEL_CHAR) then write.h will define them
> instead and it will use the same default character as DOLLAR_LABEL_CHAR.
> I am not sure why this was done, possibly it was a mistake - it might
> have been better to use a different control character, eg '\0003' instead.
> Anyway, the header is written that way at the moment, and this is why
> there is a (not actually needed) check in S_IS_LOCAL() for DOLLAR_LABEL_
> CHAR and FAKE_LABEL_CHAR being the same.
> 
> So in conclusion, I think that unless a backend wants to use a control
> character as a fake label name character, there should be no problems.

okay, this addresses the first of the two points raised and indicates
that while things look somewhat odd, they really are okay in this regard.
I have to admit though that I don't follow why you specially mention
control character use by a backend as fake label name, not the least
since it's the default that a control character is used.

What I don't think you addressed is my 2nd observation wrt quoted symbol
names. There all characters can appear in symbol names, and hence
deriving "local" (or not) based on symbol name looks wrong to me.

Jan

  reply	other threads:[~2023-03-13 12:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-10  9:36 Jan Beulich
2023-03-10  9:40 ` Jan Beulich
2023-03-13 12:06   ` Nick Clifton
2023-03-13 12:52     ` Jan Beulich [this message]
2023-03-13 14:25       ` Nick Clifton
2023-03-13 15:57         ` Jan Beulich
2023-03-15 11:08           ` Nick Clifton
2023-03-15 15:45             ` Jan Beulich
2023-03-15 16:05 ` Palmer Dabbelt
2023-03-16 10:35   ` Jan Beulich
2023-03-30 12:01 ` Jan Beulich
2023-08-04 12:04   ` Jan Beulich

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=0a576110-624b-6339-b24d-907d6df72e09@suse.com \
    --to=jbeulich@suse.com \
    --cc=amodra@gmail.com \
    --cc=andrew@sifive.com \
    --cc=binutils@sourceware.org \
    --cc=jim.wilson.gcc@gmail.com \
    --cc=nelson@rivosinc.com \
    --cc=nickc@redhat.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).