From 64750acbb0a0f5268844211ec6485bb94e3d416f Mon Sep 17 00:00:00 2001 From: Jakob Hasse Date: Tue, 22 Jun 2021 12:24:27 +0800 Subject: [PATCH] [esp_system]: added __cxx_eh_arena_size_get again * This function has been accidentally removed. It is necessary to provide the emergency exception memory pool size for C++ code. Since our libstdc++ always has exceptions enabled, this function must exist here even if -fno-exception is set for user code. --- components/esp_system/startup.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/components/esp_system/startup.c b/components/esp_system/startup.c index 84422902e0..5b7115fd5c 100644 --- a/components/esp_system/startup.c +++ b/components/esp_system/startup.c @@ -138,6 +138,21 @@ static IRAM_ATTR void _Unwind_SetNoFunctionContextInstall_Default(unsigned char static const char* TAG = "cpu_start"; +/** + * This function overwrites a the same function of libsupc++ (part of libstdc++). + * Consequently, libsupc++ will then follow our configured exception emergency pool size. + * + * It will be called even with -fno-exception for user code since the stdlib still uses exceptions. + */ +size_t __cxx_eh_arena_size_get(void) +{ +#ifdef CONFIG_COMPILER_CXX_EXCEPTIONS + return CONFIG_COMPILER_CXX_EXCEPTIONS_EMG_POOL_SIZE; +#else + return 0; +#endif +} + /** * Xtensa gcc is configured to emit a .ctors section, RISC-V gcc is configured with --enable-initfini-array * so it emits an .init_array section instead.