2015-09-04 12:01:43 +00:00
|
|
|
CXX_SRC_CC += misc.cc new_delete.cc malloc_free.cc exception.cc guard.cc
|
2015-06-15 12:53:15 +00:00
|
|
|
# We need the libsupc++ include directory
|
|
|
|
STDINC = yes
|
|
|
|
|
2011-12-22 15:19:25 +00:00
|
|
|
vpath %.cc $(BASE_DIR)/src/base/cxx
|
2015-09-04 12:01:43 +00:00
|
|
|
vpath %.c $(BASE_DIR)/src/base/cxx
|
2011-12-22 15:19:25 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Here we define all symbols we want to hide in libsupc++ and libgcc_eh
|
|
|
|
#
|
|
|
|
LIBC_SYMBOLS += malloc free calloc realloc \
|
|
|
|
abort fputc fputs fwrite \
|
|
|
|
stderr strcat strcpy strlen \
|
|
|
|
memcmp strncmp strcmp sprintf \
|
|
|
|
__stderrp
|
|
|
|
|
|
|
|
#
|
|
|
|
# Symbols we wrap (see unwind.cc)
|
|
|
|
#
|
2012-07-10 21:03:48 +00:00
|
|
|
EH_SYMBOLS = _Unwind_Resume _Unwind_Complete _Unwind_DeleteException
|
2011-12-22 15:19:25 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Additional functions for ARM
|
|
|
|
#
|
|
|
|
EH_SYMBOLS += __aeabi_unwind_cpp_pr0 __aeabi_unwind_cpp_pr1
|
|
|
|
|
|
|
|
#
|
|
|
|
# Take the right system libraries
|
|
|
|
#
|
|
|
|
# Normally, we never include build-system-internal files from library-
|
|
|
|
# description files. For building the 'cxx' library, however, we need the
|
|
|
|
# information about the used 'gcc' for resolving the location of the C++
|
|
|
|
# support libraries. This definition is performed by 'mk/lib.mk' after
|
|
|
|
# including this library description file. Hence, we need to manually
|
|
|
|
# include 'global.mk' here.
|
|
|
|
#
|
|
|
|
include $(BASE_DIR)/mk/global.mk
|
|
|
|
|
|
|
|
LIBCXX_GCC = $(shell $(CUSTOM_CXX_LIB) $(CC_MARCH) -print-file-name=libsupc++.a) \
|
|
|
|
$(shell $(CUSTOM_CXX_LIB) $(CC_MARCH) -print-file-name=libgcc_eh.a || true)
|
|
|
|
|
|
|
|
#
|
|
|
|
# Dummy target used by the build system
|
|
|
|
#
|
|
|
|
SRC_S = supc++.o
|
2015-09-04 12:01:43 +00:00
|
|
|
SRC_C = unwind.o
|
2011-12-22 15:19:25 +00:00
|
|
|
CXX_SRC = $(sort $(CXX_SRC_CC))
|
|
|
|
CXX_OBJECTS = $(addsuffix .o,$(basename $(CXX_SRC)))
|
|
|
|
LOCAL_SYMBOLS = $(patsubst %,--localize-symbol=%,$(LIBC_SYMBOLS))
|
2015-09-04 12:01:43 +00:00
|
|
|
REDEF_SYMBOLS = $(foreach S, $(EH_SYMBOLS), --redefine-sym $(S)=_cxx_$(S))
|
2011-12-22 15:19:25 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Prevent symbols of the gcc support libs from being discarded during 'ld -r'
|
|
|
|
#
|
|
|
|
KEEP_SYMBOLS += __cxa_guard_acquire
|
|
|
|
KEEP_SYMBOLS += __dynamic_cast
|
2015-05-13 10:33:21 +00:00
|
|
|
KEEP_SYMBOLS += __cxa_throw_bad_array_new_length
|
2015-06-15 12:53:15 +00:00
|
|
|
KEEP_SYMBOLS += __cxa_current_exception_type
|
2011-12-22 15:19:25 +00:00
|
|
|
KEEP_SYMBOLS += _ZTVN10__cxxabiv116__enum_type_infoE
|
|
|
|
KEEP_SYMBOLS += _ZN10__cxxabiv121__vmi_class_type_infoD0Ev
|
|
|
|
KEEP_SYMBOLS += _ZTVN10__cxxabiv119__pointer_type_infoE
|
|
|
|
KEEP_SYMBOLS += _ZTSN10__cxxabiv120__function_type_infoE
|
|
|
|
|
2013-04-26 11:16:42 +00:00
|
|
|
#
|
|
|
|
# Include dependency files for the corresponding object files except
|
|
|
|
# when cleaning.
|
|
|
|
#
|
|
|
|
# Normally, the inclusion of dependency files is handled by 'generic.mk'.
|
|
|
|
# However, the mechanism in 'generic.mk' considers only the dependencies
|
|
|
|
# for the compilation units contained in the 'OBJECTS' variable. For building
|
|
|
|
# the cxx library, we rely on the 'CXX_OBJECTS' variable instead. So we need to
|
|
|
|
# include the dependenies manually.
|
|
|
|
#
|
|
|
|
ifneq ($(filter-out $(MAKECMDGOALS),clean),)
|
|
|
|
-include $(CXX_OBJECTS:.o=.d)
|
|
|
|
endif
|
|
|
|
|
2011-12-22 15:19:25 +00:00
|
|
|
#
|
|
|
|
# Rule to link all libc definitions and libsupc++ libraries
|
|
|
|
# and to hide after that the exported libc symbols
|
|
|
|
#
|
|
|
|
$(SRC_S): $(CXX_OBJECTS)
|
|
|
|
$(MSG_MERGE)$@
|
|
|
|
$(VERBOSE)$(LD) $(LD_MARCH) $(addprefix -u ,$(KEEP_SYMBOLS)) -r $(CXX_OBJECTS) $(LIBCXX_GCC) -o $@.tmp
|
|
|
|
$(MSG_CONVERT)$@
|
|
|
|
$(VERBOSE)$(OBJCOPY) $(LOCAL_SYMBOLS) $(REDEF_SYMBOLS) $@.tmp $@
|
|
|
|
$(VERBOSE)$(RM) $@.tmp
|