libcxx: Disable dynamic type checking when enabling libcxxabi

It results in a recursive call, cxxabiv1::__dynamic_case -> is_equal -> __ubsan::checkDynamic -> cxxabiv1::__dynamic_case

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
This commit is contained in:
yinshengkai 2024-05-28 20:18:18 +08:00 committed by Xiang Xiao
parent 2af7037fa1
commit b721f2c84e
2 changed files with 12 additions and 0 deletions

View file

@ -96,6 +96,10 @@ endforeach()
# RTTI is required for building the libcxxabi library
target_compile_options(libcxxabi PRIVATE -frtti)
if(CONFIG_SIM_UBSAN OR CONFIG_MM_UBSAN)
target_compile_options(libcxxabi PRIVATE -fno-sanitize=vptr)
endif()
target_sources(libcxxabi PRIVATE ${TARGET_SRCS})
target_compile_options(libcxxabi PRIVATE -frtti)
target_include_directories(

View file

@ -47,6 +47,14 @@ endif
ifeq ($(CONFIG_LIBCXXABI), y)
CXXFLAGS += ${DEFINE_PREFIX}LIBCXX_BUILDING_LIBCXXABI
CXXFLAGS += -I $(TOPDIR)/libs/libxx/libcxxabi/include
# Disable dynamic type checking when enabling libcxxabi
# It results in a recursive call:
# cxxabiv1::__dynamic_case -> is_equal -> __ubsan::checkDynamic -> cxxabiv1::__dynamic_case
ifneq ($(CONFIG_SIM_UBSAN)${CONFIG_MM_UBSAN},)
CXXFLAGS += -fno-sanitize=vptr
endif
endif
# C++ABI files