public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* --gc-sections on x86
@ 2006-12-05  9:28 Gabriel Linder
  2006-12-05  9:57 ` Brian Dessent
  2006-12-05 13:04 ` John Love-Jensen
  0 siblings, 2 replies; 5+ messages in thread
From: Gabriel Linder @ 2006-12-05  9:28 UTC (permalink / raw)
  To: gcc-help

[-- Attachment #1: Type: text/plain, Size: 558 bytes --]

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 ?

[-- Attachment #2: oblivion.c --]
[-- Type: text/plain, Size: 234 bytes --]

#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();
}

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-12-05 14:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-05  9:28 --gc-sections on x86 Gabriel Linder
2006-12-05  9:57 ` Brian Dessent
2006-12-05 10:13   ` Gabriel Linder
2006-12-05 14:27     ` Perry Smith
2006-12-05 13:04 ` John Love-Jensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).