On Mon, 10 Jun 2002, Julian Elischer wrote:

> the HIDENAME() macro was changed to work with Gcc3.1 (the new compiler)
> but broke it for the old compiler/assembler.

Ugh.  I was surprised that this change worked for any gcc.  The change is

        #define HIDENAME(asmsym)        __CONCAT(.,asmsym)


        #define HIDENAME(asmsym)        .asmsym

Note that the change isn't for use of CONCAT with "," and "word" lke
its commit message says.  It is for use of __CONCAT with "." and "word".
Here the quotes are to mark up identifiers -- there are no strings
involved.  The problem is that the ISO C concatenation operator "##"
is less useful than might first appear.  It is only required to work
if the result could be a preprocessing token, and the rules for when
the result could be a preprocessing token are quite complicated.  E.g.,
".foo" is not a preprocessing token but ".1" is.  The result of
concatenating "." with "foo" is undefined, and gcc now detects this

Since ".foo" is lexed as separate tokens, there is no need for the
preprocessor to keep the "." and the "foo" separate.  In practice,
previous versions of the preprocessor inserted a space between the
tokens and the current version doesn't.  The current HIDENAME() macro
depends on this implementation detail in the current preprocessor and
is just broken in general.

> back out the definition in i386/include/asmacros.h to what it was before
> (it used to use the CONCAT() macro)
> OR
> bite the bullet and upgrade to a new -current and get the new compiler.

OR for a quick fix, fixing one of the following related bogons:

(1) For non-profiling kernels, HIDENAME is only used for the tmpstk
    variable in locore.s, but there is no need for this variable to be
    hidden.  Hiding it mainly broke examining it using ddb before ddb
    was fixed to recognize symbols with a "." in their name.
(2) For non-profiling kernels, HIDENAME is only used for the tmpstk
    variable in locore.s, but the old macro still works for cpp'ing
    assembler sources.  This is why committing gcc-3 didn't break
    building of all kernels.

Fixing the following related bogon would have no significant affect:

(3) HIDENAME still has its old definition in at least the i386
    <machine/asm.h>.  This is harmless at least on i386's because that
    definition is not actually used.

This leaves the problem of fixing the use of HIDENAME in profiling kernels.
Unfortunately, the standard name for "mcount" requires a "." in it for
the ELF case (the ELF case is more broken than the aout case here).  This
problem is avoided for userland profiling using a magic asm in
<machine/profile.h>.  The i386 prof_machdep.c uses HIDENAME to get slightly
less magic asm.


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to