[llvm-dev] Handling of section vs global name conflicts
Rafael EspĂndola via llvm-dev
llvm-dev at lists.llvm.org
Mon Mar 21 12:29:55 PDT 2016
On 21 March 2016 at 15:07, Evgenii Stepanov <eugenis at google.com> wrote:
> So, we emit both a global symbol for the global variable, and a local
> symbol for the section, with the same name?
We could. That is what I was expecting gas to do, but I see that both
gas and mc produce errors.
Handling this without MC is really hard. The name (in IR at least) can
conflict with implicit sections:
@".data" = global i32 42
One somewhat ugly option is to just produce a cleaner error when MC
finds the problem. With gcc one gets an error from gas.
> This would need to be fixed both in the integrated assembler and in GAS.
> Is it even allowed? What would the symbol references bind to, when
> both symbols are defined?
It is allowed, you can have as many symbols with the same name as you want.
As for the assembly file, I would say that the section symbol should
have a lower priority. It is always possible to refer to a section by
putting a .Lfoo at the start of the section and referring to that.
Cheers,
Rafael
More information about the llvm-dev
mailing list