From owner-svn-src-all@FreeBSD.ORG Sat May 10 16:38:10 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D9DCDDCF; Sat, 10 May 2014 16:38:10 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BAE75207; Sat, 10 May 2014 16:38:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s4AGcAC2006529; Sat, 10 May 2014 16:38:10 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s4AGc9Xk006523; Sat, 10 May 2014 16:38:09 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201405101638.s4AGc9Xk006523@svn.freebsd.org> From: Warner Losh Date: Sat, 10 May 2014 16:38:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r265832 - head/sys/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 May 2014 16:38:10 -0000 Author: imp Date: Sat May 10 16:38:09 2014 New Revision: 265832 URL: http://svnweb.freebsd.org/changeset/base/265832 Log: Simplify clang ifdefs in the kernel a bit. Introduce CFLAGS.${COMPILER_TYPE} to mirror userland. Be explicit about which compiler needs something (not clang isn't necessarily gcc in the future). Modified: head/sys/conf/Makefile.arm head/sys/conf/kern.mk head/sys/conf/kern.pre.mk head/sys/conf/kmod.mk Modified: head/sys/conf/Makefile.arm ============================================================================== --- head/sys/conf/Makefile.arm Sat May 10 16:38:03 2014 (r265831) +++ head/sys/conf/Makefile.arm Sat May 10 16:38:09 2014 (r265832) @@ -39,20 +39,17 @@ SYSTEM_DEP:= ${SYSTEM_DEP:$S/conf/ldscri STRIP_FLAGS = -S .endif -.if ${COMPILER_TYPE} != "clang" -CFLAGS += -mno-thumb-interwork -.endif +# We don't support gcc's thump interwork stuff, so disable it +CFLAGS.gcc += -mno-thumb-interwork .if empty(DDB_ENABLED) -.if ${MK_ARM_EABI} == "no" && ${COMPILER_TYPE} == "gcc" -CFLAGS += -mno-apcs-frame +.if ${MK_ARM_EABI} == "no" +CFLAGS.gcc += -mno-apcs-frame .endif .elif ${MK_ARM_EABI} != "no" CFLAGS += -funwind-tables -.if ${COMPILER_TYPE} == "clang" # clang requires us to tell it to emit assembly with unwind information -CFLAGS += -mllvm -arm-enable-ehabi -.endif +CFLAGS.clang += -mllvm -arm-enable-ehabi .endif # hack because genassym.c includes sys/bus.h which includes these. Modified: head/sys/conf/kern.mk ============================================================================== --- head/sys/conf/kern.mk Sat May 10 16:38:03 2014 (r265831) +++ head/sys/conf/kern.mk Sat May 10 16:38:09 2014 (r265832) @@ -64,11 +64,8 @@ FORMAT_EXTENSIONS= -fformat-extensions # Setting -mno-sse implies -mno-sse2, -mno-sse3, -mno-ssse3, -mno-sse41 and -mno-sse42 # .if ${MACHINE_CPUARCH} == "i386" -.if ${COMPILER_TYPE} != "clang" -CFLAGS+= -mno-align-long-strings -mpreferred-stack-boundary=2 -.else -CFLAGS+= -mno-aes -mno-avx -.endif +CFLAGS.gcc+= -mno-align-long-strings -mpreferred-stack-boundary=2 +CFLAGS.clang+= -mno-aes -mno-avx CFLAGS+= -mno-mmx -mno-sse -msoft-float INLINE_LIMIT?= 8000 .endif @@ -93,11 +90,8 @@ INLINE_LIMIT?= 15000 # operations which it has a tendency to do. # .if ${MACHINE_CPUARCH} == "sparc64" -.if ${COMPILER_TYPE} == "clang" -CFLAGS+= -mcmodel=large -fno-dwarf2-cfi-asm -.else -CFLAGS+= -mcmodel=medany -msoft-float -.endif +CFLAGS.clang+= -mcmodel=large -fno-dwarf2-cfi-asm +CFLAGS.gcc+= -mcmodel=medany -msoft-float INLINE_LIMIT?= 15000 .endif @@ -116,9 +110,7 @@ INLINE_LIMIT?= 15000 # (-mfpmath= is not supported) # .if ${MACHINE_CPUARCH} == "amd64" -.if ${COMPILER_TYPE} == "clang" -CFLAGS+= -mno-aes -mno-avx -.endif +CFLAGS.clang+= -mno-aes -mno-avx CFLAGS+= -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float \ -fno-asynchronous-unwind-tables INLINE_LIMIT?= 8000 @@ -173,3 +165,5 @@ CFLAGS+= -fstack-protector .if ${CFLAGS:M-g} != "" && ${CFLAGS:M-gdwarf*} == "" CFLAGS+= -gdwarf-2 .endif + +CFLAGS+= ${CFLAGS.${COMPILER_TYPE}} Modified: head/sys/conf/kern.pre.mk ============================================================================== --- head/sys/conf/kern.pre.mk Sat May 10 16:38:03 2014 (r265831) +++ head/sys/conf/kern.pre.mk Sat May 10 16:38:09 2014 (r265832) @@ -37,10 +37,10 @@ _MINUS_O= -O2 .endif .endif .if ${MACHINE_CPUARCH} == "amd64" -.if ${COMPILER_TYPE} != "clang" -COPTFLAGS?=-O2 -frename-registers -pipe -.else +.if ${COMPILER_TYPE} == "clang" COPTFLAGS?=-O2 -pipe +.else +COPTFLAGS?=-O2 -frename-registers -pipe .endif .else COPTFLAGS?=${_MINUS_O} -pipe @@ -86,13 +86,11 @@ CFLAGS_PARAM_LARGE_FUNCTION_GROWTH?=1000 .if ${MACHINE_CPUARCH} == "mips" CFLAGS_ARCH_PARAMS?=--param max-inline-insns-single=1000 .endif -.if ${COMPILER_TYPE} != "clang" -CFLAGS+= -fno-common -finline-limit=${INLINE_LIMIT} -CFLAGS+= --param inline-unit-growth=${CFLAGS_PARAM_INLINE_UNIT_GROWTH} -CFLAGS+= --param large-function-growth=${CFLAGS_PARAM_LARGE_FUNCTION_GROWTH} +CFLAGS.gcc+= -fno-common -finline-limit=${INLINE_LIMIT} +CFLAGS.gcc+= --param inline-unit-growth=${CFLAGS_PARAM_INLINE_UNIT_GROWTH} +CFLAGS.gcc+= --param large-function-growth=${CFLAGS_PARAM_LARGE_FUNCTION_GROWTH} .if defined(CFLAGS_ARCH_PARAMS) -CFLAGS+=${CFLAGS_ARCH_PARAMS} -.endif +CFLAGS.gcc+=${CFLAGS_ARCH_PARAMS} .endif WERROR?= -Werror @@ -107,13 +105,11 @@ GCC_MS_EXTENSIONS= -fms-extensions .if defined(PROFLEVEL) && ${PROFLEVEL} >= 1 CFLAGS+= -DGPROF -.if ${COMPILER_TYPE} != "clang" -CFLAGS+= -falign-functions=16 -.endif +CFLAGS.gcc+= -falign-functions=16 .if ${PROFLEVEL} >= 2 CFLAGS+= -DGPROF4 -DGUPROF PROF= -pg -.if ${COMPILER_TYPE} != "clang" +.if ${COMPILER_TYPE} == "gcc" PROF+= -mprofiler-epilogue .endif .else Modified: head/sys/conf/kmod.mk ============================================================================== --- head/sys/conf/kmod.mk Sat May 10 16:38:03 2014 (r265831) +++ head/sys/conf/kmod.mk Sat May 10 16:38:09 2014 (r265832) @@ -116,11 +116,9 @@ CFLAGS+= -I. -I@ # for example. CFLAGS+= -I@/contrib/altq -.if ${COMPILER_TYPE} != "clang" -CFLAGS+= -finline-limit=${INLINE_LIMIT} -CFLAGS+= --param inline-unit-growth=100 -CFLAGS+= --param large-function-growth=1000 -.endif +CFLAGS.gcc+= -finline-limit=${INLINE_LIMIT} +CFLAGS.gcc+= --param inline-unit-growth=100 +CFLAGS.gcc+= --param large-function-growth=1000 # Disallow common variables, and if we end up with commons from # somewhere unexpected, allocate storage for them in the module itself.