sys.mk: Add _GLIBCXX_USE_CXX11_ABI=0 definition in some cases
authorJohn Marino <draco@marino.st>
Mon, 16 Feb 2015 13:18:38 +0000 (14:18 +0100)
committerJohn Marino <draco@marino.st>
Mon, 16 Feb 2015 14:21:10 +0000 (15:21 +0100)
When the world is built by gcc47, and sys.mk isn't being used to build
the system, the CXXFLAGS will have -D_GLIBCXX_USE_CXX11_ABI=0 added to
it to force gcc50 to use the c++ ABI that gcc47 used when building the
system libraries.

If the world was built with gcc50, the system libraries were built
against the new c++ ABI so this flag would not be added in that case.

Due to new SYSBUILD definition in Makefile.inc1, this flag is never
added during the build of the world.

Makefile.inc1
share/mk/sys.mk

index b6f793e..c9d58d6 100644 (file)
@@ -263,7 +263,7 @@ BMAKEENV=   MAKEOBJDIRPREFIX=${BTOOLSDEST} \
 
 BMAKE=         ${BMAKEENV} make -f Makefile.inc1 -DBOOTSTRAPPING \
                -DNOINFO -DNOMAN -DNOPIC -DNOPROFILE -DNOSHARED \
-               -DNO_WERROR -DNO_NLS
+               -DNO_WERROR -DNO_NLS -DSYSBUILD
 
 # build-tool stage
 #
@@ -274,7 +274,8 @@ TMAKEENV=   MAKEOBJDIRPREFIX=${BTOOLSDEST} \
                M4=${BTOOLSDEST}/usr/bin/m4 \
                INSTALL="sh ${.CURDIR}/tools/install.sh"
 
-TMAKE=         ${TMAKEENV} make -f Makefile.inc1 -DBOOTSTRAPPING -DNOSHARED
+TMAKE=         ${TMAKEENV} make -f Makefile.inc1 -DBOOTSTRAPPING \
+               -DNOSHARED -DSYSBUILD
 
 # cross-tool stage
 #
@@ -294,7 +295,7 @@ XMAKEENV=   MAKEOBJDIRPREFIX=${CTOOLSDEST} \
                PATH=${BTOOLSPATH}:${PATH}
 
 XMAKE=         ${XMAKEENV} make -f Makefile.inc1 -DNO_GDB \
-               -DBOOTSTRAPPING -DNOSHARED
+               -DBOOTSTRAPPING -DNOSHARED -DSYSBUILD
 
 # world stage, note the strict path and note that TOOLS_PREFIX is left
 # unset and USRDATA_PREFIX (which defaults to TOOLS_PREFIX) is set to empty,
@@ -321,13 +322,13 @@ WMAKEENV= ${CROSSENV} \
                M4=${BTOOLSDEST}/usr/bin/m4 \
                PATH=${STRICTTMPPATH}
 
-WMAKE=         ${WMAKEENV} make -f Makefile.inc1
+WMAKE=         ${WMAKEENV} make -f Makefile.inc1 -DSYSBUILD
 
 # install stage
 #
 IMAKEENV=      ${CROSSENV} \
                PATH=${STRICTTMPPATH}
-IMAKE=         ${IMAKEENV} make -f Makefile.inc1
+IMAKE=         ${IMAKEENV} make -f Makefile.inc1 -DSYSBUILD
 
 # kernel stage
 #
@@ -977,16 +978,16 @@ hierarchy:
 libraries:
        cd ${.CURDIR}; \
            HOST_CCVER=${HOST_CCVER} CCVER=gcc47 \
-               make -f Makefile.inc1 _startup_libs47;
+               make -f Makefile.inc1 _startup_libs47 -DSYSBUILD;
 .if !defined(NO_GCC50)
        cd ${.CURDIR}; \
            HOST_CCVER=${HOST_CCVER} CCVER=gcc50 \
-               make -f Makefile.inc1 _startup_libs50;
+               make -f Makefile.inc1 _startup_libs50 -DSYSBUILD;
 .endif
        cd ${.CURDIR}; \
-           make -f Makefile.inc1 _startup_libs; \
-           make -f Makefile.inc1 _prebuild_libs; \
-           make -f Makefile.inc1 _generic_libs;
+           make -f Makefile.inc1 _startup_libs -DSYSBUILD; \
+           make -f Makefile.inc1 _prebuild_libs -DSYSBUILD; \
+           make -f Makefile.inc1 _generic_libs -DSYSBUILD;
        touch ${WORLDDEST}/.libraries_done
 
 # These dependencies are not automatically generated:
@@ -1088,25 +1089,25 @@ par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
 # world build environment.
 #
 wmake:
-       @echo '${WMAKEENV} make ${WMAKE_ARGS}'
+       @echo '${WMAKEENV} make ${WMAKE_ARGS} -DSYSBUILD'
 
 wmakeenv:
        @echo '${WMAKEENV} /bin/sh'
 
 bmake:
-       @echo '${BMAKEENV} make ${BMAKE_ARGS}'
+       @echo '${BMAKEENV} make ${BMAKE_ARGS} -DSYSBUILD'
 
 bmakeenv:
        @echo '${BMAKEENV} /bin/sh'
 
 tmake:
-       @echo '${TMAKEENV} make ${TMAKE_ARGS}'
+       @echo '${TMAKEENV} make ${TMAKE_ARGS} -DSYSBUILD'
 
 tmakeenv:
        @echo '${TMAKEENV} /bin/sh'
 
 xmake:
-       @echo '${XMAKEENV} make ${XMAKE_ARGS}'
+       @echo '${XMAKEENV} make ${XMAKE_ARGS} -DSYSBUILD'
 
 xmakeenv:
        @echo '${XMAKEENV} /bin/sh'
index dd434ec..0025fde 100644 (file)
@@ -60,6 +60,9 @@ CXX_LINK      ?=      ${CXX}
 NXCXX          ?=      ${NXENV} ${CXX}
 NXCXX_LINK     ?=      ${NXENV} ${CXX_LINK}
 CXXFLAGS       ?=      ${CXXINCLUDES} ${CFLAGS:N-std=*:N-Wnested-externs:N-W*-prototypes:N-Wno-pointer-sign:N-Wold-style-definition}
+.if !defined(SYSBUILD) && ${.MAKE.BUILT.BY:Mgcc47}
+CXXFLAGS       +=      -D_GLIBCXX_USE_CXX11_ABI=0
+.endif
 
 CPP            ?=      cpp