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: Wed, 15 Mar 2023 16:45:37 +0100	[thread overview]
Message-ID: <3f3d43be-531a-9ebb-b387-a57519df7770@suse.com> (raw)
In-Reply-To: <ac073129-0d65-29c5-a82c-dc5839335551@redhat.com>

On 15.03.2023 12:08, Nick Clifton wrote:
>> I wonder therefore whether S_IS_LOCAL() and S_IS_EXTERNAL() can't be made
>> true opposites of one another (with perhaps one of the two simply expanding
>> to a call to the other, inverting the result).
> 
> I think that they are actually testing different things.  The way I see it,
> S_IS_LOCAL() should return true for any symbol that is not intended to be
> seen by anyone disassembling the code.  (Unless of course a command line
> has been used to change this behaviour).  So for example labels like .L1
> or ^B1.   This does not however mean the same thing as ELF's STB_LOCAL
> binding.  Local ELF symbols can be found in disassemblies, should be present
> in symbol tables, and represent something intelligible to the user, rather
> than something invented by the assembler.
> 
> S_IS_EXTERNAL() on the other hand is meant to return true for symbols which
> are not only exposed to the disassembler, but which also have visibility
> outside of the file which is currently being assembled.  ie in ELF terms
> symbols which have a binding other than STB_LOCAL.

Oh, I was mislead by the name of the function (would perhaps better be
something like S_IS_INTERNAL()). And I should have looked at the doc of
course ...

So one thing to do would be to, as you did suggest earlier, actually
honor BSF_GLOBAL. Another difference is the treatment of reg_section
symbols - should S_IS_EXTERNAL() perhaps return "false" for those,
ignoring BSF_GLOBAL? It would look to me as if there shouldn't be any
symbol for which both functions can return true (which could be
achieved by having S_IS_EXTERNAL() first call S_IS_LOCAL() and return
"false" if that one returned "true").

Honoring BSF_GLOBAL won't be enough to deal with the quoted symbols
aspect, though. I guess we will need a new flag then which identifies
symbols the user created (and certain equivalents); this might even
be limited to symbols whose names were quoted at the point of creation
(at which point "certain equivalents" would not be relevant as long as
internally created "real" symbols don't contain any special characters,
which I think is the case), as all we need is something to bypass the
looking at their names.

Jan

  reply	other threads:[~2023-03-15 15:45 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
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 [this message]
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=3f3d43be-531a-9ebb-b387-a57519df7770@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).