about summary refs log tree commit diff
path: root/src/librustc_codegen_ssa/back/linker.rs
AgeCommit message (Collapse)AuthorLines
2019-07-25rustc: Update wasm32 support for LLVM 9Alex Crichton-1/+39
This commit brings in a number of minor updates for rustc's support for the wasm target which has changed in the LLVM 9 update. Notable updates include: * The compiler now no longer manually inserts the `producers` section, instead relying on LLVM to do so. LLVM uses the `llvm.ident` metadata for the `processed-by` directive (which is now emitted on the wasm target in this PR) and it uses debuginfo to figure out what `language` to put in the `producers` section. * Threaded WebAssembly code now requires different flags to be passed with LLD. In LLD we now pass: * `--shared-memory` - required since objects are compiled with atomics. This also means that the generated memory will be marked as `shared`. * `--max-memory=1GB` - required with the `--shared-memory` argument since shared memories in WebAssembly must have a maximum size. The 1GB number is intended to be a conservative estimate for rustc, but it should be overridable with `-C link-arg` if necessary. * `--passive-segments` - this has become the default for multithreaded memory, but when compiling a threaded module all data segments need to be marked as passive to ensure they don't re-initialize memory for each thread. This will also cause LLD to emit a synthetic function to initialize memory which users will have to arrange to call. * The `__heap_base` and `__data_end` globals are explicitly exported since they're now hidden by default due to the `--export` flags we pass to LLD.
2019-07-23cleanup: Remove `extern crate serialize as rustc_serialize`sVadim Petrochenkov-1/+1
2019-06-15Auto merge of #59752 - Zoxc:dylib-fix, r=alexcrichtonbors-15/+8
Limit dylib symbols This makes `windows-gnu` match the behavior of `windows-msvc`. It probably doesn't make sense to export these symbols on other platforms either.
2019-06-14Unify all uses of 'gcx and 'tcx.Eduard-Mihai Burtescu-2/+2
2019-06-12Add a limit_rdylib_exports option and disable it for SolarisJohn Kåre Alsaker-7/+4
2019-06-12Limit dylib symbolsJohn Kåre Alsaker-9/+5
2019-06-12rustc: replace `TyCtxt<'tcx, 'gcx, 'tcx>` with `TyCtxt<'gcx, 'tcx>`.Eduard-Mihai Burtescu-2/+2
2019-05-03rustc: Always handle exported symbols on the wasm targetAlex Crichton-0/+10
Currently when linking an artifact rustc will only conditionally call the `Linker::export_symbols` function, but this causes issues on some targets, like WebAssembly, where it means that executable outputs will not have the same symbols exported that cdylib outputs have. This commit sinks the conditional call to `export_symbols` inside the various implementations of the function that still need it, and otherwise the wasm linker is configured to always pass through symbol visibility lists.
2019-03-28Rollup merge of #59320 - alexcrichton:wasm-clang, r=sanxiynMazdak Farrokhzad-56/+21
rustc: Allow using `clang` for wasm32 targets This commit adds support code for using `clang` directly to link the wasm32-unknown-unknown target. Currently the target is only really configured to link with LLD directly, but this ensures that `clang` can be configured as well. While not immediately useful in the near term it's likely that more wasm32 targets will pop up over time with Clang's new native support for WebAssembly in the 8.0.0 release. Getting support into rustc early should make it easier to experiment with these targets and try out various changes here and there.
2019-03-26Remove the block on natvis for lld-link.TheGoddessInari-12/+0
2019-03-20rustc: Allow using `clang` for wasm32 targetsAlex Crichton-56/+21
This commit adds support code for using `clang` directly to link the wasm32-unknown-unknown target. Currently the target is only really configured to link with LLD directly, but this ensures that `clang` can be configured as well. While not immediately useful in the near term it's likely that more wasm32 targets will pop up over time with Clang's new native support for WebAssembly in the 8.0.0 release. Getting support into rustc early should make it easier to experiment with these targets and try out various changes here and there.
2019-03-14Use try blocks in rustc_codegen_ssaTaiki Endo-9/+6
2019-02-25librustc_codegen_ssa: deny(elided_lifetimes_in_paths)Mazdak Farrokhzad-2/+2
2019-02-13Rollup merge of #58057 - michaelwoerister:stabilize-xlto, r=alexcrichtonMazdak Farrokhzad-14/+14
Stabilize linker-plugin based LTO (aka cross-language LTO) This PR stabilizes [linker plugin based LTO](https://github.com/rust-lang/rust/issues/49879), also known as "cross-language LTO" because it allows for doing inlining and other optimizations across language boundaries in mixed Rust/C/C++ projects. As described in the tracking issue, it works by making `rustc` emit LLVM bitcode instead of machine code, the same as `clang` does. A linker with the proper plugin (like LLD) can then run (Thin)LTO across all modules. The feature has been implemented over a number of pull requests and there are various [codegen](https://github.com/rust-lang/rust/blob/master/src/test/codegen/no-dllimport-w-cross-lang-lto.rs) and [run](https://github.com/rust-lang/rust/tree/master/src/test/run-make-fulldeps/cross-lang-lto-clang)-[make](https://github.com/rust-lang/rust/tree/master/src/test/run-make-fulldeps/cross-lang-lto-upstream-rlibs) [tests](https://github.com/rust-lang/rust/tree/master/src/test/run-make-fulldeps/cross-lang-lto) that make sure that it keeps working. It also works for building big projects like [Firefox](https://treeherder.mozilla.org/#/jobs?repo=try&revision=2ce2d5ddcea6fbff790503eac406954e469b2f5d). The PR makes the feature available under the `-C linker-plugin-lto` flag. As discussed in the tracking issue it is not cross-language specific and also not LLD specific. `-C linker-plugin-lto` is descriptive of what it does. If someone has a better name, let me know `:)`
2019-02-12Fix some rebasing fallout regarding xLTO.Michael Woerister-1/+1
2019-02-12Stabilize linker-plugin based LTO.Michael Woerister-13/+13
2019-02-10rustc: doc commentsAlexander Regueiro-2/+2
2019-01-29Provide PTXLinker with fallback to internal `target-cpu`Denys Zariaiev-0/+6
2019-01-28Adjust PTXLinker LTO logic and CLIDenys Zariaiev-9/+8
2019-01-27Create `nvptx64-nvidia-cuda` target specificationDenys Zariaiev-0/+125
2019-01-23Don't export table by default in wasmSergey Pepyakin-3/+0
2019-01-04rustc: Place wasm linker args first instead of lastAlex Crichton-60/+62
This ensures that arguments passed via `-C link-arg` can override the first ones on the command line, for example allowing configuring of the stack size.
2018-12-25Remove licensesMark Rousskov-10/+0
2018-12-12Remove `Session::sysroot()`.Nicholas Nethercote-2/+1
Instead of maybe storing its own sysroot and maybe deferring to the one in `Session::opts`, just clone the latter when necessary so one is always directly available. This removes the need for the getter.
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-1/+1
2018-11-25Pass `--export-dynamic` to LLD for wasmAlex Crichton-0/+6
This should handle recent symbol visibility changes happening, although we'll likely want to tweak this in the future!
2018-11-25wasm: Pass `--no-demangle` to LLDAlex Crichton-0/+5
Our mangling scheme is not C++'s, so tell LLD to not demangle anything so we can handle Rust-specific demangling ourselves.
2018-11-19Add `override_export_symbols` option to Rust target specificationJethro Beekman-0/+4
2018-11-16Separating the back folder between backend-agnostic and LLVM-specific codeDenis Merigoux-0/+1079