about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2018-05-10 11:35:28 -0500
committerGitHub <noreply@github.com>2018-05-10 11:35:28 -0500
commitdd40277d0f646c700d22dab4c929733a37cbb822 (patch)
tree14d8efbcddf3ab65889aa1766ca366b121b5fabb /src/liballoc
parente23ec4b6f08828dbced71779eb9b390d85f1898b (diff)
parenta9810899a290a7746e88382558454e31bb8f85b7 (diff)
downloadrust-dd40277d0f646c700d22dab4c929733a37cbb822.tar.gz
rust-dd40277d0f646c700d22dab4c929733a37cbb822.zip
Rollup merge of #50569 - michaelwoerister:cross-lang-lto-2, r=alexcrichton
Allow for specifying a linker plugin for cross-language LTO

This PR makes the `-Zcross-lang-lto` flag optionally take the path to the `LLVMgold.so` linker plugin. If this path is specified, `rustc` will invoke the linker with the correct arguments (i.e. `-plugin` and various `-plugin-opt`s).

This can be used to ergonomically enable cross-language LTO for Rust programs with C/C++ dependencies:
```
clang -O2 test.c -otest.o -c -flto=thin
llvm-ar -rv libxxx.a test.o
rustc -L. main.rs -Zcross-lang-lto=/usr/lib64/LLVMgold.so -O -Clink-arg=-fuse-ld=gold
```

- Note that in theory this should work with Gold, LLD, and newer versions of binutils' LD but on my current system I could only get it to work with Gold.
- Also note that this will work best if the Clang version and Rust's LLVM version are close enough. Clang 6.0 works well with the current nightly.

r? @alexcrichton
Diffstat (limited to 'src/liballoc')
0 files changed, 0 insertions, 0 deletions