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