From owner-svn-src-all@freebsd.org Fri May 27 23:03:46 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2C6A1B4DDE0; Fri, 27 May 2016 23:03:46 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E277E125E; Fri, 27 May 2016 23:03:45 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4RN3jcV099115; Fri, 27 May 2016 23:03:45 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4RN3iOR099110; Fri, 27 May 2016 23:03:44 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201605272303.u4RN3iOR099110@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Fri, 27 May 2016 23:03:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300886 - in head: . lib/libc++ lib/libcxxrt share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 May 2016 23:03:46 -0000 Author: bdrewery Date: Fri May 27 23:03:44 2016 New Revision: 300886 URL: https://svnweb.freebsd.org/changeset/base/300886 Log: Move external GCC compiler hacks to bsd.sys.mk. This allows respecting -nostdinc, -nostdinc++ and -nostdlib before making the decision to add in -isystem, etc. The -isystem flags are problematic for building lib/libc++ and lib/libcxxrt which wants to only use its own headers. More information the need of these flags can be found at https://gcc.gnu.org/ml/gcc/2016-03/msg00219.html This also reverts r300873. Sponsored by: EMC / Isilon Storage Division Modified: head/Makefile.inc1 head/Makefile.libcompat head/lib/libc++/Makefile head/lib/libcxxrt/Makefile head/share/mk/bsd.sys.mk Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Fri May 27 23:03:28 2016 (r300885) +++ head/Makefile.inc1 Fri May 27 23:03:44 2016 (r300886) @@ -527,19 +527,12 @@ TARGET_ABI= gnueabihf TARGET_ABI= gnueabi .endif .endif -.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 +.if defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == "clang" TARGET_ABI?= unknown TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd11.0 XCFLAGS+= -target ${TARGET_TRIPLE} .endif XCFLAGS+= --sysroot=${WORLDTMP} -.else .endif # ${MK_CROSS_COMPILER} == "no" .if !empty(BFLAGS) Modified: head/Makefile.libcompat ============================================================================== --- head/Makefile.libcompat Fri May 27 23:03:28 2016 (r300885) +++ head/Makefile.libcompat Fri May 27 23:03:44 2016 (r300886) @@ -72,13 +72,6 @@ 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} \ Modified: head/lib/libc++/Makefile ============================================================================== --- head/lib/libc++/Makefile Fri May 27 23:03:28 2016 (r300885) +++ head/lib/libc++/Makefile Fri May 27 23:03:44 2016 (r300886) @@ -63,7 +63,7 @@ cxxrt_${_S}: ${_LIBCXXRTDIR}/${_S} .NOME .endfor WARNS= 0 -CFLAGS+= -isystem ${HDRDIR} -isystem ${_LIBCXXRTDIR} -nostdinc++ -nostdlib -DLIBCXXRT +CFLAGS+= -I${HDRDIR} -I${_LIBCXXRTDIR} -nostdinc++ -nostdlib -DLIBCXXRT .if empty(CXXFLAGS:M-std=*) CXXFLAGS+= -std=c++11 .endif Modified: head/lib/libcxxrt/Makefile ============================================================================== --- head/lib/libcxxrt/Makefile Fri May 27 23:03:28 2016 (r300885) +++ head/lib/libcxxrt/Makefile Fri May 27 23:03:44 2016 (r300886) @@ -21,7 +21,7 @@ SRCS+= libelftc_dem_gnu3.c\ guard.cc WARNS= 0 -CFLAGS+= -isystem ${SRCDIR} -nostdinc++ +CFLAGS+= -I${SRCDIR} -nostdinc++ .if empty(CXXFLAGS:M-std=*) CXXFLAGS+= -std=c++11 .endif Modified: head/share/mk/bsd.sys.mk ============================================================================== --- head/share/mk/bsd.sys.mk Fri May 27 23:03:28 2016 (r300885) +++ head/share/mk/bsd.sys.mk Fri May 27 23:03:44 2016 (r300886) @@ -178,6 +178,32 @@ 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 +# Add in sysroot/usr/lib to ensure that it comes before /usr/local/lib +# from ports compilers. +LDFLAGS+= -L=/usr/lib +# 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++ -isystem =/usr/include/c++/v1 +LDFLAGS+= -L${OBJTOP}/lib/libc++ +.endif +.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)