summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorbrooks <brooks@FreeBSD.org>2012-09-13 16:00:46 +0000
committerbrooks <brooks@FreeBSD.org>2012-09-13 16:00:46 +0000
commitf17cb55447d48bc158b5154afa555cbb98793552 (patch)
tree026ab7b76d6035ab651e3761d73e9f9f465ed976 /sys
parent1e4174de1a4f6a3cd6d80a545ec7187ecc402d68 (diff)
downloadFreeBSD-src-f17cb55447d48bc158b5154afa555cbb98793552.zip
FreeBSD-src-f17cb55447d48bc158b5154afa555cbb98793552.tar.gz
Introduce a new make variable COMPILER_TYPE that specifies what
type of compiler is being used (currently clang or gcc). COMPILER_TYPE is set in the new bsd.compiler.mk file based on the value of the CC variable or, should it prove informative, by running ${CC} --version and examining the output. To avoid negative performance impacts in the default case and correct value for COMPILER_TYPE type is determined and passed in the environment of submake instances while building world. Replace adhoc attempts at determining the compiler type by examining CC or MK_CLANG_IS_CC with checks of COMPILER_TYPE. This eliminates bootstrapping complications when first setting WITH_CLANG_IS_CC. Sponsored by: DARPA, AFRL Reviewed by: Yamaya Takashi <yamayan@kbh.biglobe.ne.jp>, imp, linimon (with some modifications post review) MFC after: 2 weeks
Diffstat (limited to 'sys')
-rw-r--r--sys/conf/kern.mk6
-rw-r--r--sys/conf/kern.pre.mk7
-rw-r--r--sys/conf/kmod.mk3
3 files changed, 9 insertions, 7 deletions
diff --git a/sys/conf/kern.mk b/sys/conf/kern.mk
index 5e031b3..e42b753 100644
--- a/sys/conf/kern.mk
+++ b/sys/conf/kern.mk
@@ -15,7 +15,7 @@ CWARNFLAGS?= -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes \
# Disable a few warnings for clang, since there are several places in the
# kernel where fixing them is more trouble than it is worth, or where there is
# a false positive.
-.if ${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang"
+.if ${COMPILER_TYPE} == "clang"
NO_WCONSTANT_CONVERSION= -Wno-constant-conversion
NO_WARRAY_BOUNDS= -Wno-array-bounds
NO_WSHIFT_COUNT_NEGATIVE= -Wno-shift-count-negative
@@ -52,7 +52,7 @@ CWARNEXTRA?= -Wno-error-tautological-compare -Wno-error-empty-body \
# Setting -mno-sse implies -mno-sse2, -mno-sse3, -mno-ssse3, -mno-sse41 and -mno-sse42
#
.if ${MACHINE_CPUARCH} == "i386"
-.if ${MK_CLANG_IS_CC} == "no" && ${CC:T:Mclang} != "clang"
+.if ${COMPILER_TYPE} != "clang"
CFLAGS+= -mno-align-long-strings -mpreferred-stack-boundary=2
.else
CFLAGS+= -mno-aes -mno-avx
@@ -100,7 +100,7 @@ INLINE_LIMIT?= 15000
# (-mfpmath= is not supported)
#
.if ${MACHINE_CPUARCH} == "amd64"
-.if ${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang"
+.if ${COMPILER_TYPE} == "clang"
CFLAGS+= -mno-aes -mno-avx
.endif
CFLAGS+= -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float \
diff --git a/sys/conf/kern.pre.mk b/sys/conf/kern.pre.mk
index b491c75..fbf686a 100644
--- a/sys/conf/kern.pre.mk
+++ b/sys/conf/kern.pre.mk
@@ -4,6 +4,7 @@
# of the definitions that need to be before %BEFORE_DEPEND.
.include <bsd.own.mk>
+.include <bsd.compiler.mk>
# backwards compat option for older systems.
MACHINE_CPUARCH?=${MACHINE_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc64/powerpc/}
@@ -35,7 +36,7 @@ _MINUS_O= -O2
.endif
.endif
.if ${MACHINE_CPUARCH} == "amd64"
-.if ${MK_CLANG_IS_CC} == "no" && ${CC:T:Mclang} != "clang"
+.if ${COMPILER_TYPE} != "clang"
COPTFLAGS?=-O2 -frename-registers -pipe
.else
COPTFLAGS?=-O2 -pipe
@@ -85,7 +86,7 @@ INCLUDES+= -I$S/dev/cxgb -I$S/dev/cxgbe
CFLAGS= ${COPTFLAGS} ${C_DIALECT} ${DEBUG} ${CWARNFLAGS}
CFLAGS+= ${INCLUDES} -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h
-.if ${MK_CLANG_IS_CC} == "no" && ${CC:T:Mclang} != "clang"
+.if ${COMPILER_TYPE} != "clang"
CFLAGS+= -fno-common -finline-limit=${INLINE_LIMIT}
.if ${MACHINE_CPUARCH} != "mips"
CFLAGS+= --param inline-unit-growth=100
@@ -102,7 +103,7 @@ WERROR?= -Werror
# XXX LOCORE means "don't declare C stuff" not "for locore.s".
ASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${CFLAGS}
-.if ${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang"
+.if ${COMPILER_TYPE} == "clang"
CLANG_NO_IAS= -no-integrated-as
.endif
diff --git a/sys/conf/kmod.mk b/sys/conf/kmod.mk
index 772e5cd..86955e9 100644
--- a/sys/conf/kmod.mk
+++ b/sys/conf/kmod.mk
@@ -73,6 +73,7 @@ OBJCOPY?= objcopy
.endif
.include <bsd.init.mk>
+.include <bsd.compiler.mk>
.SUFFIXES: .out .o .c .cc .cxx .C .y .l .s .S
@@ -108,7 +109,7 @@ CFLAGS+= -I. -I@
# for example.
CFLAGS+= -I@/contrib/altq
-.if ${MK_CLANG_IS_CC} == "no" && ${CC:T:Mclang} != "clang"
+.if ${COMPILER_TYPE} != "clang"
CFLAGS+= -finline-limit=${INLINE_LIMIT}
CFLAGS+= --param inline-unit-growth=100
CFLAGS+= --param large-function-growth=1000
OpenPOWER on IntegriCloud