small patch to get rid of -frename-registers when using clang

Alexander Best arundel at freebsd.org
Thu Oct 13 20:27:59 UTC 2011


hi there,

any thoughts regarding this patch? it makes sure -frename-registers doesn't get
used, when the compiler is clang. nothing spectacular, but it cleans up stdout
a bit.

it also makes sure that when debugging was enabled, amd64 gets compiled with
-O instead of -O2, just like all the other archs. i'm not sure, if this is
really the right thing to do, but i don't really understand the current
behavior. why should -O2 be set, when the users indicated that he wants to
compile a kernel for debugging? sure amd64 supports debugging with -O2, as
noted in the svn history of kern.pre.mk. however even on amd64 a -O2 kernel
and a -O kernel aren't the same when it comes to debugging capabilities.

however, i'm not really sure about this. bde@ probably has an opinion regarding
this matter.

cheers.
alex
-------------- next part --------------
diff --git a/sys/conf/kern.pre.mk b/sys/conf/kern.pre.mk
index 2320b89..badf7ef 100644
--- a/sys/conf/kern.pre.mk
+++ b/sys/conf/kern.pre.mk
@@ -33,8 +33,8 @@ _MINUS_O=	-O	# gcc miscompiles some code at -O2
 _MINUS_O=	-O2
 .endif
 .endif
-.if ${MACHINE_CPUARCH} == "amd64"
-COPTFLAGS?=-O2 -frename-registers -pipe
+.if ${MACHINE_CPUARCH} == "amd64" && ${CC:T:Mclang} != "clang"
+COPTFLAGS?=${_MINUS_O} -frename-registers -pipe
 .else
 COPTFLAGS?=${_MINUS_O} -pipe
 .endif


More information about the freebsd-toolchain mailing list