1999-08-28 00:22:10 +00:00
|
|
|
# $FreeBSD$
|
1996-10-08 22:10:49 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Warning flags for compiling the kernel and components of the kernel.
|
|
|
|
#
|
2001-07-22 00:12:23 +00:00
|
|
|
# Note that the newly added -Wcast-qual is responsible for generating
|
|
|
|
# most of the remaining warnings. Warnings introduced with -Wall will
|
|
|
|
# also pop up, but are easier to fix.
|
2001-09-10 06:23:33 +00:00
|
|
|
CWARNFLAGS?= -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes \
|
|
|
|
-Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual \
|
2003-05-03 18:05:56 +00:00
|
|
|
-fformat-extensions -std=c99
|
1999-01-29 10:57:18 +00:00
|
|
|
#
|
|
|
|
# The following flags are next up for working on:
|
|
|
|
# -W
|
1999-01-27 22:53:58 +00:00
|
|
|
|
1999-11-17 07:30:35 +00:00
|
|
|
#
|
|
|
|
# On the i386, do not align the stack to 16-byte boundaries. Otherwise GCC
|
|
|
|
# 2.95 adds code to the entry and exit point of every function to align the
|
|
|
|
# stack to 16-byte boundaries -- thus wasting approximately 12 bytes of stack
|
|
|
|
# per function call. While the 16-byte alignment may benefit micro benchmarks,
|
2000-04-24 08:50:15 +00:00
|
|
|
# it is probably an overall loss as it makes the code bigger (less efficient
|
1999-11-17 07:30:35 +00:00
|
|
|
# use of code cache tag lines) and uses more stack (less efficient use of data
|
|
|
|
# cache tag lines)
|
|
|
|
#
|
|
|
|
.if ${MACHINE_ARCH} == "i386"
|
2002-10-04 12:54:36 +00:00
|
|
|
CFLAGS+= -mno-align-long-strings -mpreferred-stack-boundary=2
|
1999-11-17 07:30:35 +00:00
|
|
|
.endif
|
|
|
|
|
1998-12-17 22:36:21 +00:00
|
|
|
#
|
|
|
|
# On the alpha, make sure that we don't use floating-point registers and
|
2002-09-06 07:27:41 +00:00
|
|
|
# allow the use of BWX etc instructions (only needed for low-level i/o).
|
2000-04-28 08:44:42 +00:00
|
|
|
# Also, reserve register t7 to point at per-cpu global variables.
|
1998-12-17 22:36:21 +00:00
|
|
|
#
|
|
|
|
.if ${MACHINE_ARCH} == "alpha"
|
2002-09-06 07:27:41 +00:00
|
|
|
CFLAGS+= -mno-fp-regs -ffixed-8 -Wa,-mev6
|
1998-12-17 22:36:21 +00:00
|
|
|
.endif
|
2000-10-16 20:04:52 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# For IA-64, we use r13 for the kernel globals pointer and we only use
|
|
|
|
# a very small subset of float registers for integer divides.
|
|
|
|
#
|
|
|
|
.if ${MACHINE_ARCH} == "ia64"
|
2002-10-13 02:52:22 +00:00
|
|
|
CFLAGS+= -ffixed-r13 -mfixed-range=f32-f127 -mno-sdata
|
2000-10-16 20:04:52 +00:00
|
|
|
.endif
|
2001-09-10 06:23:33 +00:00
|
|
|
|
2003-02-28 06:49:59 +00:00
|
|
|
#
|
|
|
|
# For sparc64 we want medlow code model, and we tell gcc to use floating
|
|
|
|
# point emulation. This avoids using floating point registers for integer
|
|
|
|
# operations which it has a tendency to do.
|
|
|
|
#
|
|
|
|
.if ${MACHINE_ARCH} == "sparc64"
|
|
|
|
CFLAGS+= -mcmodel=medlow -msoft-float
|
|
|
|
.endif
|
|
|
|
|
2003-04-30 22:22:29 +00:00
|
|
|
#
|
|
|
|
# For AMD64, use a medium model for now. We'll switch to "kernel"
|
|
|
|
# once pmap is ready. Be excessively careful to not generate FPU code.
|
|
|
|
#
|
|
|
|
.if ${MACHINE_ARCH} == "amd64"
|
2003-05-23 05:04:54 +00:00
|
|
|
CFLAGS+= -mcmodel=kernel -mno-red-zone \
|
2003-05-30 01:06:58 +00:00
|
|
|
-mfpmath=387 -mno-sse -mno-sse2 -mno-mmx -mno-3dnow \
|
|
|
|
-msoft-float -fno-asynchronous-unwind-tables
|
2003-04-30 22:22:29 +00:00
|
|
|
.endif
|
|
|
|
|
2001-09-10 06:23:33 +00:00
|
|
|
#
|
|
|
|
# GCC 3.0 and above like to do certain optimizations based on the
|
|
|
|
# assumption that the program is linked against libc. Stop this.
|
|
|
|
#
|
|
|
|
CFLAGS+= -ffreestanding
|