Deleted Added
full compact
kern.mk (217033) kern.mk (218824)
1# $FreeBSD: head/sys/conf/kern.mk 217033 2011-01-05 22:24:33Z dim $
1# $FreeBSD: head/sys/conf/kern.mk 218824 2011-02-18 21:44:53Z nwhitehorn $
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.if ${CC:T:Micc} == "icc"
10#CWARNFLAGS= -w2 # use this if you are terribly bored
11CWARNFLAGS=
12.else
13CWARNFLAGS?= -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes \
14 -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual \
15 -Wundef -Wno-pointer-sign -fformat-extensions
16.endif
17#
18# The following flags are next up for working on:
19# -W
20
21#
22# On the i386, do not align the stack to 16-byte boundaries. Otherwise GCC
23# 2.95 adds code to the entry and exit point of every function to align the
24# stack to 16-byte boundaries -- thus wasting approximately 12 bytes of stack
25# per function call. While the 16-byte alignment may benefit micro benchmarks,
26# it is probably an overall loss as it makes the code bigger (less efficient
27# use of code cache tag lines) and uses more stack (less efficient use of data
28# cache tag lines). Explicitly prohibit the use of SSE and other SIMD
29# operations inside the kernel itself. These operations are exclusively
30# reserved for user applications.
31#
32.if ${MACHINE_CPUARCH} == "i386" && ${CC:T:Micc} != "icc"
33.if ${CC:T:Mclang} != "clang"
34CFLAGS+= -mno-align-long-strings -mpreferred-stack-boundary=2
35.endif
36CFLAGS+= -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -msoft-float
37INLINE_LIMIT?= 8000
38.endif
39
40.if ${MACHINE_CPUARCH} == "arm"
41INLINE_LIMIT?= 8000
42.endif
43#
44# For IA-64, we use r13 for the kernel globals pointer and we only use
45# a very small subset of float registers for integer divides.
46#
47.if ${MACHINE_CPUARCH} == "ia64"
48CFLAGS+= -ffixed-r13 -mfixed-range=f32-f127 -fpic #-mno-sdata
49INLINE_LIMIT?= 15000
50.endif
51
52#
53# For sparc64 we want medlow code model, and we tell gcc to use floating
54# point emulation. This avoids using floating point registers for integer
55# operations which it has a tendency to do.
56#
57.if ${MACHINE_CPUARCH} == "sparc64"
58CFLAGS+= -mcmodel=medany -msoft-float
59INLINE_LIMIT?= 15000
60.endif
61
62#
63# For AMD64, we explicitly prohibit the use of FPU, SSE and other SIMD
64# operations inside the kernel itself. These operations are exclusively
65# reserved for user applications.
66#
67.if ${MACHINE_CPUARCH} == "amd64"
68CFLAGS+= -mcmodel=kernel -mno-red-zone \
69 -mfpmath=387 -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 \
70 -msoft-float -fno-asynchronous-unwind-tables
71INLINE_LIMIT?= 8000
72.endif
73
74#
75# For PowerPC we tell gcc to use floating point emulation. This avoids using
76# floating point registers for integer operations which it has a tendency to do.
77# Also explicitly disable Altivec instructions inside the kernel.
78#
79.if ${MACHINE_CPUARCH} == "powerpc"
80CFLAGS+= -msoft-float -mno-altivec
81INLINE_LIMIT?= 15000
82.endif
83
84#
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.if ${CC:T:Micc} == "icc"
10#CWARNFLAGS= -w2 # use this if you are terribly bored
11CWARNFLAGS=
12.else
13CWARNFLAGS?= -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes \
14 -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual \
15 -Wundef -Wno-pointer-sign -fformat-extensions
16.endif
17#
18# The following flags are next up for working on:
19# -W
20
21#
22# On the i386, do not align the stack to 16-byte boundaries. Otherwise GCC
23# 2.95 adds code to the entry and exit point of every function to align the
24# stack to 16-byte boundaries -- thus wasting approximately 12 bytes of stack
25# per function call. While the 16-byte alignment may benefit micro benchmarks,
26# it is probably an overall loss as it makes the code bigger (less efficient
27# use of code cache tag lines) and uses more stack (less efficient use of data
28# cache tag lines). Explicitly prohibit the use of SSE and other SIMD
29# operations inside the kernel itself. These operations are exclusively
30# reserved for user applications.
31#
32.if ${MACHINE_CPUARCH} == "i386" && ${CC:T:Micc} != "icc"
33.if ${CC:T:Mclang} != "clang"
34CFLAGS+= -mno-align-long-strings -mpreferred-stack-boundary=2
35.endif
36CFLAGS+= -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -msoft-float
37INLINE_LIMIT?= 8000
38.endif
39
40.if ${MACHINE_CPUARCH} == "arm"
41INLINE_LIMIT?= 8000
42.endif
43#
44# For IA-64, we use r13 for the kernel globals pointer and we only use
45# a very small subset of float registers for integer divides.
46#
47.if ${MACHINE_CPUARCH} == "ia64"
48CFLAGS+= -ffixed-r13 -mfixed-range=f32-f127 -fpic #-mno-sdata
49INLINE_LIMIT?= 15000
50.endif
51
52#
53# For sparc64 we want medlow code model, and we tell gcc to use floating
54# point emulation. This avoids using floating point registers for integer
55# operations which it has a tendency to do.
56#
57.if ${MACHINE_CPUARCH} == "sparc64"
58CFLAGS+= -mcmodel=medany -msoft-float
59INLINE_LIMIT?= 15000
60.endif
61
62#
63# For AMD64, we explicitly prohibit the use of FPU, SSE and other SIMD
64# operations inside the kernel itself. These operations are exclusively
65# reserved for user applications.
66#
67.if ${MACHINE_CPUARCH} == "amd64"
68CFLAGS+= -mcmodel=kernel -mno-red-zone \
69 -mfpmath=387 -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 \
70 -msoft-float -fno-asynchronous-unwind-tables
71INLINE_LIMIT?= 8000
72.endif
73
74#
75# For PowerPC we tell gcc to use floating point emulation. This avoids using
76# floating point registers for integer operations which it has a tendency to do.
77# Also explicitly disable Altivec instructions inside the kernel.
78#
79.if ${MACHINE_CPUARCH} == "powerpc"
80CFLAGS+= -msoft-float -mno-altivec
81INLINE_LIMIT?= 15000
82.endif
83
84#
85# Use dot symbols on powerpc64 to make ddb happy
86#
87.if ${MACHINE_ARCH} == "powerpc64"
88CFLAGS+= -mcall-aixdesc
89.endif
90
91#
85# For MIPS we also tell gcc to use floating point emulation
86#
87.if ${MACHINE_CPUARCH} == "mips"
88CFLAGS+= -msoft-float
89INLINE_LIMIT?= 8000
90.endif
91
92#
93# GCC 3.0 and above like to do certain optimizations based on the
94# assumption that the program is linked against libc. Stop this.
95#
96.if ${CC:T:Micc} == "icc"
97CFLAGS+= -nolib_inline
98.else
99CFLAGS+= -ffreestanding
100.endif
101
102.if ${CC:T:Micc} == "icc"
103CFLAGS+= -restrict
104.endif
105
106#
107# GCC SSP support.
108#
109.if ${MK_SSP} != "no" && ${CC:T:Micc} != "icc" && \
110 ${MACHINE_CPUARCH} != "ia64" && ${MACHINE_CPUARCH} != "arm" && \
111 ${MACHINE_CPUARCH} != "mips"
112CFLAGS+= -fstack-protector
113.endif
114
115#
116# Enable CTF conversation on request.
117#
118.if defined(WITH_CTF)
119.undef NO_CTF
120.endif
121
92# For MIPS we also tell gcc to use floating point emulation
93#
94.if ${MACHINE_CPUARCH} == "mips"
95CFLAGS+= -msoft-float
96INLINE_LIMIT?= 8000
97.endif
98
99#
100# GCC 3.0 and above like to do certain optimizations based on the
101# assumption that the program is linked against libc. Stop this.
102#
103.if ${CC:T:Micc} == "icc"
104CFLAGS+= -nolib_inline
105.else
106CFLAGS+= -ffreestanding
107.endif
108
109.if ${CC:T:Micc} == "icc"
110CFLAGS+= -restrict
111.endif
112
113#
114# GCC SSP support.
115#
116.if ${MK_SSP} != "no" && ${CC:T:Micc} != "icc" && \
117 ${MACHINE_CPUARCH} != "ia64" && ${MACHINE_CPUARCH} != "arm" && \
118 ${MACHINE_CPUARCH} != "mips"
119CFLAGS+= -fstack-protector
120.endif
121
122#
123# Enable CTF conversation on request.
124#
125.if defined(WITH_CTF)
126.undef NO_CTF
127.endif
128