This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Linking un-referenced function
- From: Jason Lam <jlam555 at yahoo dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Mon, 22 May 2006 16:31:31 -0700 (PDT)
- Subject: Linking un-referenced function
Hi,
I looked through the documents and couldn't find an
option to not link an un-referenced function into the
final image. Does GCC support it? Could someone
please help?
For example, I have two functions in a file.
example.c
void dummy_1 (void)
{
printf("dummy 1\n");
}
void dummy_2 (void)
{
printf("dummy 2\n");
}
dummy_1() is referenced by others in a different file
but not dummy_2(). However, dummy_2 is also got
linked to the final image. It looks like the compiler
links functions by the entire object file but not by
each function. Is there a way to exclude linking
dummy_2() to the final image?
Thank you very much for your help.
Regards,
Jason
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com