1999-08-28 00:22:10 +00:00
|
|
|
# $FreeBSD$
|
1996-10-08 22:10:49 +00:00
|
|
|
|
|
|
|
#
|
2011-05-24 09:01:56 +00:00
|
|
|
# Warning flags for compiling the kernel and components of the kernel:
|
1996-10-08 22:10:49 +00:00
|
|
|
#
|
2001-09-10 06:23:33 +00:00
|
|
|
CWARNFLAGS?= -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes \
|
|
|
|
-Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual \
|
2011-05-02 10:35:27 +00:00
|
|
|
-Wundef -Wno-pointer-sign -fformat-extensions \
|
2011-05-24 09:01:56 +00:00
|
|
|
-Wmissing-include-dirs -fdiagnostics-show-option
|
1999-01-29 10:57:18 +00:00
|
|
|
#
|
|
|
|
# The following flags are next up for working on:
|
2011-05-02 10:35:27 +00:00
|
|
|
# -Wextra
|
1999-01-27 22:53:58 +00:00
|
|
|
|
1999-11-17 07:30:35 +00:00
|
|
|
#
|
2011-05-02 10:35:27 +00:00
|
|
|
# On i386, do not align the stack to 16-byte boundaries. Otherwise GCC 2.95
|
|
|
|
# and above adds code to the entry and exit point of every function to align the
|
1999-11-17 07:30:35 +00:00
|
|
|
# stack to 16-byte boundaries -- thus wasting approximately 12 bytes of stack
|
2011-05-02 10:35:27 +00:00
|
|
|
# per function call. While the 16-byte alignment may benefit micro benchmarks,
|
2000-04-24 08:50:15 +00:00
|
|
|
# it is probably an overall loss as it makes the code bigger (less efficient
|
1999-11-17 07:30:35 +00:00
|
|
|
# use of code cache tag lines) and uses more stack (less efficient use of data
|
2011-05-02 10:35:27 +00:00
|
|
|
# cache tag lines). Explicitly prohibit the use of FPU, SSE and other SIMD
|
2005-03-31 22:53:58 +00:00
|
|
|
# operations inside the kernel itself. These operations are exclusively
|
|
|
|
# reserved for user applications.
|
1999-11-17 07:30:35 +00:00
|
|
|
#
|
2011-05-14 11:26:00 +00:00
|
|
|
# gcc:
|
|
|
|
# Setting -mno-mmx implies -mno-3dnow
|
|
|
|
# Setting -mno-sse implies -mno-sse2, -mno-sse3 and -mno-ssse3
|
|
|
|
#
|
|
|
|
# clang:
|
|
|
|
# Setting -mno-mmx implies -mno-3dnow, -mno-3dnowa, -mno-sse, -mno-sse2,
|
|
|
|
# -mno-sse3, -mno-ssse3, -mno-sse41 and -mno-sse42
|
|
|
|
#
|
2011-04-19 18:09:21 +00:00
|
|
|
.if ${MACHINE_CPUARCH} == "i386"
|
2010-08-17 20:39:28 +00:00
|
|
|
.if ${CC:T:Mclang} != "clang"
|
2011-05-14 11:26:00 +00:00
|
|
|
CFLAGS+= -mno-align-long-strings -mpreferred-stack-boundary=2 -mno-sse
|
|
|
|
.else
|
|
|
|
CFLAGS+= -mno-aes -mno-avx
|
2010-07-22 18:47:41 +00:00
|
|
|
.endif
|
2011-05-14 11:26:00 +00:00
|
|
|
CFLAGS+= -mno-mmx -msoft-float
|
2004-03-03 09:35:06 +00:00
|
|
|
INLINE_LIMIT?= 8000
|
1999-11-17 07:30:35 +00:00
|
|
|
.endif
|
|
|
|
|
2010-09-13 07:27:03 +00:00
|
|
|
.if ${MACHINE_CPUARCH} == "arm"
|
2004-05-14 13:35:46 +00:00
|
|
|
INLINE_LIMIT?= 8000
|
|
|
|
.endif
|
2011-05-02 10:35:27 +00:00
|
|
|
|
2000-10-16 20:04:52 +00:00
|
|
|
#
|
|
|
|
# For IA-64, we use r13 for the kernel globals pointer and we only use
|
|
|
|
# a very small subset of float registers for integer divides.
|
|
|
|
#
|
2010-09-13 07:27:03 +00:00
|
|
|
.if ${MACHINE_CPUARCH} == "ia64"
|
2007-05-19 04:45:54 +00:00
|
|
|
CFLAGS+= -ffixed-r13 -mfixed-range=f32-f127 -fpic #-mno-sdata
|
2003-11-04 23:29:17 +00:00
|
|
|
INLINE_LIMIT?= 15000
|
2000-10-16 20:04:52 +00:00
|
|
|
.endif
|
2001-09-10 06:23:33 +00:00
|
|
|
|
2003-02-28 06:49:59 +00:00
|
|
|
#
|
|
|
|
# For sparc64 we want medlow code model, and we tell gcc to use floating
|
|
|
|
# point emulation. This avoids using floating point registers for integer
|
|
|
|
# operations which it has a tendency to do.
|
|
|
|
#
|
2010-09-13 07:27:03 +00:00
|
|
|
.if ${MACHINE_CPUARCH} == "sparc64"
|
2006-11-26 23:16:46 +00:00
|
|
|
CFLAGS+= -mcmodel=medany -msoft-float
|
2003-11-04 23:29:17 +00:00
|
|
|
INLINE_LIMIT?= 15000
|
2003-02-28 06:49:59 +00:00
|
|
|
.endif
|
|
|
|
|
2003-04-30 22:22:29 +00:00
|
|
|
#
|
2005-03-31 22:53:58 +00:00
|
|
|
# For AMD64, we explicitly prohibit the use of FPU, SSE and other SIMD
|
|
|
|
# operations inside the kernel itself. These operations are exclusively
|
|
|
|
# reserved for user applications.
|
2003-04-30 22:22:29 +00:00
|
|
|
#
|
2011-05-14 11:26:00 +00:00
|
|
|
# gcc:
|
|
|
|
# Setting -mno-mmx implies -mno-3dnow
|
|
|
|
# Setting -mno-sse implies -mno-sse2, -mno-sse3, -mno-ssse3 and -mfpmath=387
|
|
|
|
#
|
|
|
|
# clang:
|
|
|
|
# Setting -mno-mmx implies -mno-3dnow, -mno-3dnowa, -mno-sse, -mno-sse2,
|
|
|
|
# -mno-sse3, -mno-ssse3, -mno-sse41 and -mno-sse42
|
|
|
|
# (-mfpmath= is not supported)
|
|
|
|
#
|
2010-09-13 07:27:03 +00:00
|
|
|
.if ${MACHINE_CPUARCH} == "amd64"
|
2011-05-14 11:26:00 +00:00
|
|
|
.if ${CC:T:Mclang} != "clang"
|
|
|
|
CFLAGS+= -mno-sse
|
|
|
|
.else
|
|
|
|
CFLAGS+= -mno-aes -mno-avx
|
|
|
|
.endif
|
|
|
|
CFLAGS+= -mcmodel=kernel -mno-red-zone -mno-mmx -msoft-float \
|
|
|
|
-fno-asynchronous-unwind-tables
|
2004-02-06 20:40:04 +00:00
|
|
|
INLINE_LIMIT?= 8000
|
2003-04-30 22:22:29 +00:00
|
|
|
.endif
|
|
|
|
|
2003-12-07 09:56:30 +00:00
|
|
|
#
|
|
|
|
# For PowerPC we tell gcc to use floating point emulation. This avoids using
|
|
|
|
# floating point registers for integer operations which it has a tendency to do.
|
2009-02-22 18:45:30 +00:00
|
|
|
# Also explicitly disable Altivec instructions inside the kernel.
|
2003-12-07 09:56:30 +00:00
|
|
|
#
|
2010-09-13 07:27:03 +00:00
|
|
|
.if ${MACHINE_CPUARCH} == "powerpc"
|
2009-02-22 18:45:30 +00:00
|
|
|
CFLAGS+= -msoft-float -mno-altivec
|
2003-12-07 09:56:30 +00:00
|
|
|
INLINE_LIMIT?= 15000
|
|
|
|
.endif
|
|
|
|
|
2011-02-18 21:44:53 +00:00
|
|
|
#
|
|
|
|
# Use dot symbols on powerpc64 to make ddb happy
|
|
|
|
#
|
|
|
|
.if ${MACHINE_ARCH} == "powerpc64"
|
|
|
|
CFLAGS+= -mcall-aixdesc
|
|
|
|
.endif
|
|
|
|
|
2008-04-29 11:28:10 +00:00
|
|
|
#
|
2010-01-09 17:21:36 +00:00
|
|
|
# For MIPS we also tell gcc to use floating point emulation
|
2008-04-29 11:28:10 +00:00
|
|
|
#
|
2010-09-13 07:27:03 +00:00
|
|
|
.if ${MACHINE_CPUARCH} == "mips"
|
2010-01-09 17:21:36 +00:00
|
|
|
CFLAGS+= -msoft-float
|
2009-03-03 18:53:47 +00:00
|
|
|
INLINE_LIMIT?= 8000
|
2008-04-29 11:28:10 +00:00
|
|
|
.endif
|
|
|
|
|
2001-09-10 06:23:33 +00:00
|
|
|
#
|
|
|
|
# GCC 3.0 and above like to do certain optimizations based on the
|
|
|
|
# assumption that the program is linked against libc. Stop this.
|
|
|
|
#
|
|
|
|
CFLAGS+= -ffreestanding
|
2008-06-25 21:33:28 +00:00
|
|
|
|
|
|
|
#
|
2011-05-02 10:35:27 +00:00
|
|
|
# GCC SSP support
|
2008-06-25 21:33:28 +00:00
|
|
|
#
|
2011-04-19 18:09:21 +00:00
|
|
|
.if ${MK_SSP} != "no" && ${MACHINE_CPUARCH} != "ia64" && \
|
|
|
|
${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips"
|
2008-06-25 21:33:28 +00:00
|
|
|
CFLAGS+= -fstack-protector
|
|
|
|
.endif
|
2010-04-02 06:55:31 +00:00
|
|
|
|
|
|
|
#
|
2011-05-02 10:35:27 +00:00
|
|
|
# Enable CTF conversation on request
|
2010-04-02 06:55:31 +00:00
|
|
|
#
|
|
|
|
.if defined(WITH_CTF)
|
|
|
|
.undef NO_CTF
|
|
|
|
.endif
|