This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Allow dollars in identifiers for ARM


On Thu, 2008-07-03 at 13:04 +0100, Andrew Haley wrote:
> 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.
> 

Hmm, historical mainly.

In the very early days of the gcc port to arm the only assembler
available was the RISC iX assembler (Acorn's Unix port).  That assembler
produced a.out objects and didn't permit $ to be used in any identifier.

Slightly more recently (eg the B-02 specification of ARM ELF) reserved
all symbols containing $ "To the ABI".  In reality that meant to ARM the
company, and specifically to the development tools team.  In practice
this was somewhat like compiler or system library implementers reserving
all symbols starting with _ or __.  It meant that libraries (and some
tools) would emit symbols containing $ as private interfaces or with
special semantics.

With the latest revision of the ABI
(http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.set.swdev/index.html) the restriction was relaxed significantly (ARM (the company) is only one member of the consortium that developed the latest specification).  While some symbols were still reserved and have special meaning, most of the namespace containing $ was opened up.  You still need to be careful if you use symbols in this space, since historical practice on the use of $ was not particularly methodical so you always run a chance of clashing with some existing use; but little more so than with any other naming scheme.  The main restriction now is that symbols starting with $ may be used by tools for various types of meta tag (eg $a, $t and $d to indicated arm, thumb and data in code sections).  Attempts by users to add symbols in that space are likely to end up with binaries that aren't future proof.

Overall, I don't really see now why the compiler should completely ban
$.  But the potential for future problems does give me some concern.  

> >> "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
> >>

This is woefully out of date now.  Does anyone know how to get it
updated?


> 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.

Can we not fix the problematic tests to explicitly do this?

R.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]