tweak `atexit` to get rid of malloc
fenugrec opened this issue · 2 comments
fenugrec commented
Originally posted by @fenugrec in #128 (comment)
See comment above;
in certain cases the builtint atexit implementation pulls in malloc and some other stuff.
More information at https://stackoverflow.com/questions/48711221/how-to-prevent-inclusion-of-c-library-destructors-and-atexit
fenugrec commented
-fno-use-cxa-atexit
will not work :
command-line option '-fno-use-cxa-atexit' is valid for C++/ObjC++ but not for C [-Werror]
But, overriding the weak symbol __register_exitproc()
seems to work, saving almost 300 bytes:
Before:
text data bss dec hex filename
14296 188 3576 18060 468c cannette_fw
With override:
text data bss dec hex filename
13912 184 3432 17528 4478 cannette_fw