about summary refs log tree commit diff
path: root/src/librustc_trans/back
AgeCommit message (Collapse)AuthorLines
2018-05-17Rename trans to codegen everywhere.Irina Popa-7426/+0
2018-05-15Rename `has_type_parameters` to `requires_monomorphization`varkor-1/+1
2018-05-15Fix generics type parameter handling in mirivarkor-1/+1
2018-05-12Auto merge of #50686 - Mark-Simulacrum:rollup, r=Mark-Simulacrumbors-12/+23
Rollup of 13 pull requests Successful merges: - #50544 (Cleanup some dependencies) - #50545 (Made some functions in time module const) - #50550 (use fmt::Result where applicable) - #50558 (Remove all reference to DepGraph::work_products) - #50602 (Update canonicalize docs) - #50607 (Allocate Symbol strings from an arena) - #50613 (Migrate the toolstate update bot to rust-highfive) - #50624 (fs::write: Add example writing a &str) - #50634 (Do not silently truncate offsets for `read_at`/`write_at` on emscripten) - #50644 (AppVeyor: Read back trace from crash dump on failure.) - #50661 (Ignore non .rs files for tidy libcoretest) - #50663 (rustc: Allow an edition's feature on that edition) - #50667 (rustc: Only suggest deleting `extern crate` if it works) Failed merges:
2018-05-12Rollup merge of #50558 - whitfin:issue-50500, r=michaelwoeristerMark Simulacrum-12/+23
Remove all reference to DepGraph::work_products This is an attempt at fixing #50500. It will remove the `work_products` key from `DepGraphData` completely, in favour of just passing the relevant data around. I went in a little blindly; everything appears to work just fine but I'd appreciate any additional advice people. I didn't want to remove too much of what was already there, so I kept the structure pretty much the same (aside from some naming tweaks) - if anyone has suggestions on how to streamline it a little better, happy to follow up. r? @michaelwoerister
2018-05-12Set PrepareForThinLTO flag when using ThinLTONikita Popov-2/+5
The LLVM PassManager has a PrepareForThinLTO flag, which is intended when compilation occurs in conjunction with linking by ThinLTO. The flag has two effects: * The NameAnonGlobal pass is run after all other passes, which ensures that all globals have a name. * In optimized builds, a number of late passes (mainly related to vectorization and unrolling) are disabled, on the rationale that these a) will increase codesize of the intermediate artifacts and b) will be run by ThinLTO again anyway. This patch enables the use of PrepareForThinLTO if Thin or ThinLocal linking is used. The background for this change is the CI failure in #49479, which we assume to be caused by the NameAnonGlobal pass not being run. As this changes which passes LLVM runs, this might have performance (or other) impact, so we want to land this separately.
2018-05-11Auto merge of #50105 - mixi:crt-included, r=alexcrichtonbors-0/+27
Use the correct crt*.o files when linking musl targets. This is supposed to support optionally using the system copy of musl libc instead of the included one if supported. This currently only affects the start files, which is enough to allow building rustc on musl targets. Most of the changes are analogous to crt-static. Excluding the start files is something musl based distributions usually patch into their copy of rustc: - https://github.com/alpinelinux/aports/blob/eb064c8/community/rust/musl-fix-linux_musl_base.patch - https://github.com/voidlinux/void-packages/blob/77400fc/srcpkgs/rust/patches/link-musl-dynamically.patch For third-party distributions that not yet carry those patches it would be nice if it was supported without the need to patch upstream sources. ## Reasons ### What breaks? Some start files were missed when originally writing the logic to swap in musl start files (gcc comes with its own start files, which are suppressed by -nostdlib, but not manually included later on). This caused #36710, which also affects rustc with the internal llvm copy or any other system libraries that need crtbegin/crtend. ### How is it fixed? The system linker already has all the logic to decide which start files to include, so we can just defer to it (except of course if it doesn't target musl). ### Why is it optional? In #40113 it was first tried to remove the start files, which broke compiling musl-targeting static binaries with a glibc-targeting compiler. This is why it eventually landed without removing the start files. Being an option side-steps the issue. ### Why are the start files still installed? This has the nice side-effect, that the produced rust-std-* binaries can still be used by on a glibc-targeting system with a rustc built against glibc. ## Does it work? With the following build script (using [musl-cross-make](https://github.com/richfelker/musl-cross-make)): https://shadowice.org/~mixi/rust-musl/build.sh, I was able to cross-compile a musl-host musl-targeting rustc on a glibc-based system. The resulting binaries are at https://shadowice.org/~mixi/rust-musl/binaries/. This also requires #50103 and #50104 (which are also applied to the branch the build script uses).
2018-05-11Update naming in line with PR commentsIsaac Whitfield-4/+6
2018-05-11Neaten a couple of long signaturesIsaac Whitfield-4/+8
2018-05-11Remove shared access to DepGraph::work_productsIsaac Whitfield-12/+17
2018-05-09Allow for specifying a linker plugin for cross-language LTOMichael Woerister-7/+58
2018-05-03Don't run LTO passes in rustc when cross-lang LTO is enabled.Michael Woerister-0/+4
2018-05-03Use correct section name for embedded LLVM bitcode on OSX.Michael Woerister-2/+6
2018-05-03Add -Z cross-lang-lto flag in order to support linker-based LTO.Michael Woerister-1/+2
2018-05-03Declare embedded LLVM bitcode section readonly.Michael Woerister-0/+1
2018-05-01musl: link crt{begin,end}.o from the system compilerJohannes Nixdorf-0/+11
This fixes #36710 with +crt-static. We only need to add crtbegin.o and crtend.o as we only do static linking with the bundled start files and there is no static-pie support in rustc yet.
2018-04-29musl: don't use the included startfiles with -crt-staticJohannes Nixdorf-0/+16
This fixes #36710 with -crt-static.
2018-04-28Add `-C target-feature` to all functionsAlex Crichton-26/+5
Previously the features specified to LLVM via `-C target-feature` were only reflected in the `TargetMachine` but this change *also* reflects these and the base features inside each function itself. This change matches clang and... Closes rust-lang-nursery/stdsimd#427
2018-04-28Rollup merge of #50251 - alexcrichton:wasm-no-threads, r=eddybkennytm-1/+5
rustc: Disable threads in LLD for wasm Upstream bug reports (rustwasm/wasm-bindgen#119) show that this may be the culprit of odd crashes/hangs. The linker is a tiny fraction of build time anyway right now so let's disable it and figure out how to possibly reenable it later if necessary.
2018-04-27Rename InternedString to LocalInternedString and introduce a new thread-safe ↵John Kåre Alsaker-1/+1
InternedString
2018-04-26rustc: Disable threads in LLD for wasmAlex Crichton-1/+5
Upstream bug reports (rustwasm/wasm-bindgen#119) show that this may be the culprit of odd crashes/hangs. The linker is a tiny fraction of build time anyway right now so let's disable it and figure out how to possibly reenable it later if necessary.
2018-04-26Rename rustc_back::target to rustc_target::spec.Irina Popa-4/+3
2018-04-26rustc_back: move LinkerFlavor, PanicStrategy, and RelroLevel to target.Irina Popa-4/+3
2018-04-23make rustdoc test follow the jobserver limit of threadsfix that to many ↵Andreas Jonson-8/+1
threads is executing at the same timewhen rustdoc test is executed.
2018-04-19wasm: Increase default stack size to 1MBAlex Crichton-0/+1
This commit increases the dfeault stack size allocated to the wasm32-unknown-unknown target to 1MB by default. Currently the default stack size is one wasm page, or 64 kilobytes. This default stack is quite small and has caused a stack overflow or two in the wild by accident. The current "best practice" for fixing this is to pass `-Clink-args='-z stack-size=$bigger'` but that's not great nor always easy to do. A default of 1MB matches more closely with other platforms where it's "pretty big" by default. Note that it was tested and if the users uses `-C link-args` to pass a custom stack size that's still resepected as lld seems to take the first argument, and where rustc is passing it will always be last.
2018-04-14Auto merge of #49289 - varkor:emit-metadata-without-link, r=michaelwoeristerbors-2/+3
Make --emit=metadata output metadata regardless of link Fixes #40109. I'm not sure whether this condition was important here or not, but I can't see why it is required (removing it doesn't cause the error the comment warns about, so I'm assuming it's safe). If this is too heavy-handed, I can special-case on `OutputType::Metadata`. r? @nrc
2018-04-10Make Session.crate_types thread-safeJohn Kåre Alsaker-5/+8
2018-04-10Make Session.plugin_registrar_fn and Session.derive_registrar_fn thread-safeJohn Kåre Alsaker-2/+2
2018-04-10Reformat trans skip conditionvarkor-3/+3
2018-04-10Auto merge of #49390 - Zoxc:sync-syntax, r=michaelwoeristerbors-3/+3
More thread-safety changes r? @michaelwoerister
2018-04-06Allow for re-using hidden monomorphizations on platforms that don't support ↵Michael Woerister-9/+27
Rust dylibs.
2018-04-06Fix some rebasing fallout.Michael Woerister-1/+0
2018-04-06Select upstream monomorphizations in a stable way.Michael Woerister-5/+35
2018-04-06Allow for internalizing monomorphizations that cannot be shared.Michael Woerister-4/+12
2018-04-06Remove the (inaccurate) symbol_export_level query.Michael Woerister-4/+2
2018-04-06Allow for re-using monomorphizations from upstream crates.Michael Woerister-0/+64
2018-04-06Move export level computation to reachable_non_generics query.Michael Woerister-53/+49
2018-04-06Allow for representing exported monomorphizations in crate metadata.Michael Woerister-1/+1
2018-04-05Rollup merge of #49432 - nabijaczleweli:master, r=michaelwoeristerkennytm-4/+38
Flush executables to disk after linkage A problem caused by not doing so in Chrome has been reported [here](https://randomascii.wordpress.com/2018/02/25/compiler-bug-linker-bug-windows-kernel-bug/amp/). `File::sync_all()` calls `FlushFileBuffers()` down the line, causing potentially unflushed buffers on high I/O-load systems to flush and preventing nasty non-reproducible bugs. Closes #48545
2018-03-31Special-case OutputType::Metadatavarkor-1/+4
2018-03-31Open the file as write before trying to flush itnabijaczleweli-1/+1
This should be enough and shouldn't require append(true) since we're not explicitly writing anything so we're not flushing it so we've no risk of overwriting it
2018-03-29rustc: Group linked libraries where neededAlex Crichton-0/+78
This commit fixes a longstanding issue with the compiler with circular dependencies between libcore and libstd. The `core` crate requires at least one symbol, the ability to unwind. The `std` crate is the crate which actually defines this symbol, but the `std` crate also depends on the `core` crate. This circular dependency is in general disallowed in Rust as crates cannot have cycles amongst them. A special exception is made just for core/std, but this is also unfortunately incompatible with how GNU linkers work. GNU linkers will process undefined symbols in a left-to-right fashion, only actually linking an rlib like libstd if there are any symbols used from it. This strategy is incompatible with circular dependencies because if we otherwise don't use symbols from libstd we don't discover that we needed it until we're later processing libcore's symbols! To fix this GNU linkers support the `--start-group` and `--end-group` options which indicate "libraries between these markers may have circular dependencies amongst them. The linker invocation has been updated to automatically pass these arguments when we're invoking a GNU linker and automatically calculate where the arguments need to go (around libstd and libcore) Closes #18807 Closes #47074
2018-03-29Also protect first attemptnabijaczleweli-1/+5
2018-03-29Flush executables to disk after linkagenabijaczleweli-3/+33
A problem caused by not doing so in Chrome has been reported here: https://randomascii.wordpress.com/2018/02/25/compiler-bug-linker-bug-windows-kernel-bug/amp/ File::sync_all() calls FlushFileBuffers() down the line, causing potentially unflushed buffers on high I/O-load systems to flush and prevent nasty non-reproducible bugs. The force-flush is only done on Windows and if the linker exited successfully Closes #48545
2018-03-28Rollup merge of #49329 - canarysnort01:fix-no-pie, r=pnkfelixkennytm-2/+4
don't pass -no-pie to gnu ld fixes #48884
2018-03-28Auto merge of #49019 - phil-opp:target-spec, r=pnkfelixbors-5/+6
Introduce a TargetTriple enum to support absolute target paths This PR replaces target triple strings with a `TargetTriple` enum, which represents either a target triple or a path to a JSON target file. The path variant is used if the `--target` argument has a `.json` extension, else the target triple variant is used. The motivation of this PR is support for absolute target paths to avoid the need for setting the `RUST_TARGET_PATH` environment variable (see rust-lang/cargo#4905 for more information). For places where some kind of triple is needed (e.g. in the sysroot folder), we use the file name (without extension). For compatibility, we keep the old behavior of searching for a file named `$(target_triple).json` in `RUST_TARGET_PATH` for non-official target triples.
2018-03-28Make LLVM worker channel thread-safeJohn Kåre Alsaker-3/+3
2018-03-26Introduce a TargetTriple enum to support absolute target pathsPhilipp Oppermann-5/+6
2018-03-26Auto merge of #48346 - emilio:pgo, r=alexcrichtonbors-7/+87
Add basic PGO support. This PR adds two mutually exclusive options for profile usage and generation using LLVM's instruction profile generation (the same as clang uses), `-C pgo-use` and `-C pgo-gen`. See each commit for details.
2018-03-25Move linker code to the Linker trait instead.Emilio Cobos Álvarez-14/+32