diff -r ea5e09d013e7 sys/conf/kern.mk --- a/sys/conf/kern.mk Thu Jun 10 07:40:51 2010 -0700 +++ b/sys/conf/kern.mk Thu Jun 10 11:35:50 2010 -0700 @@ -9,6 +9,10 @@ .if ${CC} == "icc" #CWARNFLAGS= -w2 # use this if you are terribly bored CWARNFLAGS= +.elif ${CC} == "clang" +CWARNFLAGS?= -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes \ + -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual \ + -Wundef -Wno-pointer-sign .else CWARNFLAGS?= -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes \ -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual \ @@ -63,9 +67,15 @@ # reserved for user applications. # .if ${MACHINE_ARCH} == "amd64" +.if ${CC} == "clang" +CFLAGS+= -mcmodel=kernel -mno-red-zone \ + -mno-sse -mno-sse2 -mno-sse3 -mno-mmx -mno-3dnow \ + -msoft-float -fno-asynchronous-unwind-tables +.else CFLAGS+= -mcmodel=kernel -mno-red-zone \ -mfpmath=387 -mno-sse -mno-sse2 -mno-sse3 -mno-mmx -mno-3dnow \ -msoft-float -fno-asynchronous-unwind-tables +.endif INLINE_LIMIT?= 8000 .endif diff -r ea5e09d013e7 sys/conf/kern.pre.mk --- a/sys/conf/kern.pre.mk Thu Jun 10 07:40:51 2010 -0700 +++ b/sys/conf/kern.pre.mk Thu Jun 10 11:35:50 2010 -0700 @@ -30,7 +30,11 @@ _MINUS_O= -O2 . endif . if ${MACHINE_ARCH} == "amd64" +. if ${CC} == "clang" +COPTFLAGS?=-O2 -pipe +. else COPTFLAGS?=-O2 -frename-registers -pipe +. endif . else COPTFLAGS?=${_MINUS_O} -pipe . endif @@ -89,7 +93,7 @@ CFLAGS= ${COPTFLAGS} ${C_DIALECT} ${DEBUG} ${CWARNFLAGS} CFLAGS+= ${INCLUDES} -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -.if ${CC} != "icc" +.if ${CC} != "icc" && ${CC} != "clang" CFLAGS+= -fno-common -finline-limit=${INLINE_LIMIT} CFLAGS+= --param inline-unit-growth=100 CFLAGS+= --param large-function-growth=1000 diff -r ea5e09d013e7 sys/conf/kmod.mk --- a/sys/conf/kmod.mk Thu Jun 10 07:40:51 2010 -0700 +++ b/sys/conf/kmod.mk Thu Jun 10 11:35:50 2010 -0700 @@ -111,7 +111,7 @@ # for example. CFLAGS+= -I@/contrib/altq -.if ${CC} != "icc" +.if ${CC} != "icc" && ${CC} != "clang" CFLAGS+= -finline-limit=${INLINE_LIMIT} CFLAGS+= --param inline-unit-growth=100 CFLAGS+= --param large-function-growth=1000