startup: Make __cxx_eh_arena_size_get return 0 if exceptions disabled

This function 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.
This commit is contained in:
Jakob Hasse
2021-06-22 12:24:27 +08:00
committed by David Cermak
parent 42ea9b7cb1
commit 2bcfeb612f
2 changed files with 20 additions and 4 deletions

View File

@@ -532,12 +532,20 @@ void start_cpu1_default(void)
} }
#endif //!CONFIG_FREERTOS_UNICORE #endif //!CONFIG_FREERTOS_UNICORE
#ifdef CONFIG_COMPILER_CXX_EXCEPTIONS /**
* 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) size_t __cxx_eh_arena_size_get(void)
{ {
#ifdef CONFIG_COMPILER_CXX_EXCEPTIONS
return CONFIG_COMPILER_CXX_EXCEPTIONS_EMG_POOL_SIZE; return CONFIG_COMPILER_CXX_EXCEPTIONS_EMG_POOL_SIZE;
} #else
return 0;
#endif #endif
}
static void do_global_ctors(void) static void do_global_ctors(void)
{ {

View File

@@ -395,12 +395,20 @@ void start_cpu0_default(void)
abort(); /* Only get to here if not enough free heap to start scheduler */ abort(); /* Only get to here if not enough free heap to start scheduler */
} }
#ifdef CONFIG_COMPILER_CXX_EXCEPTIONS /**
* 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) size_t __cxx_eh_arena_size_get(void)
{ {
#ifdef CONFIG_COMPILER_CXX_EXCEPTIONS
return CONFIG_COMPILER_CXX_EXCEPTIONS_EMG_POOL_SIZE; return CONFIG_COMPILER_CXX_EXCEPTIONS_EMG_POOL_SIZE;
} #else
return 0;
#endif #endif
}
static void do_global_ctors(void) static void do_global_ctors(void)
{ {