I believe that you need to use a few options to force gcc to do this. Try the linker option that goes something like --gc-sections. This tells the linker to garbage collect unused sections. If you use some functions but not others, you can try telling the compiler to make a new section for each function, something like -ffunction-sections.

[email protected] wrote:

Hi,
i thought that only used code gets linked but i added some MMC/SDC
code to a project and although that code is unused now and has not ISRs and gets compiled+linked without a warning it gets linked:

without MMC/SDC code:
msp430-size  aout.elf
  text    data     bss     dec     hex filename
 20114      30     568   20712    50e8 aout.elf

with MMC/SDC code (only linked, not used):
  text    data     bss     dec     hex filename
 22044      36    1596   23676    5c7c aout.elf

How can i force not linking unused code?

Regards,

Rolf



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Mspgcc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users

Reply via email to