List Info

Thread: to reduce footprint




to reduce footprint
user name
2006-12-23 10:16:45
A great guide line Kristof! I have heard of all of them
except this one, "ld's -gc-sections". What its
function?


regards,
George


> As a rough guide:
> - Strip debug information (strip)
> - Optimize for size (-Os)
> - Use gcc's -fdata-sections/-ffunction-sections and
ld's -gc-sections
> to remove unused functions.
> - use a compressed file system like SquashFS.
(depending on your target
> and requirements of course)
>
> Kristof

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection
around 
http://mail.yahoo.com 


_______________________________________________
Help-make mailing list
Help-makegnu.org
http:
//lists.gnu.org/mailman/listinfo/help-make
to reduce footprint
user name
2006-12-23 10:50:52
-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

- -gc-sections works in combination with
-fdata-sections/-ffunction-sections.

During the compilation steps gcc will put each function in a
separate
section in the output file. When yuou link those output
files together
ld will try to figure out which sections it needs, and which
it doesn't.
(If A is the entry point and calls B, but no one calls C
=> A and B are
needed, C is not.)

It amounts to removing all unused functions. It may not work
for all
output formats though (it does for ELF), and you may need to
use a
customized linker script to move everything back into one
section (more
sections will use more space).

The results will depends on how much unused code you've got
in your
binary. In our case we managed to reduce the binary size by
170kB, and
memory use by around 500kB (which is pretty nice if you've
only got 8MB
to work with).



> A great guide line Kristof! I have heard of all of them
except this one, "ld's -gc-sections". What its
function?
> 
> 
> regards,
> George
> 
> 
>> As a rough guide:
>> - Strip debug information (strip)
>> - Optimize for size (-Os)
>> - Use gcc's -fdata-sections/-ffunction-sections and
ld's -gc-sections
>> to remove unused functions.
>> - use a compressed file system like SquashFS.
(depending on your target
>> and requirements of course)
>>
>> Kristof



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org


iD8DBQFFjQoMUEZ9DhGwDugRA68oAKCfMlyWAo3Qs6bEEgD8OlqNYM9djACe
OvvZ
sHLO5QTauGxukgW69kkE8e0=
=lACg
-----END PGP SIGNATURE-----


_______________________________________________
Help-make mailing list
Help-makegnu.org
http:
//lists.gnu.org/mailman/listinfo/help-make
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )