Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Jan 1996 17:58:40 +1100
From:      Bruce Evans <bde@zeta.org.au>
To:        freebsd-current@FreeBSD.org, jdp@polstra.com
Subject:   Re: src/lib/libc/sys/Makefile.inc: proposed change
Message-ID:  <199601180658.RAA32330@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>don't have the precise details handy, but an assembly died on a
>statement something like this:

>	movl	$FOO,%eax

>where "FOO" was one of the new macros I defined.

>The problem was that, by default, "cpp" considers `$' to be a valid
>character in an identifier.  So it was interpreting `$FOO' as an
>identifier, rather than as two separate tokens.  This is never correct
>in i386 assembly language, since `$' is an operator that means
>"interpret as a literal".

This only happens if the wrong cpp is invoked.  /usr/bin/cpp is
essentially `/usr/libexec/cpp -traditional' ...

>So I want to modify "Makefile.inc" in that directory so that cpp is
>invoked with the "-$" option, which makes `$' _not_ a valid identifier
>character.  (Yes, I know I have to double the dollar sign in the

... and -traditional implies `-$' except in a couple of old versions of
cpp.

We should actually be compiling *.S with `gcc -c' instead of with
`cpp | as' which allows errors to leak out of the pipe.  Then gcc would
invokes cpp with the following flags:

	-lang-asm -undef -$ -Dunix -Di386 -D__FreeBSD__=2 -D__unix__
	-D__i386__ -D__FreeBSD__=2 -D__unix -D__i386
	-Asystem(unix) -Asystem(FreeBSD) -Acpu(i386) -Amachine(i386)
	-D__ASSEMBLER__

Note that `-$' is there, (and a few others :-).  Most of our assembler
sources also need -traditional.

Bruce



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