How to prevent inclusion of C library destructors and atexit()?
问题 Using arm-none-eabi-gcc for Cortex-M4 (baremetal application), the code for malloc is also emitted even though I never use malloc in my code. Seeing the assembly output with arm-none-eabi-objdump -xS obj.elf , it seems that malloc is called by __register_exitproc called by atexit called by register_fini 004036a8 <register_fini>: 4036a8: 4b02 ldr r3, [pc, #8] ; (4036b4 <register_fini+0xc>) 4036aa: b113 cbz r3, 4036b2 <register_fini+0xa> 4036ac: 4802 ldr r0, [pc, #8] ; (4036b8 <register_fini