Subject: New CPUFLAGS Makefile variable
To: None <tech-toolchain@netbsd.org>
From: Jason Thorpe <thorpej@wasabisystems.com>
List: tech-toolchain
Date: 05/24/2003 15:50:54
--Apple-Mail-3-347527220
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
format=flowed
Folks...
This is a problem that has come up before...
Basically, passing CPU options to the compiler/assembler is sort of
broken in both kernel and userland builds.
For example, for XScale platforms, I need to do the following for the
kernel:
makeoptions COPTS="-O2 -mcpu=xscale"
to get XScale codegen from GCC. However, this does not pass
"-mcpu=xscale" when building .S files, which means that the __XSCALE__
preprocessor symbol will not be defined when preprocessing the .S file,
which means that .S files conditionally tuned for XScale won't be built
correctly.
To address this, I've added a CPUFLAGS variable so that I can do this
instead:
makeoptions CPUFLAGS="-mcpu=xscale"
...which is then added to both CFLAGS and AFLAGS (and propagated to
sub-makes for e.g. libkern).
Any comments? I'd like to make a similar change for userland builds.
-- Jason R. Thorpe <thorpej@wasabisystems.com>
--Apple-Mail-3-347527220
Content-Disposition: attachment;
filename=cpuflags-patch
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
x-unix-mode=0644;
name="cpuflags-patch"
Index: conf/Makefile.kern.inc
===================================================================
RCS file: /cvsroot/src/sys/conf/Makefile.kern.inc,v
retrieving revision 1.33
diff -c -r1.33 Makefile.kern.inc
*** conf/Makefile.kern.inc 2003/03/07 01:26:12 1.33
--- conf/Makefile.kern.inc 2003/05/24 22:07:54
***************
*** 59,66 ****
# XXX always get it right. --thorpej
CWARNFLAGS+= -Wno-uninitialized
.endif
! CFLAGS+= -ffreestanding ${DEBUG} ${COPTS} ${CWARNFLAGS}
! AFLAGS+= -D_LOCORE
# Define a set of xxx_G variables that will add -g to just those
# files that match the shell patterns given in ${DEBUGLIST}
--- 59,66 ----
# XXX always get it right. --thorpej
CWARNFLAGS+= -Wno-uninitialized
.endif
! CFLAGS+= ${CPUFLAGS} -ffreestanding ${DEBUG} ${COPTS} ${CWARNFLAGS}
! AFLAGS+= ${CPUFLAGS} -D_LOCORE
# Define a set of xxx_G variables that will add -g to just those
# files that match the shell patterns given in ${DEBUGLIST}
--Apple-Mail-3-347527220--