about summary refs log tree commit diff
path: root/src/bootstrap/compile.rs
AgeCommit message (Collapse)AuthorLines
2018-02-26Fix error-format argument to x.pyMark Simulacrum-0/+4
2018-02-23CI: Fixed the incorrect folder region when building codegen dylib.kennytm-1/+2
2018-02-19rustbuild: make libdir_relative a methodJosh Stone-2/+1
2018-02-19rustbuild: Restore Config.libdir_relativeJosh Stone-1/+1
This re-introduces a `Config.libdir_relative` field, now derived from `libdir` and made relative to `prefix` if necessary. This fixes a regression from #46592 when `--libdir` is given an absolute path. `Builder::sysroot_libdir` should always use a relative path so its callers don't clobber system locations, and `librustc` also asserts that `CFG_LIBDIR_RELATIVE` is really relative.
2018-02-11Change Step to be invoked with a path when in default mode.Mark Simulacrum-5/+5
Previously, a Step would be able to tell on its own when it was invoked "by-default" (that is, `./x.py test` was called instead of `./x.py test some/path`). This commit replaces that functionality, invoking each Step with each of the paths it has specified as "should be invoked by." For example, if a step calls `path("src/tools/cargo")` and `path("src/doc/cargo")` then it's make_run will be called twice, with "src/tools/cargo" and "src/doc/cargo." This makes it so that default handling logic is in builder, instead of spread across various Steps. However, this meant that some Step specifications needed to be updated, since for example `rustdoc` can be built by `./x.py build src/librustdoc` or `./x.py build src/tools/rustdoc`. A `PathSet` abstraction is added that handles this: now, each Step can not only list `path(...)` but also `paths(&[a, b, ...])` which will make it so that we don't invoke it with each of the individual paths, instead invoking it with the first path in the list (though this shouldn't be depended on). Future work likely consists of implementing a better/easier way for a given Step to work with "any" crate in-tree, especially those that want to run tests, build, or check crates in the std, test, or rustc crate trees. Currently this is rather painful to do as most of the logic is duplicated across should_run and make_run. It seems likely this can be abstracted away into builder somehow.
2018-01-31rustc: Move location of `codegen-backends` dirAlex Crichton-2/+1
Right now this directory is located under: $sysroot/lib/rustlib/$target/lib/codegen-backends but after seeing what we do in a few other places it seems that a more appropriate location would be: $sysroot/lib/rustlib/$target/codegen-backends so this commit moves it!
2018-01-28rustc: Split Emscripten to a separate codegen backendAlex Crichton-75/+119
This commit introduces a separately compiled backend for Emscripten, avoiding compiling the `JSBackend` target in the main LLVM codegen backend. This builds on the foundation provided by #47671 to create a new codegen backend dedicated solely to Emscripten, removing the `JSBackend` of the main codegen backend in the process. A new field was added to each target for this commit which specifies the backend to use for translation, the default being `llvm` which is the main backend that we use. The Emscripten targets specify an `emscripten` backend instead of the main `llvm` one. There's a whole bunch of consequences of this change, but I'll try to enumerate them here: * A *second* LLVM submodule was added in this commit. The main LLVM submodule will soon start to drift from the Emscripten submodule, but currently they're both at the same revision. * Logic was added to rustbuild to *not* build the Emscripten backend by default. This is gated behind a `--enable-emscripten` flag to the configure script. By default users should neither check out the emscripten submodule nor compile it. * The `init_repo.sh` script was updated to fetch the Emscripten submodule from GitHub the same way we do the main LLVM submodule (a tarball fetch). * The Emscripten backend, turned off by default, is still turned on for a number of targets on CI. We'll only be shipping an Emscripten backend with Tier 1 platforms, though. All cross-compiled platforms will not be receiving an Emscripten backend yet. This commit means that when you download the `rustc` package in Rustup for Tier 1 platforms you'll be receiving two trans backends, one for Emscripten and one that's the general LLVM backend. If you never compile for Emscripten you'll never use the Emscripten backend, so we may update this one day to only download the Emscripten backend when you add the Emscripten target. For now though it's just an extra 10MB gzip'd. Closes #46819
2018-01-28Auto merge of #47663 - malbarbo:mips-crt-static, r=alexcrichtonbors-2/+2
Do not assume dynamic linking for musl/mips[el] targets All musl targets except mips[el] assume static linking by default. This can be [confusing](https://users.rust-lang.org/t/static-cross-compiled-binaries-arent-really-static/6084). When the musl/mips[el] targets was [added](https://github.com/rust-lang/rust/pull/31298), dynamic linking was chosen because of binary size concerns, and probably also because libunwind [didn't](https://users.rust-lang.org/t/static-cross-compiled-binaries-arent-really-static/6084/8) supported mips. Now that we have `crt-static` target-feature (the user can choose dynamic link for musl targets), and libunwind [6.0](https://github.com/llvm-mirror/libunwind/commits/release_60) add support to mips, we do not need to assume dynamic linking.
2018-01-27rustc: Load the `rustc_trans` crate at runtimeAlex Crichton-50/+184
Building on the work of # 45684 this commit updates the compiler to unconditionally load the `rustc_trans` crate at runtime instead of linking to it at compile time. The end goal of this work is to implement # 46819 where rustc will have multiple backends available to it to load. This commit starts off by removing the `extern crate rustc_trans` from the driver. This involved moving some miscellaneous functionality into the `TransCrate` trait and also required an implementation of how to locate and load the trans backend. This ended up being a little tricky because the sysroot isn't always the right location (for example `--sysroot` arguments) so some extra code was added as well to probe a directory relative to the current dll (the rustc_driver dll). Rustbuild has been updated accordingly as well to have a separate compilation invocation for the `rustc_trans` crate and assembly it accordingly into the sysroot. Finally, the distribution logic for the `rustc` package was also updated to slurp up the trans backends folder. A number of assorted fallout changes were included here as well to ensure tests pass and such, and they should all be commented inline.
2018-01-23Add ./x.py check src/{libstd,libtest,rustc}.Mark Simulacrum-6/+10
This currently only supports a limited subset of the full compilation, but is likely 90% of what people will want and is possible without building a full compiler (i.e., running LLVM). In theory, this means that contributors who don't want to build LLVM now have an easy way to compile locally, though running tests won't work.
2018-01-22Do not assume dynamic linking for musl/mips[el] targetsMarco A L Barbosa-2/+2
All musl targets except mips[el] assume static linking by default. This can be confusing https://users.rust-lang.org/t/static-cross-compiled-binaries-arent-really-static/6084 When the musl/mips[el] targets was [added](https://github.com/rust-lang/rust/pull/31298), dynamic linking was chosen because of binary size concerns, and probably also because libunwind [didn't](https://users.rust-lang.org/t/static-cross-compiled-binaries-arent-really-static/6084/8) supported mips. Now that we have `crt-static` target-feature (the user can choose dynamic link for musl targets), and libunwind [6.0](https://github.com/llvm-mirror/libunwind/commits/release_60) add support to mips, we do not need to assume dynamic linking.
2018-01-12Remove unused configuration parameter `libdir_relative`.O01eg-1/+1
2018-01-12Remove unused argument `rustc_cargo`.O01eg-2/+1
2018-01-12Build all stages with relative libdirs.O01eg-8/+4
2017-12-22Don't try to statically link libstdc++ on FreeBSDScott Abbey-0/+1
The code inside this conditional will not work on FreeBSD 10+ because those versions use clang and libc++ rather than libstdc++. Since FreeBSD comes with libc++ in the base, presumably all 10+ systems will have it present. Searching for libstdc++.a will not work if it is not present. As a result, this would previously have set `LLVM_STATIC_STDCPP=libstdc++.a`, which isn't a valid path and caused problems later on when building `librustc_llvm`. This could possibly be updated in the future to look for `libc++.a` on FreeBSD, by expanding the code inside the conditional. In one attempt to run this on x86_64-freebsd, I found that libc++ was not compiled with PIC, so it failed anyway.
2017-12-17Add sync module to rustc_data_structuresJohn Kåre Alsaker-0/+3
2017-11-08std: Remove `rand` crate and moduleAlex Crichton-8/+10
This commit removes the `rand` crate from the standard library facade as well as the `__rand` module in the standard library. Neither of these were used in any meaningful way in the standard library itself. The only need for randomness in libstd is to initialize the thread-local keys of a `HashMap`, and that unconditionally used `OsRng` defined in the standard library anyway. The cruft of the `rand` crate and the extra `rand` support in the standard library makes libstd slightly more difficult to port to new platforms, namely WebAssembly which doesn't have any randomness at all (without interfacing with JS). The purpose of this commit is to clarify and streamline randomness in libstd, focusing on how it's only required in one location, hashmap seeds. Note that the `rand` crate out of tree has almost always been a drop-in replacement for the `rand` crate in-tree, so any usage (accidental or purposeful) of the crate in-tree should switch to the `rand` crate on crates.io. This then also has the further benefit of avoiding duplication (mostly) between the two crates!
2017-10-25rustbuild: Fix `no output generated` error for next bootstrap cargo.kennytm-4/+12
Due to rust-lang/cargo#4570, a `*.dll.lib` file is uplifted when building dynamic libraries on Windows. The current bootstrap code does not understand files with multiple extensions, and will instead assume `xxxx.dll` is the file name. This caused a `no output generated` error because it tries to search for `xxxx.dll-hash.lib` inside the `deps/` folder, while it should check for `xxxx-hash.dll.lib` instead. This PR is blocking #45285 (Bump to 1.23 and update bootstrap).
2017-10-21Fix rustbuild --color conflict when building on Travis outside of Docker.kennytm-2/+2
2017-10-18Make sure to clear out the stageN-{rustc,std,tools} directories.Mark Simulacrum-14/+9
We copy built tool binaries into a dedicated directory to avoid deleting them, stageN-tools-bin. These aren't ever cleared out by code, since there should be no reason to do so, and we'll simply overwrite them as necessary. When clearing out the stageN-{std,rustc,tools} directories, make sure to delete both Cargo directories -- per-target and build scripts. This ensures that changing libstd doesn't cause problems due to build scripts not being rebuilt, even though they should be.
2017-10-09cleanup: rustc doesn't use an external archiverVadim Petrochenkov-3/+0
2017-08-22Copy musl startup objects before building stdSamuel Holland-16/+27
They are required for linking it, even though it is a library, because crtn.o in post_link_objects, as hardcoded in src/librustc_back/target/ linux_musl_base.rs, is added to the linker command line for both executables and libraries.
2017-08-22Improve explanation of musl_rootSamuel Holland-1/+4
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-10/+10
Like #43008 (f668999), but _much more aggressive_.
2017-08-13Clean tools after building libstd/libtest/librustc.Mark Simulacrum-0/+17
This fixes the bug we previously had where we'd build a libtest tool after building a libstd tool and clear out the libstd tool. Since we clear out all tools for a given stage on invocations of CleanTools after lib{std, test, rustc} change, we need to make sure that all tools built with that stage will be built after the clearing is done. The fix contained here technically isn't perfect; there is still an edge case of compiling a libstd tool, then compiling libtest, which will clear out the libstd tool and it won't ever get rebuilt within that session of rustbuild. This is where the caching system used today shows it's problems -- in effect, all tools depend on a global counter of the stage being cleared out. We can implement such a counter in a future patch to ensure that tools are rebuilt as needed, but it is deemed unlikely that it will be required in practice, since most if not all tools are built after the relevant stage's std/test/rustc are built, though this is only an opinion and hasn't been verified.
2017-08-13Unify flags into config.Mark Simulacrum-2/+2
This introduces a slight change in behavior, where we unilaterally respect the --host and --target parameters passed for all sanity checking and runtime configuration.
2017-07-27Build rustdoc on-demand.Mark Simulacrum-9/+0
Rustdoc is no longer compiled in every stage, alongside rustc, instead it is only compiled when requested, and generally only for the last stage.
2017-07-25Bump master to 1.21.0Alex Crichton-107/+130
This commit bumps the master branch's version to 1.21.0 and also updates the bootstrap compiler from the freshly minted beta release.
2017-07-22Fix StartupObject buildMark Simulacrum-1/+1
2017-07-20Change make_run signature to taking a RunConfig struct for refactorability.Mark Simulacrum-37/+17
2017-07-20Remove step.rs commentsMark Simulacrum-162/+0
2017-07-20Implement available paths list.Mark Simulacrum-28/+19
2017-07-20Fix tidyMark Simulacrum-3/+4
2017-07-20Implement keep-stage supportMark Simulacrum-1/+13
2017-07-20Require should_run to be implemented.Mark Simulacrum-0/+20
2017-07-20Utilize interning to allow Copy/Clone stepsMark Simulacrum-107/+112
2017-07-20Remove core_intrinsics feature gateMark Simulacrum-0/+9
2017-07-20Cleanups and fixes throughoutMark Simulacrum-6/+3
2017-07-20Migrate to serde_json entirelyMark Simulacrum-5/+5
2017-07-20Pacify tidyMark Simulacrum-1/+2
2017-07-20Finish fixing warnings and errors. Bootstrap builds.Mark Simulacrum-6/+6
2017-07-20Fixes warnings and errors introduced while moving code aroundMark Simulacrum-54/+58
2017-07-20Change code to work with the new systemMark Simulacrum-23/+197
2017-07-20Move code into Step trait implementations.Mark Simulacrum-451/+419
No changes are introduced to code body. This commit will not build; it is done to permit a better diff in later commits.
2017-07-20Move rule configs out of stepMark Simulacrum-0/+252
2017-07-04Use build.build instead of build.config.buildMark Simulacrum-5/+5
2017-07-04Clippy lintsMark Simulacrum-8/+9
2017-07-04Cleanup compile.rs.Mark Simulacrum-4/+6
2017-06-30rustc_llvm: re-run build script when env var LLVM_CONFIG changesVenkata Giri Reddy-4/+0
2017-06-22Make Build.cxx() return a Result instead of panickingIan Douglas Scott-1/+1