From 52cb92ace3f60eb76b1c404fe58893cd6dc8bbd9 Mon Sep 17 00:00:00 2001 From: John Marino Date: Sat, 25 Oct 2014 12:28:56 +0200 Subject: [PATCH] kern.mk: isolate gcc-only flags to gcc compilers (determined by CCVER) --- sys/conf/bsd.kern.mk | 14 ++++++++++---- sys/platform/pc32/conf/kern.mk | 7 +++---- sys/platform/pc64/conf/kern.mk | 7 +++---- sys/platform/vkernel/conf/kern.mk | 3 ++- sys/platform/vkernel64/conf/kern.mk | 4 ++-- 5 files changed, 20 insertions(+), 15 deletions(-) diff --git a/sys/conf/bsd.kern.mk b/sys/conf/bsd.kern.mk index 57ae10f058..f43e0f6808 100644 --- a/sys/conf/bsd.kern.mk +++ b/sys/conf/bsd.kern.mk @@ -9,16 +9,22 @@ CWARNFLAGS?= -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes \ -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual \ - -Wold-style-definition -Wold-style-declaration -Wno-inline \ + -Wold-style-definition -Wno-inline \ -Wno-pointer-sign -Winit-self -std=c99 +.if ${CCVER:Mgcc*} +# All flags inside this block are gcc-specific except for --param +# Since inline-limit wasn't recognized, and since --param squawks on clang +# when it isn't used, it was shift to GCC compilers only. +CFLAGS+= -Wold-style-declaration \ + -finline-limit=${INLINE_LIMIT} \ + --param inline-unit-growth=100 \ + --param large-function-growth=1000 .if ${CCVER} == "gcc47" CWARNFLAGS+= -Wno-unused-but-set-variable .endif +.endif -CFLAGS+= -finline-limit=${INLINE_LIMIT} -CFLAGS+= --param inline-unit-growth=100 -CFLAGS+= --param large-function-growth=1000 # Require the proper use of 'extern' for variables. -fno-common will # cause duplicate declarations to generate a link error. diff --git a/sys/platform/pc32/conf/kern.mk b/sys/platform/pc32/conf/kern.mk index 4284b128a1..8f11297758 100644 --- a/sys/platform/pc32/conf/kern.mk +++ b/sys/platform/pc32/conf/kern.mk @@ -1,4 +1,3 @@ -# $DragonFly: src/sys/platform/pc32/conf/kern.mk,v 1.1 2006/10/22 16:09:13 dillon Exp $ # # On the i386, do not align the stack to 16-byte boundaries. Otherwise GCC # adds code to the entry and exit point of every function to align the @@ -12,15 +11,14 @@ # only saved and restored under strictly managed conditions and mainline # kernel code cannot safely use the FP system. # -CFLAGS+= -mpreferred-stack-boundary=2 CFLAGS+= -fno-stack-protector CFLAGS+= -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -.if ${CCVER} == "gcc44" || ${CCVER} == "gcc47" +.if ${CCVER:Mgcc*} +CFLAGS+= -mpreferred-stack-boundary=2 CFLAGS+= -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -mno-sse4 -mno-sse4a \ -mno-sse5 CFLAGS+= -mno-abm -mno-aes -mno-avx -mno-pclmul -mno-popcnt -.endif .if ${CCVER} == "gcc47" CFLAGS+= -mno-avx2 -mno-fsgsbase -mno-rdrnd -mno-f16c @@ -28,6 +26,7 @@ CFLAGS+= -mno-fma -mno-fma4 CFLAGS+= -mno-bmi -mno-bmi2 CFLAGS+= -mno-xop -mno-lwp -mno-lzcnt -mno-tbm .endif +.endif CFLAGS+= -msoft-float diff --git a/sys/platform/pc64/conf/kern.mk b/sys/platform/pc64/conf/kern.mk index 4ba05e172f..98b4073cc3 100644 --- a/sys/platform/pc64/conf/kern.mk +++ b/sys/platform/pc64/conf/kern.mk @@ -1,5 +1,4 @@ # $FreeBSD: src/sys/conf/kern.mk,v 1.52 2007/05/24 21:53:42 obrien Exp $ -# $DragonFly: src/sys/platform/pc64/conf/kern.mk,v 1.2 2008/08/29 17:07:15 dillon Exp $ # # Warning flags for compiling the kernel and components of the kernel. @@ -8,17 +7,16 @@ # operations inside the kernel itself. These operations are exclusively # reserved for user applications. # -CFLAGS+= -mpreferred-stack-boundary=4 CFLAGS+= -fno-stack-protector CFLAGS+= -mcmodel=kernel -mno-red-zone -mfpmath=387 CFLAGS+= -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -.if ${CCVER} == "gcc44" || ${CCVER} == "gcc47" +.if ${CCVER:Mgcc*} +CFLAGS+= -mpreferred-stack-boundary=4 CFLAGS+= -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -mno-sse4 -mno-sse4a \ -mno-sse5 CFLAGS+= -mno-abm -mno-aes -mno-avx -mno-pclmul -mno-popcnt -.endif .if ${CCVER} == "gcc47" CFLAGS+= -mno-avx2 -mno-fsgsbase -mno-rdrnd -mno-f16c @@ -26,6 +24,7 @@ CFLAGS+= -mno-fma -mno-fma4 CFLAGS+= -mno-bmi -mno-bmi2 CFLAGS+= -mno-xop -mno-lwp -mno-lzcnt -mno-tbm .endif +.endif CFLAGS+= -msoft-float CFLAGS+= -fno-asynchronous-unwind-tables -fno-omit-frame-pointer diff --git a/sys/platform/vkernel/conf/kern.mk b/sys/platform/vkernel/conf/kern.mk index febcd20915..8ceb4d7c01 100644 --- a/sys/platform/vkernel/conf/kern.mk +++ b/sys/platform/vkernel/conf/kern.mk @@ -1,4 +1,3 @@ -# $DragonFly: src/sys/platform/vkernel/conf/kern.mk,v 1.3 2007/01/06 08:57:30 dillon Exp $ # # On the i386, do not align the stack to 16-byte boundaries. Otherwise GCC # adds code to the entry and exit point of every function to align the @@ -12,7 +11,9 @@ # only saved and restored under strictly managed conditions and mainline # kernel code cannot safely use the FP system. # +.if ${CCVER:Mgcc*} CFLAGS+= -mpreferred-stack-boundary=2 +.endif CFLAGS+= -fno-stack-protector CFLAGS+= -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 CFLAGS+= -D_KERNEL_VIRTUAL diff --git a/sys/platform/vkernel64/conf/kern.mk b/sys/platform/vkernel64/conf/kern.mk index 39af0c8ff9..d52fc7ad4f 100644 --- a/sys/platform/vkernel64/conf/kern.mk +++ b/sys/platform/vkernel64/conf/kern.mk @@ -1,11 +1,11 @@ -# $DragonFly: src/sys/platform/vkernel/conf/kern.mk,v 1.3 2007/01/06 08:57:30 dillon Exp $ -# # # Prohibit the use of FP registers in the kernel. The user FP state is # only saved and restored under strictly managed conditions and mainline # kernel code cannot safely use the FP system. # +.if ${CCVER:Mgcc*} CFLAGS+= -mpreferred-stack-boundary=4 +.endif CFLAGS+= -fno-stack-protector CFLAGS+= -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 CFLAGS+= -D_KERNEL_VIRTUAL -- 2.41.0