From 259eb49bd722586904361b7652b5ad96ede682b5 Mon Sep 17 00:00:00 2001 From: zrj Date: Wed, 8 Feb 2017 18:40:21 +0200 Subject: [PATCH] Prevent implicit -std=* passing from NXCFLAGS to NXCXXFLAGS. C and c++ standards are not cross compatible, this is a major issue with clang import into the base that explictly requires at least the -std=c++11 standard. It gets complicated because even tablegen utilities used as buildtools depend explictly on c++11. This implies that we no longer can avoid libstdc++ usage in hostlib/hostprog infrastructure. While there, explcitly filter out -flto options from host native tools FLAGS and add a missing rule to allow generating host native c++ utilities for the use in buildworld. --- share/mk/sys.mk | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/share/mk/sys.mk b/share/mk/sys.mk index 934dbbf677..c5c8419565 100644 --- a/share/mk/sys.mk +++ b/share/mk/sys.mk @@ -98,8 +98,8 @@ LFLAGS ?= LD ?= ld NXLD ?= ${NXENV} ${LD} LDFLAGS ?= -NXCFLAGS ?= ${CFLAGS:N-mtune*:N-mcpu*:N-march*} -NXCXXFLAGS ?= ${CFLAGS:N-mtune*:N-mcpu*:N-march*} +NXCFLAGS ?= ${CFLAGS:N-mtune*:N-mcpu*:N-march*:N-flto} +NXCXXFLAGS ?= ${CFLAGS:N-mtune*:N-mcpu*:N-march*:N-flto:N-std=*} NXLDLIBS ?= ${LDLIBS} NXLDFLAGS ?= -static ${LDFLAGS} @@ -257,7 +257,10 @@ MACHINE_PLATFORM!=sysctl -n hw.platform # .no == native object file, for helper code when cross building. # .c.no: - ${NXCC} ${_${.IMPSRC:T}_FLAGS} ${NXCFLAGS} -c ${.IMPSRC} -o ${.TARGET} + ${NXCC} ${_${.IMPSRC:T}_FLAGS} ${NXCFLAGS:N-flto} -c ${.IMPSRC} -o ${.TARGET} + +.cc.no .C.no .cpp.no .cxx.no: + ${NXCXX} ${_${.IMPSRC:T}_FLAGS} ${NXCXXFLAGS:N-flto} -c ${.IMPSRC} -o ${.TARGET} .y.no: ${YACC} ${YFLAGS} ${.IMPSRC} -- 2.11.4.GIT