Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Oct 2011 20:27:59 +0000
From:      Alexander Best <arundel@freebsd.org>
To:        freebsd-toolchain@freebsd.org
Subject:   small patch to get rid of -frename-registers when using clang
Message-ID:  <20111013202759.GA11993@freebsd.org>

next in thread | raw e-mail | index | archive | help

--rwEMma7ioTxnRzrJ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

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

--rwEMma7ioTxnRzrJ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="kern.pre.mk.diff"

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

--rwEMma7ioTxnRzrJ--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20111013202759.GA11993>