From owner-freebsd-current Mon Jun 10 22:38:50 2002 Delivered-To: freebsd-current@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id 3199137B409; Mon, 10 Jun 2002 22:38:41 -0700 (PDT) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id PAA14312; Tue, 11 Jun 2002 15:38:18 +1000 Date: Tue, 11 Jun 2002 15:39:06 +1000 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Julian Elischer Cc: Troy , , Subject: Re: Kernel breakage in XE module In-Reply-To: Message-ID: <20020611145357.F3970-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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 . 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 . 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