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.if ${CC} == "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_ARCH} == "i386" && ${CC} != "icc" 33CFLAGS+= -mno-align-long-strings -mpreferred-stack-boundary=2 \ 34 -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 35INLINE_LIMIT?= 8000 36.endif 37 38.if ${MACHINE_ARCH} == "arm" 39INLINE_LIMIT?= 8000 40.endif 41# 42# For IA-64, we use r13 for the kernel globals pointer and we only use 43# a very small subset of float registers for integer divides. 44# 45.if ${MACHINE_ARCH} == "ia64" 46CFLAGS+= -ffixed-r13 -mfixed-range=f32-f127 -fpic #-mno-sdata 47INLINE_LIMIT?= 15000 48.endif 49 50# 51# For sparc64 we want medlow code model, and we tell gcc to use floating 52# point emulation. This avoids using floating point registers for integer 53# operations which it has a tendency to do. 54# 55.if ${MACHINE_ARCH} == "sparc64" 56CFLAGS+= -mcmodel=medany -msoft-float 57INLINE_LIMIT?= 15000 58.endif 59 60# 61# For AMD64, we explicitly prohibit the use of FPU, SSE and other SIMD 62# operations inside the kernel itself. These operations are exclusively 63# reserved for user applications. 64# 65.if ${MACHINE_ARCH} == "amd64" 66CFLAGS+= -mcmodel=kernel -mno-red-zone \ 67 -mfpmath=387 -mno-sse -mno-sse2 -mno-sse3 -mno-mmx -mno-3dnow \ 68 -msoft-float -fno-asynchronous-unwind-tables 69INLINE_LIMIT?= 8000 70.endif 71 72# 73# For PowerPC we tell gcc to use floating point emulation. This avoids using 74# floating point registers for integer operations which it has a tendency to do. 75# Also explicitly disable Altivec instructions inside the kernel. 76# 77.if ${MACHINE_ARCH} == "powerpc" 78CFLAGS+= -msoft-float -mno-altivec 79INLINE_LIMIT?= 15000 80.endif 81 82# 83# For MIPS we also tell gcc to use floating point emulation 84# 85.if ${MACHINE_ARCH} == "mips" 86CFLAGS+= -msoft-float 87INLINE_LIMIT?= 8000 88.endif 89 90# 91# GCC 3.0 and above like to do certain optimizations based on the 92# assumption that the program is linked against libc. Stop this. 93# 94.if ${CC} == "icc" 95CFLAGS+= -nolib_inline 96.else 97CFLAGS+= -ffreestanding 98.endif 99 100.if ${CC} == "icc" 101CFLAGS+= -restrict 102.endif 103 104# 105# GCC SSP support. 106# 107.if ${MK_SSP} != "no" && ${CC} != "icc" && ${MACHINE_ARCH} != "ia64" && \ 108 ${MACHINE_ARCH} != "arm" && ${MACHINE_ARCH} != "mips" 109CFLAGS+= -fstack-protector 110.endif 111