about summary refs log tree commit diff
path: root/src/librustc_codegen_llvm/back/linker.rs
AgeCommit message (Collapse)AuthorLines
2018-11-03Move cg_llvm::back::linker to cg_utilsbjorn3-1095/+0
2018-10-02wasm: Explicitly export all symbols with LLDAlex Crichton-1/+6
This commit fixes an oddity on the wasm target where LTO can produce working executables but plain old optimizations doesn't. The compiler already knows what set of symbols it would like to export, but LLD only discovers this list transitively through symbol visibilities. LLD may not, however, always find all the symbols that we'd like to export. For example if you depend on an rlib with a `#[no_mangle]` symbol, then if you don't actually use anything from the rlib then the symbol won't appear in the final artifact! It will appear, however, with LTO. This commit attempts to rectify this situation by ensuring that all symbols rustc would otherwise preserve through LTO are also preserved through the linking process with LLD by default.
2018-09-15Enable fatal warnings for the wasm32 linkerAlex Crichton-0/+4
Historically LLD has emitted warnings for various reasons but all the bugs have since been fixed (yay!) and by enabling fatal warnings we should be able to head off bugs like #53390 sooner.
2018-09-05Allow for opting out of ThinLTO and clean up LTO related cli flag handling.Michael Woerister-2/+1
2018-08-30Rollup merge of #53472 - eddyb:fx-pls, r=pnkfelixPietro Albini-2/+2
Use FxHash{Map,Set} instead of the default Hash{Map,Set} everywhere in rustc. Most of the compiler uses the `Fx` hasher but some places ended up with the default one.
2018-08-28Fix warnings about the `native` target-cpuAlex Crichton-1/+2
This fixes a regression from #53031 where specifying `-C target-cpu=native` is printing a lot of warnings from LLVM about `native` being an unknown CPU. It turns out that `native` is indeed an unknown CPU and we have to perform a mapping to an actual CPU name, but this mapping is only performed in one location rather than all locations we inform LLVM about the target CPU. This commit centralizes the mapping of `native` to LLVM's value of the native CPU, ensuring that all locations we inform LLVM about the `target-cpu` it's never `native`. Closes #53322
2018-08-28Use FxHash{Map,Set} instead of the default Hash{Map,Set} everywhere in rustc.Eduard-Mihai Burtescu-2/+2
2018-08-20Auto merge of #52101 - japaric:linker-flavor, r=alexcrichtonbors-2/+3
try to infer linker flavor from linker name and vice versa This is a second take on PR #50359 that implements the logic proposed in https://github.com/rust-lang/rust/pull/50359#pullrequestreview-116663121 With this change it would become possible to link `thumb*` binaries using GNU's LD on stable as `-C linker=arm-none-eabi-ld` would be enough to change both the linker and the linker flavor from their default values of `arm-none-eabi-gcc` and `gcc`. To link `thumb*` binaries using rustc's LLD on stable `-Z linker-flavor` would need to be stabilized as `-C linker=rust-lld -Z linker-flavor=ld.lld` are both required to change the linker and the linker flavor, but this PR doesn't propose that. We would probably need some sort of stability guarantee around `rust-lld`'s name and availability to make linking with rustc's LLD truly stable. With this change it would also be possible to link `thumb*` binaries using a system installed LLD on stable using the `-C linker=ld.lld` flag (provided that `ld.lld` is a symlink to the system installed LLD). r? @alexcrichton
2018-08-16wasm: Remove --strip-debug argument to LLDAlex Crichton-12/+0
Originally added in #52887 this commit disables passing `--strip-debug` to LLD when optimized. This bring back the original bug of emitting broken debuginfo but currently it *also* strips the `name` section which makes it very difficult to inspect the final binary. A real fix is happening at https://reviews.llvm.org/D50729 and we can reevaluate once we've updated LLD to have that commit.
2018-08-09try to infer linker flavor from linker name and vice versaJorge Aparicio-2/+3
2018-08-09Export WASM table by defaultMarko Mijalkovic-0/+3
2018-08-04Normalize DebugInfoLevel to standard styleMark Rousskov-5/+5
2018-08-04Normalize variants of CrateType to standard styleMark Rousskov-2/+2
This is a clippy-breaking change.
2018-07-30Disable debug sections when optimization flags is set for LLD.Yury Delendik-0/+12
2018-07-28Don't format!() string literalsljedrz-1/+1
2018-07-24break --subsystem=x into 2 args; closer to former presumably known-good ↵alecmocatta-1/+2
incantation
2018-07-24Pass multiple linker arguments rather than concatenate with commas; -l ↵alecmocatta-17/+18
library -> -llibrary to work with apple's ld
2018-07-11Deny bare trait objects in in src/librustc_codegen_llvmljedrz-6/+6
2018-07-10Upgrade to LLVM's master branch (LLVM 7)Alex Crichton-2/+35
This commit upgrades the main LLVM submodule to LLVM's current master branch. The LLD submodule is updated in tandem as well as compiler-builtins. Along the way support was also added for LLVM 7's new features. This primarily includes the support for custom section concatenation natively in LLD so we now add wasm custom sections in LLVM IR rather than having custom support in rustc itself for doing so. Some other miscellaneous changes are: * We now pass `--gc-sections` to `wasm-ld` * The optimization level is now passed to `wasm-ld` * A `--stack-first` option is passed to LLD to have stack overflow always cause a trap instead of corrupting static data * The wasm target for LLVM switched to `wasm32-unknown-unknown`. * The syntax for aligned pointers has changed in LLVM IR and tests are updated to reflect this. * The `thumbv6m-none-eabi` target is disabled due to an [LLVM bug][llbug] Nowadays we've been mostly only upgrading whenever there's a major release of LLVM but enough changes have been happening on the wasm target that there's been growing motivation for quite some time now to upgrade out version of LLD. To upgrade LLD, however, we need to upgrade LLVM to avoid needing to build yet another version of LLVM on the builders. The revision of LLVM in use here is arbitrarily chosen. We will likely need to continue to update it over time if and when we discover bugs. Once LLVM 7 is fully released we can switch to that channel as well. [llbug]: https://bugs.llvm.org/show_bug.cgi?id=37382
2018-07-06Remove CrossLangLto::NoLink which does not have a use case anymore.Michael Woerister-2/+1
2018-07-03Allow the linker to choose the LTO-plugin (which is useful when using LLD)Michael Woerister-25/+36
2018-05-17Rename trans to codegen everywhere.Irina Popa-0/+1037