This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
Re: Leading character for BINARY format ?
- To: nickc at cygnus dot com
- Subject: Re: Leading character for BINARY format ?
- From: Ian Lance Taylor <ian at zembu dot com>
- Date: 17 Apr 2000 12:30:10 -0700
- CC: binutils at sourceware dot cygnus dot com
- References: <200004171908.MAA08834@elmo.cygnus.com>
Date: Mon, 17 Apr 2000 12:08:36 -0700
From: Nick Clifton <nickc@cygnus.com>
: The problem is that BFD generates these symbols with a leading
: underscore, but in the BFD target vector it sets the
: 'symbol_leading_char' field to 0. This seems to me to be incorrect.
: I think that it should be set to '_'.
:
: No. If we set symbol_leading_char to '_', then logically the symbols
: are named without a leading underscore. symbol_leading_char is a
: symbol which is added to the start of the symbol as seen from C. So
: if symbol_leading_char is '_', then the symbols as seen from C
: logically have no underscore. But I think the symbols logically
: should have a leading underscore, since they are system generated and
: therefore should not conflict with user symbols.
Except of course that in this case there are no user symbols. Well
not from the binary format file anyway.
True.
BTW - I am a little confused on name space rules here. I thought
that a single underscore prefix was allowed in the user domain, but
that a double underscore prefix was not. ie:
int a; // legal C
int _a; // legal C
int __a;// illegal C - it might conflict with a symbol in the system name space
I don't have my copy of the C standard with me. My recollection is
that external names beginning with a single underscore are reserved
for the system. However, the user is permitted to use certain
internal names beginning with a single underscore (e.g., a
preprocessor define). Names with a single underscore followed by a
capital letter or another underscore are reserved for all uses.
This basically affects what may appear in a system header file: a
system header file must not use a name beginning with a single
underscore followed by a lowercase letter, because the user may have
#defined the name.
Note of this is directly related to legal or illegal C, depending upon
what you mean by that. You are permitted to write
int __a;
The results are undefined. It's not a syntax error.
Ian