Gabriel Linder wrote: > I am trying to remove some unused functions from our programs, with gcc > flag -ffunction-sections and ld flag --gc-sections, but it doesn't seem > to work at all :-( > > I use gcc 3.2.2, and I get the following (sample source attached, 18 > lines) : > 2828 bytes with gcc -march=i686 -O2 -ffunction-sections > -Wl,--gc-sections oblivion.c -o oblivion && strip -s oblivion > 2812 bytes with gcc -DNOTHING -march=i686 -O2 -ffunction-sections > -Wl,--gc-sections oblivion.c -o oblivion && strip -s oblivion > > Is this a known problem ? Is a workaround available ? This testcase may not be actually showing you what you want. You have to balance the extra overhead of having a section for each function against the savings, and in this case the function being removed is completely trivial. When you're looking at a 2800 byte ELF file the noise (headers, padding, etc) is going to overwhelm everything. Try a more realistic testcase. Brian