genode/base/lib/import/import-toolchain_stdcxx.mk
Norman Feske 9651974448 Add stdcxx-4.6.1 to libports, fix #339
This patch adds libstdc++ to libports. With the previous version of the
stdcxx library, the build system used the C++ standard library that
comes with the compiler. This mechanism was prone to inconsistencies of
types defined in the header files used at compile time of the tool chain
and the types provided by our libc. By building the C++ standard library
as part of the Genode build process, such inconsistencies cannot happen
anymore.

Note that the patch changes the meaning of the 'stdcxx' library for
users that happened to rely on 'stdcxx' for hybrid Linux/Genode
applications. For such uses, the original mechanism is still available,
in the renamed form of 'toolchain_stdcxx'.
2012-09-04 12:37:56 +02:00

29 lines
1017 B
Makefile

#
# Support for using standard C++ headers for Genode programs
#
#
# Add the location of the compiler's C++ headers to search path
#
# We add all header locations that have "c++" or "include-fixed" to the search
# path. The 'c++' subdirectory contains the actual standard C++ headers.
# However, for using them together with Boost, we need to access 'limits.h' as
# provided within the 'include-fixed' location.
#
INC_DIR += $(shell echo "int main() {return 0;}" |\
LANG=C $(CXX) -x c++ -v -E - 2>&1 |\
sed '/^\#include <\.\.\.> search starts here:/,/^End of search list/!d' |\
grep "c++")
# avoid multiple definition of type _mbstate_t
CC_CXX_OPT += -D_GLIBCXX_HAVE_MBSTATE_T
#
# Link libstdc++ that comes with the tool chain
#
ifneq ($(filter hardening_tool_chain, $(SPECS)),)
EXT_OBJECTS += $(shell $(CUSTOM_CXX_LIB) $(CC_MARCH) -print-file-name=libstdc++.so)
else
EXT_OBJECTS += $(shell $(CUSTOM_CXX_LIB) $(CC_MARCH) -print-file-name=libstdc++.a)
endif