svn commit: r300943 - in head: . lib/libc++ lib/libcxxrt share/mk

Bryan Drewery bdrewery at FreeBSD.org
Sun May 29 06:20:17 UTC 2016


Author: bdrewery
Date: Sun May 29 06:20:15 2016
New Revision: 300943
URL: https://svnweb.freebsd.org/changeset/base/300943

Log:
  GCC External: Revert r300886, r300904, r300917, r300918
  
  The fix in r300873 is mostly enough.  A fix for lib32 will be
  committed.separately.

Modified:
  head/Makefile.inc1
  head/Makefile.libcompat
  head/lib/libc++/Makefile
  head/lib/libcxxrt/Makefile
  head/share/mk/bsd.compiler.mk
  head/share/mk/bsd.sys.mk

Modified: head/Makefile.inc1
==============================================================================
--- head/Makefile.inc1	Sun May 29 06:01:18 2016	(r300942)
+++ head/Makefile.inc1	Sun May 29 06:20:15 2016	(r300943)
@@ -527,7 +527,13 @@ TARGET_ABI=	gnueabihf
 TARGET_ABI=	gnueabi
 .endif
 .endif
-.if defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == "clang"
+.if defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc
+# GCC requires -isystem and -L when using a cross-compiler.
+XCFLAGS+=	-isystem ${WORLDTMP}/usr/include -L${WORLDTMP}/usr/lib
+# Force using libc++ for external GCC.
+XCXXFLAGS+=	-isystem ${WORLDTMP}/usr/include/c++/v1 -std=c++11 \
+		-nostdinc++ -L${WORLDTMP}/../lib/libc++
+.else
 TARGET_ABI?=	unknown
 TARGET_TRIPLE?=	${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd11.0
 XCFLAGS+=	-target ${TARGET_TRIPLE}

Modified: head/Makefile.libcompat
==============================================================================
--- head/Makefile.libcompat	Sun May 29 06:01:18 2016	(r300942)
+++ head/Makefile.libcompat	Sun May 29 06:20:15 2016	(r300943)
@@ -17,7 +17,7 @@ LIB32CPUFLAGS=	-march=${TARGET_CPUTYPE}
 .endif
 LIB32WMAKEENV=	MACHINE=i386 MACHINE_ARCH=i386 \
 		MACHINE_CPU="i686 mmx sse sse2"
-LIB32WMAKEENV+=	\
+LIB32WMAKEFLAGS=	\
 		AS="${XAS} --32" \
 		LD="${XLD} -m elf_i386_fbsd -Y P,${LIBCOMPATTMP}/usr/lib32" \
 		OBJCOPY="${XOBJCOPY}"
@@ -29,7 +29,7 @@ LIB32CPUFLAGS=	-mcpu=powerpc
 LIB32CPUFLAGS=	-mcpu=${TARGET_CPUTYPE}
 .endif
 LIB32WMAKEENV=	MACHINE=powerpc MACHINE_ARCH=powerpc
-LIB32WMAKEENV+=	\
+LIB32WMAKEFLAGS=	\
 		LD="${XLD} -m elf32ppc_fbsd" \
 		OBJCOPY="${XOBJCOPY}"
 .endif
@@ -72,6 +72,13 @@ LIBCOMPATCFLAGS+=	${LIBCOMPATCPUFLAGS} \
 # -B is needed to find /usr/lib32/crti.o for GCC and /usr/libsoft/crti.o for
 # Clang/GCC.
 LIBCOMPATCFLAGS+=	-B${LIBCOMPATTMP}/usr/lib${libcompat}
+.if defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc
+# GCC requires -isystem when using a cross-compiler.
+LIBCOMPATCFLAGS+=	-isystem ${LIBCOMPATTMP}/usr/include
+# Force using libc++ for external GCC.
+LIBCOMPATCXXFLAGS+=	-isystem ${LIBCOMPATTMP}/usr/include/c++/v1 -std=c++11 \
+			-nostdinc++ -L${LIBCOMPAT_OBJTREE}${.CURDIR}/lib/libc++
+.endif
 
 # Yes, the flags are redundant.
 LIBCOMPATWMAKEENV+= MAKEOBJDIRPREFIX=${LIBCOMPAT_OBJTREE} \
@@ -84,11 +91,9 @@ LIBCOMPATWMAKEENV+= MAKEOBJDIRPREFIX=${L
 # Don't rebuild build-tools targets during normal build.
 LIBCOMPATWMAKEENV+=	BUILD_TOOLS_META=.NOMETA_CMP
 .endif
-LIBCOMPATWMAKEENV+= \
-		CC="${XCC} ${LIBCOMPATCFLAGS}" \
+LIBCOMPATWMAKEFLAGS+= CC="${XCC} ${LIBCOMPATCFLAGS}" \
 		CXX="${XCXX} ${LIBCOMPATCFLAGS} ${LIBCOMPATCXXFLAGS}" \
-		CPP="${XCPP} ${LIBCOMPATCFLAGS}"
-LIBCOMPATWMAKEFLAGS+= \
+		CPP="${XCPP} ${LIBCOMPATCFLAGS}" \
 		DESTDIR=${LIBCOMPATTMP} \
 		-DNO_CPU_CFLAGS \
 		MK_CTF=no \

Modified: head/lib/libc++/Makefile
==============================================================================
--- head/lib/libc++/Makefile	Sun May 29 06:01:18 2016	(r300942)
+++ head/lib/libc++/Makefile	Sun May 29 06:20:15 2016	(r300943)
@@ -63,7 +63,7 @@ cxxrt_${_S}: ${_LIBCXXRTDIR}/${_S} .NOME
 .endfor
 
 WARNS=		0
-CFLAGS+=	-I${HDRDIR} -I${_LIBCXXRTDIR} -nostdinc++ -nostdlib -DLIBCXXRT
+CFLAGS+=	-isystem ${HDRDIR} -isystem ${_LIBCXXRTDIR} -nostdinc++ -nostdlib -DLIBCXXRT
 .if empty(CXXFLAGS:M-std=*)
 CXXFLAGS+=	-std=c++11
 .endif

Modified: head/lib/libcxxrt/Makefile
==============================================================================
--- head/lib/libcxxrt/Makefile	Sun May 29 06:01:18 2016	(r300942)
+++ head/lib/libcxxrt/Makefile	Sun May 29 06:20:15 2016	(r300943)
@@ -21,7 +21,7 @@ SRCS+=		libelftc_dem_gnu3.c\
 		guard.cc
 
 WARNS=		0
-CFLAGS+=	-I${SRCDIR} -nostdinc++
+CFLAGS+=	-isystem ${SRCDIR} -nostdinc++
 .if empty(CXXFLAGS:M-std=*)
 CXXFLAGS+=	-std=c++11
 .endif

Modified: head/share/mk/bsd.compiler.mk
==============================================================================
--- head/share/mk/bsd.compiler.mk	Sun May 29 06:01:18 2016	(r300942)
+++ head/share/mk/bsd.compiler.mk	Sun May 29 06:20:15 2016	(r300943)
@@ -108,10 +108,8 @@ ccache-print-options: .PHONY
 # CC and COMPILER_* settings here.
 _exported_vars=	${X_}COMPILER_TYPE ${X_}COMPILER_VERSION \
 		${X_}COMPILER_FREEBSD_VERSION
-# Handle importing cached vars, but not for X_ vars.
-.if ${X_} == ""
-_cc_hash=	${${cc}}${MACHINE}${PATH}
-_cc_hash:=	${_cc_hash:hash}
+${X_}_cc_hash=	${${cc}}${MACHINE}${PATH}
+${X_}_cc_hash:=	${${X_}_cc_hash:hash}
 # Only import if none of the vars are set somehow else.
 _can_export=	yes
 .for var in ${_exported_vars}
@@ -121,12 +119,11 @@ _can_export=	no
 .endfor
 .if ${_can_export} == yes
 .for var in ${_exported_vars}
-.if defined(${var}.${_cc_hash})
-${var}=	${${var}.${_cc_hash}}
+.if defined(${var}.${${X_}_cc_hash})
+${var}=	${${var}.${${X_}_cc_hash}}
 .endif
 .endfor
 .endif
-.endif	# ${X_} == ""
 
 .if ${cc} == "CC" || (${cc} == "XCC" && ${XCC} != ${CC})
 .if ${MACHINE} == "common"
@@ -186,14 +183,9 @@ X_COMPILER_FEATURES=	${COMPILER_FEATURES
 # Export the values so sub-makes don't have to look them up again, using the
 # hash key computed above.
 .for var in ${_exported_vars}
-.if ${X_} == ""
-${var}.${_cc_hash}:=	${${var}}
-.export-env ${var}.${_cc_hash}
-.undef ${var}.${_cc_hash}
-.else
-# Always export X_ vars.
-.export-env ${var}
-.endif
+${var}.${${X_}_cc_hash}:=	${${var}}
+.export-env ${var}.${${X_}_cc_hash}
+.undef ${var}.${${X_}_cc_hash}
 .endfor
 
 .endif	# ${cc} == "CC" || !empty(XCC)

Modified: head/share/mk/bsd.sys.mk
==============================================================================
--- head/share/mk/bsd.sys.mk	Sun May 29 06:01:18 2016	(r300942)
+++ head/share/mk/bsd.sys.mk	Sun May 29 06:20:15 2016	(r300943)
@@ -178,36 +178,6 @@ ACFLAGS+=	${ACFLAGS.${.IMPSRC:T}}
 CFLAGS+=	${CFLAGS.${.IMPSRC:T}}
 CXXFLAGS+=	${CXXFLAGS.${.IMPSRC:T}}
 
-# Special handling for external GCC.
-.if defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == "gcc"
-# GCC's --sysroot support for a cross-compiler without a default
-# TARGET_SYSTEM_ROOT does not add sysroot/usr/include in or the C++
-# include path of sysroot/usr/include/c++/v1.  They need to be added in
-# when not using -nostdinc/-nostdinc++.  This is not a problem with a
-# non-cross-compiler external GCC or the in-tree cross-compiler GCC which
-# has a default TARGET_SYSTEM_ROOT.
-.if ${CC:M--sysroot=*} || ${CFLAGS:M--sysroot=*}
-.if ${CFLAGS:M-nostdinc} == ""
-CFLAGS+=	-isystem =/usr/include
-.endif
-# We want to force building the system with our in-tree libc++.  Note that
-# this also requires a symlink in OBJDIR/lib/libc++/libstdc++.so to
-# sysroot/usr/lib/libc++.so.
-.if ${CXXFLAGS:M-nostdinc++} == "" && ${CXXFLAGS:M-nostdlib} == ""
-CXXFLAGS+=	-std=c++11 \
-		-nostdinc++
-# Need to ensure this path comes before the above -isystem =/usr/include.
-# CXXFLAGS is CFLAGS with extra added in, so there's no way to fix the
-# ordering otherwise.
-CXX+=		-isystem =/usr/include/c++/v1
-LDFLAGS+=	-L${OBJTOP}/lib/libc++
-.endif
-# Add in sysroot/usr/lib to ensure that it comes before /usr/local/lib
-# from ports compilers.
-LDFLAGS+=	-L=/usr/lib
-.endif	# --sysroot
-.endif	# X_COMPILER_TYPE == gcc
-
 .if defined(SRCTOP)
 # Prevent rebuilding during install to support read-only objdirs.
 .if !make(all) && make(install) && empty(.MAKE.MODE:Mmeta)


More information about the svn-src-head mailing list