This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]