Closed
Description
The way we set up the default linker arguments and the linker arguments to core are quite suspicious. There are some system libraries that the compiler automatically links all crates to, it also links in rustrt
by default, and - on linux only - the core library has a linkhack module for linking to yet more system libraries. I think that rustc should basically not be linking to system libraries by default - these things should be controlled by core
(or whatever crate needs them).
Here are some libraries that I am pretty confident that rustc itself should not care about:
- rustrt - For the most part rustc doesn't even make any calls to rustrt now. The only exception is that
libmorestack
makes two calls to rustrt, but it should ultimately be calling core instead. - rt - This is apparently related to timers and shared memory? Needed by rustrt, but not generally.
- log - Android-specific. Not sure why this is a dependency
- supc++ - Android-specific. Presumably needed by rustrt.
- gnustl_shared - Ditto
- pthread
- execinfo - FreeBSD-specific
- stdc++ - FreeBSD-specific. Presumably needed by rustrt
Libraries I'm less sure about:
- m - libmath. Unfortunately LLVM will emit calls to
fmod
so we seemingly have to either link to this or provide our own. - dl - Presumably the dynamic linker. I guess we always need this