Article View: gnu.gcc.bug
Article #6026Bug with Pre-Processor
From: Stefan Althoefer
Date: Mon, 06 Jan 1997 00:00
Date: Mon, 06 Jan 1997 00:00
106 lines
3249 bytes
3249 bytes
GCC-VERSION: 2.7.2
HOST: Linux-i386 (1.2.12)
TARGET: i386-unknown-coff
CONFIGURED-AS-FOLLOWS:
${SRCDIR}/gcc-2.7.2/configure --prefix=/usr/local \
--target=i386-unknown-coff --host=i486-unknonw-linux \
--nfp --with-gnu-as --with-gnu-ld \
--program-suffix=386
PATCHES-APPLIED-TO-THE-ORIGINAL-SOURCE:
The crossgcc-patch from cygnus.
The patch is available in ftp.cygnus.com:/pub/embedded/crossgcc.
PROBLEM:
Preprocessor does not define the __*_PREFIX__ macros correctly.
SAMPLE:
-%<- x.c -------------
>__USER_LABEL_PREFIX__<
>__REGISTER_PREFIX__<
>__IMMEDIATE_PREFIX__<
-%<-------------------
produces this result when compiled with `gcc386 -E x.c >x.i':
-%<- x.i -------------
# 1 "x.c"
><
><
><
-%<-------------------
The correct result should be:
-%<- x.i -------------
# 1 "x.c"
> <
> %<
> $<
-%<-------------------
MY FIX FOR THIS:
I added the following lines to `config/i386/i386-coff.h'
-%<- x.i -------------
*** i386-coff.h~ Thu Jun 15 15:45:51 1995
--- i386-coff.h Wed Jan 1 16:19:07 1997
***************
*** 31,36 ****
--- 31,67 ----
#undef DBX_DEBUGGING_INFO
#define SDB_DEBUGGING_INFO
+
+ /* COFF symbols don't start with an underscore. */
+
+ #undef USER_LABEL_PREFIX
+ #define USER_LABEL_PREFIX ""
+
+ /* Use a prefix for local labels, just to be on the save side. */
+
+ #undef LOCAL_LABEL_PREFIX
+ #define LOCAL_LABEL_PREFIX "."
+
+ /* Use a register prefix to avoid clashes with external symbols (classic
+ example: `extern char PC;' in termcap). */
+
+ #undef REGISTER_PREFIX
+ #define REGISTER_PREFIX "%"
+
+ /* Immediates start with a $ sign. At least for gas. */
+
+ #undef IMMEDIATE_PREFIX
+ #define IMMEDIATE_PREFIX "$"
+
+
+ /* In the machine description we can't use %R, because it will not be seen
+ by ASM_FPRINTF. (Isn't that a design bug?). */
+
+ #undef REGISTER_PREFIX_MD
+ #define REGISTER_PREFIX_MD "%%"
+
+
+
/* Support the ctors and dtors sections for g++. */
#define CTORS_SECTION_ASM_OP ".section\t.ctors,\"x\""
-%<-------------------
Though, I'm not sure wether there are other side-effects from this
solution, and it will not cure the other i386 targets (at least my
native Linux compiler has the same problem, and does not use coff).
Stefan Althoefer
------------------------------------------------------------------
JANZ Computer AG voice: +49 5251 1550-13 'Black holes are
Im Doerener Feld 8 fax: +49 5251 1550-90 where God is
D-33100 Paderborn e-mail: as@janzag.de dividing by zero'
------------------------------------------------------------------
Technical Details
Message-ID:
<194AB7313BD@pmail.janzag.de>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 113d02,3c72330fb9ca35f1,start X-Google-Attributes: gid113d02,public From: "Stefan Althoefer" <AS@pmail.janzag.de> Subject: Bug with Pre-Processor Date: 1997/01/06 Message-ID: <194AB7313BD@pmail.janzag.de> X-Deja-AN: 208014610 sender: bug-gcc-request@prep.ai.mit.edu priority: normal x-gateway: relay4.UU.NET from bug-gcc to gnu.gcc.bug; Mon, 6 Jan 1997 02:46:53 EST newsgroups: gnu.gcc.bug x-mailer: Pegasus Mail/Windows (v1.22)