--gc-sections on x86

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi list,

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 ?
#include <stdio.h>

#ifndef NOTHING
int nothing(int n) // unused function, should not be in binary !
{
	return n;
}
#endif

int hello(void) // used function
{
	return printf("I do nothing !\n");
}

int main(void)
{
	return hello();
}

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux