* remove unused symbol and function
@ 2004-08-06 19:27 Weijun Zhu
2004-08-06 20:21 ` Eljay Love-Jensen
0 siblings, 1 reply; 2+ messages in thread
From: Weijun Zhu @ 2004-08-06 19:27 UTC (permalink / raw)
To: gcc-help
Hello,
A function (say foo1) in an object file calls a library function (say
foo2). The library does not exist on the system.
foo1 is not called in the target that I am building. But the GCC gives
me an error that
undefined reference to foo2 while linking?
Is there a way to avoid linking unused symbols?
Weijun.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: remove unused symbol and function
2004-08-06 19:27 remove unused symbol and function Weijun Zhu
@ 2004-08-06 20:21 ` Eljay Love-Jensen
0 siblings, 0 replies; 2+ messages in thread
From: Eljay Love-Jensen @ 2004-08-06 20:21 UTC (permalink / raw)
To: Weijun Zhu, gcc-help
Hi Weijun,
You could try -ffunction-sections, -fdata-sections, and -gc-sections
(garbage collect unused sections).
May or may not work, and could be platform dependent as to how well they
work.
You're better off not including the unused foo1 which depends on
unresolveable foo2 in the first place.
Another hack would be to define a (spoofed and also unused) foo2. That'd
make foo1 happy.
HTH,
--Eljay
"Don't anthropomorphize computers. They hate it when you do that."
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-08-06 19:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-06 19:27 remove unused symbol and function Weijun Zhu
2004-08-06 20:21 ` Eljay 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).