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