From: Denis Zaitsev <zzz@anda.ru>
To: gcc@gcc.gnu.org, linux-gcc@vger.kernel.org
Subject: Re: [i386] Why g++ _always_ link an executable with libm.so?
Date: Wed, 5 Jan 2005 03:18:47 +0500 [thread overview]
Message-ID: <20050105031847.H1437@natasha.ward.six> (raw)
In-Reply-To: <20050104220523.GA24316@nevyn.them.org>; from drow@false.org on Tue, Jan 04, 2005 at 05:05:23PM -0500
On Tue, Jan 04, 2005 at 05:05:23PM -0500, Daniel Jacobowitz wrote:
> On Wed, Jan 05, 2005 at 03:01:02AM +0500, Denis Zaitsev wrote:
> > 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?
>
> drow@nevyn:~% readelf -d /usr/lib/libstdc++.so.6 | grep NEEDED
> 0x00000001 (NEEDED) Shared library: [libm.so.6]
> 0x00000001 (NEEDED) Shared library: [libgcc_s.so.1]
> 0x00000001 (NEEDED) Shared library: [libc.so.6]
Thanks.
> Libstdc++ needs libm.
Then the other questions:
a) why g++ assumes that libstdc++ is always needed?
b) why is libm _always_ needed by libstdc++? It's rather strange.
BTW, the same happens with Ada and libgnat - if I compile GCC from
scratch, then libgnat.so NEED libm. But libgnat from, say, Debian
doesnt do so - it NEED libgcc_s.so only. Where are some things
messed?
next prev parent reply other threads:[~2005-01-04 22:18 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050105031847.H1437@natasha.ward.six \
--to=zzz@anda.ru \
--cc=gcc@gcc.gnu.org \
--cc=linux-gcc@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).