This is the mail archive of the gcc@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]

[i386] Why g++ _always_ link an executable with libm.so?


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.


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