xref: /freebsd/sys/conf/kern.mk (revision 3ff369fed2a08f32dda232c10470b949bef9489f)
1# $FreeBSD$
2
3#
4# Warning flags for compiling the kernel and components of the kernel.
5#
6# Note that the newly added -Wcast-qual is responsible for generating
7# most of the remaining warnings.  Warnings introduced with -Wall will
8# also pop up, but are easier to fix.
9#
10# XXX FIXME - revert to -fformat-extensions when we've re-added it
11CWARNFLAGS?=	-Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes \
12		-Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual \
13		-Wno-format -ansi
14#
15# The following flags are next up for working on:
16#	-W
17#
18# When working on removing warnings from code, the `-Werror' flag should be
19# of material assistance.
20#
21
22#
23# On the i386, do not align the stack to 16-byte boundaries.  Otherwise GCC
24# 2.95 adds code to the entry and exit point of every function to align the
25# stack to 16-byte boundaries -- thus wasting approximately 12 bytes of stack
26# per function call.  While the 16-byte alignment may benefit micro benchmarks,
27# it is probably an overall loss as it makes the code bigger (less efficient
28# use of code cache tag lines) and uses more stack (less efficient use of data
29# cache tag lines)
30#
31.if ${MACHINE_ARCH} == "i386"
32CFLAGS+=	-mpreferred-stack-boundary=2
33.endif
34
35#
36# On the alpha, make sure that we don't use floating-point registers and
37# allow the use of EV56 instructions (only needed for low-level i/o).
38# Also, reserve register t7 to point at per-cpu global variables.
39#
40.if ${MACHINE_ARCH} == "alpha"
41CFLAGS+=	-mno-fp-regs -ffixed-8 -Wa,-mev56
42.endif
43
44#
45# For IA-64, we use r13 for the kernel globals pointer and we only use
46# a very small subset of float registers for integer divides.
47#
48.if ${MACHINE_ARCH} == "ia64"
49CFLAGS+=	-ffixed-r13 -mfixed-range=f32-f127
50.endif
51
52#
53# GCC 3.0 and above like to do certain optimizations based on the
54# assumption that the program is linked against libc.  Stop this.
55#
56CFLAGS+=	-ffreestanding
57