Skip to content

Commit 6700da1

Browse files
committed
Add -fno-use-cxa-atexit compiler option to reduce unused code
C++ requires that static object destructors are called when the program terminates. Recent versions of GCC use __cxa_atexit to register exit handlers which call these object destructors. With the -fno-use-cxa-atexit command line option, GCC uses atexit instead (same functionality, but only up to 32 exit handlers can be registered). Since the Arduino main process can not return, and calls to exit() simply call an infinite loop - so all of this is completely irrelevant. No exit handlers are ever called. By removing the unused __cxa_atexit functionality we save a bit of space. See rogerclarkmelbourne/Arduino_STM32#556 Thanks @justinschoeman Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parent e97d7bc commit 6700da1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

platform.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ compiler.S.flags={compiler.extra_flags} -c -x assembler-with-cpp {compiler.stm.e
3333

3434
compiler.c.flags={compiler.extra_flags} -c {build.flags.optimize} {compiler.warning_flags} -std=gnu11 -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -MMD {compiler.stm.extra_include}
3535

36-
compiler.cpp.flags={compiler.extra_flags} -c {build.flags.optimize} {compiler.warning_flags} -std={compiler.cpp.std} -ffunction-sections -fdata-sections -nostdlib -fno-threadsafe-statics --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -MMD {compiler.stm.extra_include}
36+
compiler.cpp.flags={compiler.extra_flags} -c {build.flags.optimize} {compiler.warning_flags} -std={compiler.cpp.std} -ffunction-sections -fdata-sections -nostdlib -fno-threadsafe-statics --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -fno-use-cxa-atexit -MMD {compiler.stm.extra_include}
3737

3838
compiler.ar.flags=rcs
3939

0 commit comments

Comments
 (0)