]> CyberLeo.Net >> Repos - FreeBSD/stable/9.git/blob - sys/conf/kern.mk
MFC r228781:
[FreeBSD/stable/9.git] / sys / conf / kern.mk
1 # $FreeBSD$
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 # Disable a few warnings for clang, since there are several places in the
15 # kernel where fixing them is more trouble than it is worth, or where there is
16 # a false positive.
17 .if ${CC:T:Mclang} == "clang"
18 NO_WCONSTANT_CONVERSION=        -Wno-constant-conversion
19 NO_WARRAY_BOUNDS=               -Wno-array-bounds
20 .endif
21
22 #
23 # On i386, do not align the stack to 16-byte boundaries.  Otherwise GCC 2.95
24 # and above 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).  Explicitly prohibit the use of FPU, SSE and other SIMD
30 # operations inside the kernel itself.  These operations are exclusively
31 # reserved for user applications.
32 #
33 # gcc:
34 # Setting -mno-mmx implies -mno-3dnow
35 # Setting -mno-sse implies -mno-sse2, -mno-sse3 and -mno-ssse3
36 #
37 # clang:
38 # Setting -mno-mmx implies -mno-3dnow, -mno-3dnowa, -mno-sse, -mno-sse2,
39 #                          -mno-sse3, -mno-ssse3, -mno-sse41 and -mno-sse42
40 #
41 .if ${MACHINE_CPUARCH} == "i386"
42 .if ${CC:T:Mclang} != "clang"
43 CFLAGS+=        -mno-align-long-strings -mpreferred-stack-boundary=2 -mno-sse
44 .else
45 CFLAGS+=        -mno-aes -mno-avx
46 .endif
47 CFLAGS+=        -mno-mmx -msoft-float
48 INLINE_LIMIT?=  8000
49 .endif
50
51 .if ${MACHINE_CPUARCH} == "arm"
52 INLINE_LIMIT?=  8000
53 .endif
54
55 #
56 # For IA-64, we use r13 for the kernel globals pointer and we only use
57 # a very small subset of float registers for integer divides.
58 #
59 .if ${MACHINE_CPUARCH} == "ia64"
60 CFLAGS+=        -ffixed-r13 -mfixed-range=f32-f127 -fpic #-mno-sdata
61 INLINE_LIMIT?=  15000
62 .endif
63
64 #
65 # For sparc64 we want medlow code model, and we tell gcc to use floating
66 # point emulation.  This avoids using floating point registers for integer
67 # operations which it has a tendency to do.
68 #
69 .if ${MACHINE_CPUARCH} == "sparc64"
70 CFLAGS+=        -mcmodel=medany -msoft-float
71 INLINE_LIMIT?=  15000
72 .endif
73
74 #
75 # For AMD64, we explicitly prohibit the use of FPU, SSE and other SIMD
76 # operations inside the kernel itself.  These operations are exclusively
77 # reserved for user applications.
78 #
79 # gcc:
80 # Setting -mno-mmx implies -mno-3dnow
81 # Setting -mno-sse implies -mno-sse2, -mno-sse3, -mno-ssse3 and -mfpmath=387
82 #
83 # clang:
84 # Setting -mno-mmx implies -mno-3dnow, -mno-3dnowa, -mno-sse, -mno-sse2,
85 #                          -mno-sse3, -mno-ssse3, -mno-sse41 and -mno-sse42
86 # (-mfpmath= is not supported)
87 #
88 .if ${MACHINE_CPUARCH} == "amd64"
89 .if ${CC:T:Mclang} != "clang"
90 CFLAGS+=        -mno-sse
91 .else
92 CFLAGS+=        -mno-aes -mno-avx
93 .endif
94 CFLAGS+=        -mcmodel=kernel -mno-red-zone -mno-mmx -msoft-float \
95                 -fno-asynchronous-unwind-tables
96 INLINE_LIMIT?=  8000
97 .endif
98
99 #
100 # For PowerPC we tell gcc to use floating point emulation.  This avoids using
101 # floating point registers for integer operations which it has a tendency to do.
102 # Also explicitly disable Altivec instructions inside the kernel.
103 #
104 .if ${MACHINE_CPUARCH} == "powerpc"
105 CFLAGS+=        -msoft-float -mno-altivec
106 INLINE_LIMIT?=  15000
107 .endif
108
109 #
110 # Use dot symbols on powerpc64 to make ddb happy
111 #
112 .if ${MACHINE_ARCH} == "powerpc64"
113 CFLAGS+=        -mcall-aixdesc
114 .endif
115
116 #
117 # For MIPS we also tell gcc to use floating point emulation
118 #
119 .if ${MACHINE_CPUARCH} == "mips"
120 CFLAGS+=        -msoft-float
121 INLINE_LIMIT?=  8000
122 .endif
123
124 #
125 # GCC 3.0 and above like to do certain optimizations based on the
126 # assumption that the program is linked against libc.  Stop this.
127 #
128 CFLAGS+=        -ffreestanding
129
130 #
131 # GCC SSP support
132 #
133 .if ${MK_SSP} != "no" && ${MACHINE_CPUARCH} != "ia64" && \
134     ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips"
135 CFLAGS+=        -fstack-protector
136 .endif
137
138 #
139 # Enable CTF conversation on request
140 #
141 .if defined(WITH_CTF)
142 .undef NO_CTF
143 .endif