Add LIB_CXX so that C++ libraries will use CXX to link.

This fixes C++ libraries not implicitly linking in libc++.  This is
generally not an issue because the final linking with the compiled binary
will involve CXX via PROG_CXX or other means.  It is however
inconsistent with libraries implicitly linking in libc and problematic
for trying to build libraries with '-z defs' to ensure all direct
dependencies are linked in.

libatf-c++ is currently the only consumer of this new feature.

Differential Revision:	https://reviews.freebsd.org/D2039
Reviewed by:	imp
Discussed with:	bapt
MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
This commit is contained in:
Bryan Drewery 2015-03-17 15:16:36 +00:00
parent 7e8ffa29c7
commit 215d02b78c
3 changed files with 13 additions and 2 deletions

View File

@ -1685,6 +1685,10 @@ gnu/lib/libstdc++__L: lib/msun__L
gnu/lib/libsupc++__L: gnu/lib/libstdc++__L gnu/lib/libsupc++__L: gnu/lib/libstdc++__L
.endif .endif
.if ${MK_LIBCPLUSPLUS} != "no"
_prebuild_libs+= lib/libc++
.endif
lib/libgeom__L: lib/libexpat__L lib/libgeom__L: lib/libexpat__L
.if ${MK_LIBTHR} != "no" .if ${MK_LIBTHR} != "no"

View File

@ -28,7 +28,7 @@
.include <src.opts.mk> .include <src.opts.mk>
.include <bsd.init.mk> .include <bsd.init.mk>
LIB= atf-c++ LIB_CXX= atf-c++
PRIVATELIB= true PRIVATELIB= true
SHLIB_MAJOR= 2 SHLIB_MAJOR= 2

View File

@ -4,6 +4,13 @@
.include <bsd.init.mk> .include <bsd.init.mk>
.if defined(LIB_CXX)
LIB= ${LIB_CXX}
_LD= ${CXX}
.else
_LD= ${CC}
.endif
# Set up the variables controlling shared libraries. After this section, # Set up the variables controlling shared libraries. After this section,
# SHLIB_NAME will be defined only if we are to create a shared library. # SHLIB_NAME will be defined only if we are to create a shared library.
# SHLIB_LINK will be defined only if we are to create a link to it. # SHLIB_LINK will be defined only if we are to create a link to it.
@ -217,7 +224,7 @@ ${SHLIB_NAME_FULL}: ${SOBJS}
.if defined(SHLIB_LINK) .if defined(SHLIB_LINK)
@${INSTALL_SYMLINK} ${SHLIB_NAME} ${SHLIB_LINK} @${INSTALL_SYMLINK} ${SHLIB_NAME} ${SHLIB_LINK}
.endif .endif
${CC} ${LDFLAGS} ${SSP_CFLAGS} ${SOLINKOPTS} \ ${_LD} ${LDFLAGS} ${SSP_CFLAGS} ${SOLINKOPTS} \
-o ${.TARGET} -Wl,-soname,${SONAME} \ -o ${.TARGET} -Wl,-soname,${SONAME} \
`NM='${NM}' lorder ${SOBJS} | tsort -q` ${LDADD} `NM='${NM}' lorder ${SOBJS} | tsort -q` ${LDADD}
.if ${MK_CTF} != "no" .if ${MK_CTF} != "no"