summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.inc15
-rw-r--r--Makefile.libcompat10
-rw-r--r--share/mk/src.opts.mk3
3 files changed, 16 insertions, 2 deletions
diff --git a/Makefile.inc1 b/Makefile.inc1
index 0daa440..ab028a6 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -543,9 +543,12 @@ TARGET_ABI= gnueabi
.endif
.endif
.if defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc
-# GCC requires -isystem and -L when using a cross-compiler.
+# GCC requires -isystem and -L when using a cross-compiler. --sysroot
+# won't set header path and -L is used to ensure the base library path
+# is added before the port PREFIX library path.
XCFLAGS+= -isystem ${WORLDTMP}/usr/include -L${WORLDTMP}/usr/lib
# Force using libc++ for external GCC.
+# XXX: This should be checking MK_GNUCXX == no
XCXXFLAGS+= -isystem ${WORLDTMP}/usr/include/c++/v1 -std=c++11 \
-nostdinc++ -L${WORLDTMP}/../lib/libc++
.else
diff --git a/Makefile.libcompat b/Makefile.libcompat
index f0aafe6..4b923bb 100644
--- a/Makefile.libcompat
+++ b/Makefile.libcompat
@@ -72,13 +72,21 @@ 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.
+# GCC requires -isystem when using a cross-compiler and --sysroot. Note that
+# Makefile.inc1 only applies this with an external compiler but libcompat
+# always does since even in-tree GCC 4.2 needs this to override the built-in
+# sysroot path which --sysroot does not actually do for headers.
LIBCOMPATCFLAGS+= -isystem ${LIBCOMPATTMP}/usr/include
# Force using libc++ for external GCC.
+# XXX: This should be checking MK_GNUCXX == no
+.if ${MK_CROSS_COMPILER} == "no" || \
+ (${MK_CLANG_BOOTSTRAP} == "no" && ${MK_GCC_BOOTSTRAP} == "no")
LIBCOMPATCXXFLAGS+= -isystem ${LIBCOMPATTMP}/usr/include/c++/v1 -std=c++11 \
-nostdinc++ -L${LIBCOMPAT_OBJTREE}${.CURDIR}/lib/libc++
.endif
+.endif
# Yes, the flags are redundant.
LIBCOMPATWMAKEENV+= MAKEOBJDIRPREFIX=${LIBCOMPAT_OBJTREE} \
diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk
index e3ef419..790a466 100644
--- a/share/mk/src.opts.mk
+++ b/share/mk/src.opts.mk
@@ -419,6 +419,9 @@ MK_LLDB:= no
# gcc 4.8 and newer supports libc++, so suppress gnuc++ in that case.
# while in theory we could build it with that, we don't want to do
# that since it creates too much confusion for too little gain.
+# XXX: This is incomplete and needs X_COMPILER_TYPE/VERSION checks too
+# to prevent Makefile.inc1 from bootstrapping unneeded dependencies
+# and to support 'make delete-old' when supplying an external toolchain.
.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 40800
MK_GNUCXX:=no
MK_GCC:=no
OpenPOWER on IntegriCloud