It's even more than that:
With -ffunction-sections you can have all the topic-specific code in one single 
c file and include
it into your project.
It is compiled with your project and may obey shared global defines, such as
global clock frequency, number UART channels, debug levels, whatever.

At link stage, the linker will discard any function in this single .c file that 
is not referenced 
by either your project code or by the functions from this c file that are used 
by your project code.

This way, a single .c file acts as a whole precompiled library (with its 
individual sectiosn built
from a lot of individual .c files) just that it isn't precompiled and therefore 
obeys global defines
and project specific compiler settings (including HW-MPY, far/near data model 
etc.)

I really LOVE it for my collection of library functions.

The way you described it, including the precompiled object file to the link 
stage, is indeed
working, but no better than including a precompiled library. In fact, it acts 
as a 
poor-mans library implementation. It's only advantage is that AFAIK you don't 
have to take 
care for the proper linking order.

JMGross

----- Ursprüngliche Nachricht -----
Von: Grant Edwards
Gesendet am: 05 Aug 2011 16:38:52

If you're just bulding multiple versions of one program with different
features enabled, --gc-sections allows you to do that without having
to recompile anything -- it's all handled at the link stage.  If you
want to build the full-fat version, you link in all the files.  If you
don't want features A and B, you don't link in object files A and B.
The linker figures out what other functions/data aren't need now that
A and B have been left out, and those functions get left out as well.


------------------------------------------------------------------------------
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts. 
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
_______________________________________________
Mspgcc-users mailing list
Mspgcc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mspgcc-users

Reply via email to