[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patches] Re: [gnu-eglibc] libstdc++ and -lm

[Moving an internal discussion out to the public.]

Daniel Jacobowitz <dan@xxxxxxxxxxxxxxxx> writes:
> On Sat, Mar 31, 2007 at 11:01:41AM -0700, Mark Mitchell wrote:
>> Jim Blandy wrote:
>> > Why does libstdc++ link against -lm?
>> > 
>> > In playing with a libm option group for EGLIBC, I noticed that
>> > libstdc++ links against libm (the third GCC build failed, because I
>> > had C++ enabled).  To see what was using libm, I tried simply removing
>> > '-lm' from the 'src' Makefile, and was surprised to see that libstdc++
>> > still linked without complaint.
> It may have undefined references, though I don't see any on Linux.
> Also, there may be things in the libstdc++ headers which require libm
> that aren't reflected in the library.
>> For EGLIBC, in order to maintain compatibility with Makefiles, it might
>> be best to build an entirely empty libm.so, rather than none at all.
>> That's wasteful of space, but presumably only very slightly, relative to
>> the entire body of libm?
> I would recommend building an empty libm.a and suppressing libm.so.
> Then it will have no runtime space penalty.

So this is to satisfy situations exactly like the current libstdc++
one: where a makefile lists -lm, but it's not actually needed.  All