This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Allow dollars in identifiers for ARM
Joseph S. Myers wrote:
> On Thu, 3 Jul 2008, Andrew Haley wrote:
>
>> Joseph S. Myers wrote:
>>> config/arm/aout.h (used by many ARM targets, despite its name)
>>> disallows dollars in identifiers, with a comment "Arm Assembler barfs
>>> on dollars". I don't know what assembler this refers to, but it's not
>>> a true statement about the current GNU assembler and it's not clear
>>> there are any ARM targets supporting any non-GNU assemblers now.
>> That's not the reason. The real reason is that the ARM EABI specifically
>> disallows it:
>
> The definition dates back to revision 10679, the addition of arm/aout.h
> dated 1995-12-06. I think that long predates the EABI.
Sure, but AFAIAA the EABI codified pre-existing practice. I can't
imagine any other reason they'd have this restriction. Maybe Richard
Earnshaw can advise as to why this restriction is present.
>> "4.4.4 Symbol names
>>
>> "All symbol names containing a dollar character ('$') are reserved
>> to the ARM EABI."
>>
>> http://refspecs.freestandards.org/elf/ARMELF.pdf
>>
>> I don't think we should change this unilaterally.
>
> Being reserved at the ELF level is a separate matter from being disallowed
> at the language level. It's not the business of ABIs to disallow
> particular language extensions, any more than it is to specify whether
> bit-fields are signed or unsigned (a case specifically called out in the
> GCC manual).
Sure, but do you have any idea how we can allow dollars in identifiers
without them leaking into ELF symbols? I suppose you could argue that
the proper separation of concerns means that the ABI details shouldn't
leak into the source language specification, but given the 1:1 mapping
of C names to ELF symbols that's a real stretch.
> In any case, the more recent copy of AAELF I have to hand
> (version 1.04 dated 2007-01-25) has a more restricted list of reservations
> in section 4.5.4.1, not all symbols containing $.
Okay. Does this, then, allow '$' in ELF symbols? Is so, this
discussion is moot.
> I don't believe we
> should disallow users from using those symbols any more than we disallow
> __aeabi (also reserved); it's simply up to the user to know what they are
> doing when they use reserved names (whether as part of the implementation
> of reserved names with semantics specified in the standard or otherwise).
But the point is that we *don't* disallow them: we only require users to
request this with -fallow-dollars-in-identifiers. The point here is that
people aren't creating non-compliant ELF binaries without being told.
Andrew.