1idf_component_register(SRCS "cxx_exception_stubs.cpp" 2 "cxx_guards.cpp" 3 # Make sure that pthread is in component list 4 PRIV_REQUIRES pthread) 5 6if(NOT CONFIG_CXX_EXCEPTIONS) 7 set(WRAP_FUNCTIONS 8 _Unwind_SetEnableExceptionFdeSorting 9 __register_frame_info_bases 10 __register_frame_info 11 __register_frame 12 __register_frame_info_table_bases 13 __register_frame_info_table 14 __register_frame_table 15 __deregister_frame_info_bases 16 __deregister_frame_info 17 _Unwind_Find_FDE 18 _Unwind_GetGR 19 _Unwind_GetCFA 20 _Unwind_GetIP 21 _Unwind_GetIPInfo 22 _Unwind_GetRegionStart 23 _Unwind_GetDataRelBase 24 _Unwind_GetTextRelBase 25 _Unwind_SetIP 26 _Unwind_SetGR 27 _Unwind_GetLanguageSpecificData 28 _Unwind_FindEnclosingFunction 29 _Unwind_Resume 30 _Unwind_RaiseException 31 _Unwind_DeleteException 32 _Unwind_ForcedUnwind 33 _Unwind_Resume_or_Rethrow 34 _Unwind_Backtrace 35 __cxa_call_unexpected 36 __gxx_personality_v0) 37 38 foreach(wrap ${WRAP_FUNCTIONS}) 39 target_link_libraries(${COMPONENT_LIB} INTERFACE "-Wl,--wrap=${wrap}") 40 endforeach() 41endif() 42 43target_link_libraries(${COMPONENT_LIB} PUBLIC stdc++ gcc) 44target_link_libraries(${COMPONENT_LIB} INTERFACE "-u __cxa_guard_dummy") 45 46# Force libpthread to appear later than libstdc++ in link line since libstdc++ depends on libpthread. 47# Furthermore, force libcxx to appear later than libgcc because some libgcc unwind code is wrapped, if C++ 48# exceptions are disabled. libcxx (this component) provides the unwind code wrappers. 49# This is to prevent linking of libgcc's unwind code which considerably increases the binary size. 50idf_component_get_property(pthread pthread COMPONENT_LIB) 51idf_component_get_property(cxx cxx COMPONENT_LIB) 52add_library(stdcpp_pthread INTERFACE) 53target_link_libraries(stdcpp_pthread INTERFACE stdc++ $<TARGET_FILE:${pthread}>) 54target_link_libraries(${COMPONENT_LIB} PUBLIC stdcpp_pthread) 55add_library(libgcc_cxx INTERFACE) 56target_link_libraries(libgcc_cxx INTERFACE gcc $<TARGET_FILE:${cxx}>) 57target_link_libraries(${COMPONENT_LIB} PUBLIC libgcc_cxx) 58 59if(NOT CONFIG_COMPILER_CXX_EXCEPTIONS) 60 target_link_libraries(${COMPONENT_LIB} INTERFACE "-u __cxx_fatal_exception") 61endif() 62