You are not logged in.

#1 2005-02-10 02:13:30

z4ziggy
Member
From: Israel
Registered: 2004-03-29
Posts: 573
Website

gcc options for optimizing static bin

whats the best way to optimize (size wise) a static program using gcc (not uclibc or similar) for compiling? ie, remove debug info & symbols, optimize for size (-Os), etc.
tnx.

[EDIT]
up-til now, the best i got was with :

gcc -o unionctl-static unionctl.c -static -s -Os -Wl,--gc-sections

Offline

#2 2005-02-10 16:52:12

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: gcc options for optimizing static bin

optimizing for size or speed?
if looking for speed over size, then -funroll_loops is great
I also recall -fomit_frame_pointer (or whatever) doing some good for speed and memory usage (it tires to pass as much in registers as possible, instead of pushing it on the stack)

Offline

#3 2005-02-10 17:19:49

z4ziggy
Member
From: Israel
Registered: 2004-03-29
Posts: 573
Website

Re: gcc options for optimizing static bin

tnx, but i mean SIZE wise wink

Offline

#4 2005-02-10 18:57:19

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: gcc options for optimizing static bin

for size:

-fno-inline (removes all inline functions) - might do a small amount
-fmerge-constants (tries to combine constants with the same value)

that's all i can really come up with... I think the second one is enabled by default... not sure

Offline

Board footer

Powered by FluxBB