fix(cxx): use __cxa_throw() stub in case exceptions disabled

Reduces binary size since the linker will drop some code due to --gc-sections.
This commit is contained in:
Alexey Lapshin 2024-04-25 23:44:22 +04:00
parent 9375348740
commit afffbd9dd0
2 changed files with 15 additions and 1 deletions

View File

@ -39,7 +39,9 @@ if(NOT CONFIG_CXX_EXCEPTIONS)
_Unwind_Resume_or_Rethrow
_Unwind_Backtrace
__cxa_call_unexpected
__gxx_personality_v0)
__gxx_personality_v0
__cxa_throw
__cxa_allocate_exception)
foreach(wrap ${WRAP_FUNCTIONS})
target_link_libraries(${COMPONENT_LIB} INTERFACE "-Wl,--wrap=${wrap}")

View File

@ -178,4 +178,16 @@ extern "C" _Unwind_Reason_Code __wrap___gxx_personality_v0(int version,
return abort_return<_Unwind_Reason_Code>();
}
// Reduces binary size since the linker will drop some code due to --gc-sections.
extern "C" void __wrap___cxa_allocate_exception(void)
{
abort();
}
// Reduces binary size since the linker will drop some code due to --gc-sections.
extern "C" void __wrap___cxa_throw(void)
{
abort();
}
#endif // CONFIG_COMPILER_CXX_EXCEPTIONS