Closed joeyparrish closed 3 months ago
Nice find ! Since sometime now I observed that randomly LTO wasn't properly eliminating some unused symbols, glad to see you probably find the source of that issue. The problem is that i do think that the -fno-unit-at-a-time
option maybe useful somehow but i need to test it to ensure that. If it turns out that it's not anymore useful then we can indeed remove it !
It turns out that -fno-unit-at-a-time
was just used as an optimization flag so it's probably safe to remove it :)
I already pushed a change.
Wonderful, thanks! I will send a PR, but I will wait until we have settled the Docker changes.
Should be fixed hopefully with the remove of -fno-unit-at-a-time flag.
I built a ROM with SGDK that had very little in it, and it was 512kB. When I looked at symbol sizes with
nm --print-size --size-sort --radix=d out/rom.out
, I found that these three symbols were 128kB each:This is in spite of the fact that I'm not using log or sqrt or any fix16 functions at all. In fact, the methods that use those tables were not present in the ROM.
I spent some time playing around with and researching the compiler settings, and I eventually found this in the GCC optimization docs (emphasis added):
Then this (emphasis added):
When I experimented with the flags in the makefile, I found that removing
-fno-unit-at-a-time
fixed my issue. My ROM went from 512kB to 128kB.Do you see any risk in removing this flag? If not, I will send a PR.
Thanks!