[PATCH RFC] RISC-V: alter the special character used in FAKE_LABEL_NAME
Jan Beulich
jbeulich@suse.com
Wed Mar 15 15:45:37 GMT 2023
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
More information about the Binutils
mailing list