xref: /dragonfly/sys/conf/bsd.kern.mk (revision fe76c4fb)
1# $FreeBSD: src/share/mk/bsd.kern.mk,v 1.17.2.1 2001/08/01 16:56:56 obrien Exp $
2# $DragonFly: src/sys/conf/bsd.kern.mk,v 1.7 2006/03/24 18:35:28 dillon Exp $
3
4#
5# Warning flags for compiling the kernel and components of the kernel.
6#
7# Note that the newly added -Wcast-qual is responsible for generating
8# most of the remaining warnings.  Warnings introduced with -Wall will
9# also pop up, but are easier to fix.
10#
11.if ${CCVER} == "gcc2"
12CWARNFLAGS?=	-Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes \
13		-Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual \
14		-fformat-extensions -ansi
15.else
16CWARNFLAGS?=	-Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes \
17		-Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual \
18		-ansi
19.endif
20#
21# The following flags are next up for working on:
22#	-W
23#
24# When working on removing warnings from code, the `-Werror' flag should be
25# of material assistance.
26#
27
28#
29# On the i386, do not align the stack to 16-byte boundaries.  Otherwise GCC
30# 2.95 adds code to the entry and exit point of every function to align the
31# stack to 16-byte boundaries -- thus wasting approximately 12 bytes of stack
32# per function call.  While the 16-byte alignment may benefit micro benchmarks,
33# it is probably an overall loss as it makes the code bigger (less efficient
34# use of code cache tag lines) and uses more stack (less efficient use of data
35# cache tag lines)
36#
37# Prohibit the use of FP registers in the kernel.  The user FP state is
38# only saved and restored under strictly managed conditions and mainline
39# kernel code cannot safely use the FP system.
40#
41.if ${MACHINE_ARCH} == "i386"
42CFLAGS+=	-mpreferred-stack-boundary=2
43CFLAGS+=	-fno-stack-protector
44CFLAGS+=	-mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3
45.endif
46
47#
48# On the alpha, make sure that we don't use floating-point registers and
49# allow the use of EV56 instructions (only needed for low-level i/o).
50#
51.if ${MACHINE_ARCH} == "alpha"
52CFLAGS+=	-mno-fp-regs -Wa,-mev56
53.endif
54
55# Require the proper use of 'extern' for variables.  -fno-common will
56# cause duplicate declarations to generate a link error.
57#
58CFLAGS+=	-fno-common
59
60# Prevent GCC 3.x from making certain libc based inline optimizations
61#
62CFLAGS+=	-ffreestanding
63