How can I tell mcpgcc not to link unused functions into the target? example:
func1() { } func2() { } main() { func1(); } func2 should not appear in the elf-file, because it is never called. I found some gcc options that would do that -fvtable-gc Emit special relocations for vtables and virtual function references so that the linker can identify unused virtual functions and zero out vtable slots that refer to them. This is most useful with -ffunction-sections' and -Wl,--gc-sections', in order to also discard the functions themselves. This optimization requires GNU as and GNU ld. Not all systems support this option. -Wl,--gc-sections' is ignored without -static'. But fvtable-gc is not available for mspgcc. Virtual functions and vtables sound like c++ options; ok I dont need that, but elimination of unsued function would be good. Is there a way to achieve this (maybe creating a lib?). Matthias