Why does -nostdlib++ leave -lm on the link line?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Why does -nostdlib++ leave -lm on the link line?

Oleg Smolsky via cfe-dev
D35780 has introduced the new -nostdlib++ flag that disables linking
of C++ standard library, but it still leaves -lm on the link line.
AFAIK the reason why -lm was on the link line in the first place is
because C++ standard libraries like libc++ and libstdc++ depend on -lm
and that dependency is needed when statically linking C++ standard
library.

Nico's argument on D35780 was that -nostdlib++ should only disable C++
standard library and nothing else, and that -lm is there not just for
the C++ standard library. Is that the case? Would C++ compiler ever
generate references directly against libm?

If not, then I'd argue that -nostdlib++ should drop -lm as well. If
users opt to provide their own C++ library which depends on -lm, it
should be their responsibility to include that link dependency. I have
implemented this change in D54681, reviews are welcome.
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev