]> git.lizzy.rs Git - rust.git/commit
rust: Add a `-C default-linker-libraries` option
authorAlex Crichton <alex@alexcrichton.com>
Sat, 29 Sep 2018 18:03:59 +0000 (11:03 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Sat, 29 Sep 2018 18:03:59 +0000 (11:03 -0700)
commit6f4b378e840209561f0ea1c013f9725b584a53e8
tree1b64dd8088918109091f22c9f02a3a08feab8428
parent9653f790333d1270f36f1614e85d8a7b54193e75
rust: Add a `-C default-linker-libraries` option

This commit adds a new codegen option for the compiler which disables
rustc's passing of `-nodefaultlibs` by default on relevant platforms.
Sometimes Rust is linked with C code which fails to link with
`-nodefaultlibs` and is unnecessarily onerous to get linking correctly
with `-nodefaultlibs`.

An example of this is that when you compile C code with sanitizers and
then pass `-fsanitize=address` to the linker, it's incompatible with
`-nodefaultlibs` also being passed to the linker.

In these situations it's easiest to turn off Rust's default passing of
`-nodefaultlibs`, which was more ideological to start with than
anything! Preserving the default is somewhat important but having this
be opt-in shouldn't cause any breakage.

Closes #54237
src/librustc/session/config.rs
src/librustc_codegen_llvm/back/link.rs