Hello,

I'm using -ffunction-sections and -fdata-sections, with --gc-sections on
linking, but the output size doesn't change (I have some functions not
being used right now)

Do I have to do something else to achieve this optimization?

Best regards,

On Mon, Sep 26, 2011 at 12:05 PM, Grant Edwards
<grant.b.edwa...@gmail.com>wrote:

> On 2011-09-26, Bustamante, Paul <pbustama...@ceit.es> wrote:
>
> > When I have a 10 functions in a file "funcs.c", and I only use one of
> > them, when I link to the main program (main.c), all the functions in
> > the file "funcs.c" are included in the ".elf" file.
> >
> > How I can link that only the functions that I use will be included in
> > the ".elf" file?
>
> Compile with the -ffunction-sections option (you may also want the
> -fdata-sections option), then link with the --gc-sections option.
>
> The -ffunction-sections option will place each function in a separate
> memory section (-fdata-sections does the same thing for variables).
>
> The --gc-sections linker option will discard any sections that are not
> referenced.
>
> IIRC, there have been a couple recent versions where support for those
> features was broken, but I think it's all fixed now.
>
> --
> Grant Edwards               grant.b.edwards        Yow! I want EARS!  I
> want
>                                  at               two ROUND BLACK EARS
>                              gmail.com            to make me feel warm
>                                                   'n secure!!
>
>
>
> ------------------------------------------------------------------------------
> All the data continuously generated in your IT infrastructure contains a
> definitive record of customers, application performance, security
> threats, fraudulent activity and more. Splunk takes this data and makes
> sense of it. Business sense. IT sense. Common sense.
> http://p.sf.net/sfu/splunk-d2dcopy1
> _______________________________________________
> Mspgcc-users mailing list
> Mspgcc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mspgcc-users
>



-- 
--------------------------------------
Sergio Campamá
sergiocamp...@gmail.com
------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Mspgcc-users mailing list
Mspgcc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mspgcc-users

Reply via email to