Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Aug 2002 11:13:42 -0400
From:      Mikhail Teterin <mi+mx@aldan.algebra.com>
To:        arch@FreeBSD.org
Cc:        John Baldwin <jhb@FreeBSD.org>
Subject:   march/mcpu in bsd.cpu.mk
Message-ID:  <200208011113.42669.mi%2Bmx@aldan.algebra.com>
In-Reply-To: <XFMail.20020801095611.jhb@FreeBSD.org>
References:  <XFMail.20020801095611.jhb@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Hello!

It seems, bsd.cpu.mk is needlessly careless when adding -march/-mcpu
to the CFLAGS, without checking if the flag(s) are already present
there. It relies on the poorly named/documented flags NO_CPU_CFLAGS and
NO_CPU_COPTFLAGS, which can be used to turn the addition off.

If one adds -march of his/her own to the CFLAGS explicitly, bsd.cpu.mk
will add another -- possibly conflicting setting.

The patch below easily prevents that, but jhb -- the most recent
to commit to the file -- thinks relying on the two flags above is
sufficient. I remain in disagreement, so here it is...

(The patch also adds pentium[34] settings, that the new gcc supports,
which jhb had no problems with. The difference between pentium2 and
pentiumpro (no mmx in the latter) should be handled there as well.)

Respectfully,

	-mi

Index: bsd.cpu.mk
===================================================================
RCS file: /home/ncvs/src/share/mk/bsd.cpu.mk,v
retrieving revision 1.15
diff -U2 -r1.15 bsd.cpu.mk
--- bsd.cpu.mk	2002/07/31 03:56:03	1.15
+++ bsd.cpu.mk	2002/08/01 15:09:35
@@ -11,5 +11,5 @@
 # may tune support for more advanced processors.
 
-.if !defined(CPUTYPE) || ${CPUTYPE} == ""
+.if (!defined(CPUTYPE) || ${CPUTYPE} == "") && ${CFLAGS:M-cpu=*} == ""
 . if ${MACHINE_ARCH} == "i386"
 _CPUCFLAGS = -mcpu=pentiumpro
@@ -48,5 +48,5 @@
 #	http://gcc.gnu.org/onlinedocs/gcc/RS-6000-and-PowerPC-Options.html
 
-. if ${MACHINE_ARCH} == "i386"
+. if ${MACHINE_ARCH} == "i386" && ${CFLAGS:M-march=*} == ""
 .  if ${CPUTYPE} == "k7"
 _CPUCFLAGS = -march=athlon
@@ -58,7 +58,7 @@
 _CPUCFLAGS = -march=pentium
 .  elif ${CPUTYPE} == "p4"
-_CPUCFLAGS = -march=pentiumpro
+_CPUCFLAGS = -march=pentium4
 .  elif ${CPUTYPE} == "p3"
-_CPUCFLAGS = -march=pentiumpro
+_CPUCFLAGS = -march=pentium3
 .  elif ${CPUTYPE} == "p2"
 _CPUCFLAGS = -march=pentiumpro
@@ -72,5 +72,5 @@
 _CPUCFLAGS = -march=i486
 .  endif
-. elif ${MACHINE_ARCH} == "alpha"
+. elif ${MACHINE_ARCH} == "alpha" && ${CFLAGS:M-mcpu=*} == ""
 .  if ${CPUTYPE} == "ev6"
 _CPUCFLAGS = -mcpu=ev6

-- 
	Как, Вы разве без шпаги пришли?

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200208011113.42669.mi%2Bmx>