#147547 - Peter - Sat Dec 22, 2007 5:57 pm
I wonder how I can get devkitarm r21 to remove unused functions.
If I remember correctly, GCC could only remove entire unused compilation units, but not seperate unused functions from those. That would make sense, because there are several projects that put every function in a seperate source file. So I did the same with my matrix module today (some functions are unused), but it didn't change anything to the final .nds filesize.
So I went one step further and created a new project using the arm9 template from the devkitpro examples, added three .cpp files with the functions:
None of those functions is called anywhere. When I clean/make the project, its filesize grew. I tried some compiler and linker switches that I found thru google and think are related to it (I'm not an expert with toolchain stuff), but it still doesn't change anything on the size:
This is the test project: click here to download
Any idea what I'm doing wrong?
_________________
Kind Regards,
Peter
If I remember correctly, GCC could only remove entire unused compilation units, but not seperate unused functions from those. That would make sense, because there are several projects that put every function in a seperate source file. So I did the same with my matrix module today (some functions are unused), but it didn't change anything to the final .nds filesize.
So I went one step further and created a new project using the arm9 template from the devkitpro examples, added three .cpp files with the functions:
* Unused0();
* Unused1();
* Unused2(); (calls Unused1)
None of those functions is called anywhere. When I clean/make the project, its filesize grew. I tried some compiler and linker switches that I found thru google and think are related to it (I'm not an expert with toolchain stuff), but it still doesn't change anything on the size:
Code: |
CFLAGS += -ffunction-sections -fdata-sections LDFLAGS += --gc-sections -fssa -fssa-ccp -fssa-dce |
This is the test project: click here to download
Any idea what I'm doing wrong?
_________________
Kind Regards,
Peter