Closed howprice closed 2 months ago
I added the flags hoping it will bring any drawback for C projects (I read mitigated opinions about it). I believe LTO was somehow doing the work of eliminating unused functions / data already but it works better with C projects obviously.
These break up each function and data into its own section in the object files, which allows the linker to better remove dead code when the ld
--gc-sections
option is used.Adding these flags to
DEFAULT_FLAGS_LIB
inmakelib.gen
and linking against the resultinglibmd.a
reduces final ROM size significantly in my test case, which callsrandom()
and plays XGM2 audio. (This is an assembler project linking against the library, rather than one built using the framework).