4 # Warning flags for compiling the kernel and components of the kernel:
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
11 # The following flags are next up for working on:
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.
26 # Setting -mno-mmx implies -mno-3dnow
27 # Setting -mno-sse implies -mno-sse2, -mno-sse3 and -mno-ssse3
30 # Setting -mno-mmx implies -mno-3dnow, -mno-3dnowa, -mno-sse, -mno-sse2,
31 # -mno-sse3, -mno-ssse3, -mno-sse41 and -mno-sse42
33 .if ${MACHINE_CPUARCH} == "i386"
34 .if ${CC:T:Mclang} != "clang"
35 CFLAGS+= -mno-align-long-strings -mpreferred-stack-boundary=2 -mno-sse
37 CFLAGS+= -mno-aes -mno-avx
39 CFLAGS+= -mno-mmx -msoft-float
43 .if ${MACHINE_CPUARCH} == "arm"
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.
51 .if ${MACHINE_CPUARCH} == "ia64"
52 CFLAGS+= -ffixed-r13 -mfixed-range=f32-f127 -fpic #-mno-sdata
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.
61 .if ${MACHINE_CPUARCH} == "sparc64"
62 CFLAGS+= -mcmodel=medany -msoft-float
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.
72 # Setting -mno-mmx implies -mno-3dnow
73 # Setting -mno-sse implies -mno-sse2, -mno-sse3, -mno-ssse3 and -mfpmath=387
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)
80 .if ${MACHINE_CPUARCH} == "amd64"
81 .if ${CC:T:Mclang} != "clang"
84 CFLAGS+= -mno-aes -mno-avx
86 CFLAGS+= -mcmodel=kernel -mno-red-zone -mno-mmx -msoft-float \
87 -fno-asynchronous-unwind-tables
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.
96 .if ${MACHINE_CPUARCH} == "powerpc"
97 CFLAGS+= -msoft-float -mno-altivec
102 # Use dot symbols on powerpc64 to make ddb happy
104 .if ${MACHINE_ARCH} == "powerpc64"
105 CFLAGS+= -mcall-aixdesc
109 # For MIPS we also tell gcc to use floating point emulation
111 .if ${MACHINE_CPUARCH} == "mips"
112 CFLAGS+= -msoft-float
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.
120 CFLAGS+= -ffreestanding
125 .if ${MK_SSP} != "no" && ${MACHINE_CPUARCH} != "ia64" && \
126 ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips"
127 CFLAGS+= -fstack-protector
131 # Enable CTF conversation on request
133 .if defined(WITH_CTF)