linux-gcc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [i386] Why g++ _always_ link an executable with libm.so?
@ 2005-01-04 22:01 Denis Zaitsev
  2005-01-04 22:05 ` Daniel Jacobowitz
  0 siblings, 1 reply; 23+ messages in thread
From: Denis Zaitsev @ 2005-01-04 22:01 UTC (permalink / raw)
  To: gcc, linux-gcc

I've found some strange behaviour of g++: if it's used to produce an
executable, i.e.:

        g++ xxx.C -o XXX

then that XXX is linked with libm.so, regardless of the fact that math
is not used in the program.  Also, libstdc++.so and libgcc_s.so are
linked too, even though they aren't needed as well.

But if g++ is used to compilation only, and the link stage is done by
gcc or ld, i.e:

        g++ -c xxx.C -o xxx.o
        gcc xxx.o -o XXX

then neither of that 3 libs are linked (of course, if they aren't
needed).

Why g++ does so?  Is it intentional?  Or how this can be solved?

GCC's in question are the current stable, 20041231 snapshot and all
the 3.x.x versions, as far as I remember.

Thanks in advance.

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

end of thread, other threads:[~2005-01-05 22:55 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-04 22:01 [i386] Why g++ _always_ link an executable with libm.so? Denis Zaitsev
2005-01-04 22:05 ` Daniel Jacobowitz
2005-01-04 22:18   ` Denis Zaitsev
2005-01-04 22:30     ` Gabriel Dos Reis
2005-01-04 22:59       ` Denis Zaitsev
2005-01-04 23:06         ` Andrew Pinski
2005-01-04 23:16           ` Denis Zaitsev
2005-01-05  0:40           ` Gabriel Dos Reis
2005-01-05 17:14           ` Mike Hearn
2005-01-05 18:21             ` Andrew Pinski
2005-01-05 18:51               ` Mike Hearn
2005-01-05 18:48                 ` Andrew Pinski
2005-01-05 19:10                   ` Mike Hearn
2005-01-05 22:09               ` Denis Zaitsev
2005-01-05 22:16                 ` Andrew Pinski
2005-01-05 22:30                   ` Denis Zaitsev
2005-01-05 22:32                     ` Andrew Pinski
2005-01-05 22:39                 ` Gabriel Dos Reis
2005-01-05  0:38         ` Gabriel Dos Reis
2005-01-05 22:25           ` Denis Zaitsev
2005-01-05 22:30             ` Andrew Pinski
2005-01-05 22:44             ` Gabriel Dos Reis
2005-01-05 22:55               ` Denis Zaitsev

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 NNTP newsgroup(s).