Date: Sun, 7 Jul 2013 16:18:54 GMT
From: Norikatsu Shigemura <nork@FreeBSD.org>
To: freebsd-gnats-submit@FreeBSD.org
Subject: misc/180365: [bsd.cpu.mk] Not attach ${_CPUCFLAGS} to CXXFLAGS
Message-ID: <201307071618.r67GIs1D040407@oldred.freebsd.org>
Resent-Message-ID: <201307071620.r67GK0P1029361@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 180365
>Category: misc
>Synopsis: [bsd.cpu.mk] Not attach ${_CPUCFLAGS} to CXXFLAGS
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Sun Jul 07 16:20:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator: Norikatsu Shigemura
>Release: FreeBSD/amd64 10.0-CURRENT
>Organization:
Personal
>Environment:
FreeBSD pelsia.ninth-nine.com 10.0-CURRENT FreeBSD 10.0-CURRENT #1: Sun Jul 7 20:45:05 JST 2013 nork@pelsia.ninth-nine.com:/usr/obj/usr/src/sys/PELSIA amd64
>Description:
In share/mk/bsd.cpu.mk, ${_CPUCFLAGS} is added to CFLAGS.
But CXXFLAGS doesn't. If CXXFLAGS doesn't set, CXXFLAGS=${CFLAGS}.
So we don't almost notice thus issue.
BTW, ${_CPUCFLAGS} should be added to CXXFLAGS,
because C binaries and C++ binaries are combined multiple -mcpu=XXXX.
Even if thus thing almost no problem, but it's wrong for optimization.
>How-To-Repeat:
$ cd /usr/src
$ make -VCFLAGS -VCXXFLAGS
-O2 -pipe -march=corei7
-O2 -pipe -march=corei7
$ env CFLAGS="-O2" CXXFLAGS="-O2" make -VCFLAGS -VCXXFLAGS
-O2 -march=corei7
-O2
$ env CFLAGS="-O2" make -VCFLAGS -VCXXFLAGS
-O2 -march=corei7
-O2 -march=corei7
$ cd /usr/ports/lang/perl5.16
$ make -VCFLAGS -VCXXFLAGS
-O2 -pipe -march=corei7 -fno-strict-aliasing
-O2 -pipe -march=corei7 -fno-strict-aliasing
$ CFLAGS="-O2" CXXFLAGS="-O2" make -VCFLAGS -VCXXFLAGS
-O2 -march=corei7 -fno-strict-aliasing
-O2
>Fix:
Index: share/mk/bsd.cpu.mk
===================================================================
--- share/mk/bsd.cpu.mk (revision 252953)
+++ share/mk/bsd.cpu.mk (working copy)
@@ -259,4 +259,5 @@
.if !defined(NO_CPU_CFLAGS)
CFLAGS += ${_CPUCFLAGS}
+CXXFLAGS += ${_CPUCFLAGS}
.endif
>Release-Note:
>Audit-Trail:
>Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201307071618.r67GIs1D040407>
