Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Jun 2002 15:39:06 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Julian Elischer <julian@elischer.org>
Cc:        Troy <sindrome@sindrome.net>, <freebsd-current@FreeBSD.ORG>, <alfred@FreeBSD.ORG>
Subject:   Re: Kernel breakage in XE module
Message-ID:  <20020611145357.F3970-100000@gamplex.bde.org>
In-Reply-To: <Pine.BSF.4.21.0206101105050.79682-100000@InterJet.elischer.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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
from:

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

to:

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

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.

Bruce


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020611145357.F3970-100000>