summary refs log tree commit diff
path: root/src/librustc_codegen_llvm/back/link.rs
AgeCommit message (Collapse)AuthorLines
2019-02-25librustc_codegen_llvm: deny(elided_lifetimes_in_paths)Mazdak Farrokhzad-1/+1
2019-02-18librustc_codegen_llvm => 2018Taiki Endo-7/+7
2019-02-13Rollup merge of #58057 - michaelwoerister:stabilize-xlto, r=alexcrichtonMazdak Farrokhzad-2/+2
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-12Stabilize linker-plugin based LTO.Michael Woerister-2/+2
2019-02-10rustc: doc commentsAlexander Regueiro-1/+1
2018-12-25Remove licensesMark Rousskov-10/+0
2018-12-18Search other library paths when loking for link objectsPetr Hosek-5/+19
Support the case when link objects are not located in Rust sysroot but in other locations which could be specify through library paths.
2018-12-12Replace `FileSearch::for_each_lib_search_path` with `search_paths`.Nicholas Nethercote-8/+4
Returning an iterator leads to nicer code all around.
2018-12-12Introduce `SearchPath` and replace `SearchPaths` with `Vec<SearchPath>`.Nicholas Nethercote-6/+6
It's more idiomatic, makes the code shorter, and will help with the next commit.
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-4/+4
2018-12-03codegen_llvm_back: improve allocationsljedrz-6/+6
2018-11-25Rollup merge of #56075 - alexcrichton:wasm-producer-section, r=estebankPietro Albini-0/+5
Encode a custom "producers" section in wasm files This commit implements WebAssembly/tool-conventions#65 for wasm files produced by the Rust compiler. This adds a bit of metadata to wasm modules to indicate that the file's language includes Rust and the file's "processed-by" tools includes rustc. The thinking with this section is to eventually have telemetry in browsers tracking all this.
2018-11-22Pass additional linker flags when targeting FuchsiaPetr Hosek-1/+9
This is a follow up to 8aa9267 which changed the driver to use lld directly rather than invoking it through Clang. This change ensures we pass all the necessary flags to lld.
2018-11-19Encode a custom "producers" section in wasm filesAlex Crichton-0/+5
This commit implements WebAssembly/tool-conventions#65 for wasm files produced by the Rust compiler. This adds a bit of metadata to wasm modules to indicate that the file's language includes Rust and the file's "processed-by" tools includes rustc. The thinking with this section is to eventually have telemetry in browsers tracking all this.
2018-11-16Separating the back folder between backend-agnostic and LLVM-specific codeDenis Merigoux-188/+11
2018-11-16Finished moving backend-agnostic code to rustc_codegen_ssaDenis Merigoux-1/+2
2018-11-16Fixed typosDenis Merigoux-1/+1
2018-11-16Traitification of common.rs methodsDenis Merigoux-1/+1
2018-11-10codegen_llvm_back: simplify a conversion to charljedrz-1/+1
2018-11-10codegen_llvm_back: remove a redundant continueljedrz-1/+0
2018-11-10codegen_llvm_back: possible minor speedup in logicljedrz-1/+1
2018-11-10codegen_llvm_back: improve common patternsljedrz-20/+11
2018-11-10codegen_llvm_back: remove explicit returnsljedrz-1/+2
2018-11-10codegen_llvm_back: whitespace & formatting fixesljedrz-9/+6
2018-11-03Move cg_llvm::back::linker to cg_utilsbjorn3-3/+4
2018-10-19Deprecate the `FxHashMap()` and `FxHashSet()` constructor function hackOliver Scherer-1/+1
2018-09-29rust: Add a `-C default-linker-libraries` optionAlex Crichton-6/+10
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
2018-09-28Move `filename_for_metadata` to codegen_utilsIgor Matuszewski-10/+2
This function isn't strictly tied to LLVM (it's more of a utility) and it's now near an analogous, almost identical `filename_for_input` (for rlibs and so forth). Also this means not depending on the backend when one wants to know the accurate .rmeta output filename.
2018-09-05Allow for opting out of ThinLTO and clean up LTO related cli flag handling.Michael Woerister-1/+0
2018-08-21Rollup merge of #53465 - bjorn3:remove_link_meta_struct, r=varkorkennytm-2/+1
Remove LinkMeta struct Fixes #53291
2018-08-20Auto merge of #52101 - japaric:linker-flavor, r=alexcrichtonbors-33/+82
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-19fix: preserve msvc linker fallback logicJorge Aparicio-1/+3
2018-08-19fix: use detected MSVC's link.exeJorge Aparicio-2/+5
2018-08-19LinkerFlavor::Gcc defaults to cc, not gccJorge Aparicio-1/+1
2018-08-18fatal -> bugJorge Aparicio-1/+1
2018-08-18add lld_flavor info to target specJorge Aparicio-0/+2
this field defaults to the LD / GNU flavor
2018-08-18Remove LinkMeta structbjorn3-2/+1
2018-08-15Use CGU name as LLVM module name and add some caching to CGU name generation.Michael Woerister-7/+0
2018-08-09address review commentsJorge Aparicio-49/+35
2018-08-09try to infer linker flavor from linker name and vice versaJorge Aparicio-26/+82
2018-08-09Move rustc::util::fs into separate (new) crateMark Rousskov-1/+1
2018-08-08Address review comments for #53031 and fix some merge fallout.Michael Woerister-5/+5
2018-08-07Make sure upstream object files are added to staticlibs when compilingMichael Woerister-1/+5
with ThinLTO and cross-lang-lto. Normally, when compiling with whole-crate-graph ThinLTO, we expect rustc's LTO step to "uplift" upstream object files/LLVM modules to the current set of compilation artifacts. Therefore the staticlib creation code skips this uplifting. However, when compiling with "cross-language LTO" (i.e. defer LTO to the actual linker), the LTO step in rustc is not performed, so we have to take care of copying upstream object files during archive creation (like we already do when compiling without any LTO).
2018-08-04Normalize DebugInfoLevel to standard styleMark Rousskov-3/+3
2018-08-04Normalize variants of CrateType to standard styleMark Rousskov-20/+20
This is a clippy-breaking change.
2018-07-30Auto merge of #52805 - ljedrz:format_str_literal, r=petrochenkovbors-2/+2
Don't format!() string literals Prefer `to_string()` to `format!()` take 2, this time targetting string literals. In some cases (`&format!("...")` -> `"..."`) also removes allocations. Occurences of `format!("")` are changed to `String::new()`.
2018-07-29Auto merge of #52767 - ljedrz:avoid_format, r=petrochenkovbors-1/+1
Prefer to_string() to format!() Simple benchmarks suggest in some cases it can be faster by even 37%: ``` test converting_f64_long ... bench: 339 ns/iter (+/- 199) test converting_f64_short ... bench: 136 ns/iter (+/- 34) test converting_i32_long ... bench: 87 ns/iter (+/- 16) test converting_i32_short ... bench: 87 ns/iter (+/- 49) test converting_str ... bench: 54 ns/iter (+/- 15) test formatting_f64_long ... bench: 349 ns/iter (+/- 176) test formatting_f64_short ... bench: 145 ns/iter (+/- 14) test formatting_i32_long ... bench: 98 ns/iter (+/- 14) test formatting_i32_short ... bench: 93 ns/iter (+/- 15) test formatting_str ... bench: 86 ns/iter (+/- 23) ```
2018-07-28Don't format!() string literalsljedrz-2/+2
2018-07-27Prefer to_string() to format!()ljedrz-1/+1