about summary refs log tree commit diff
path: root/src/bootstrap/dist.rs
AgeCommit message (Collapse)AuthorLines
2020-07-28std: Switch from libbacktrace to gimliAlex Crichton-1/+11
This commit is a proof-of-concept for switching the standard library's backtrace symbolication mechanism on most platforms from libbacktrace to gimli. The standard library's support for `RUST_BACKTRACE=1` requires in-process parsing of object files and DWARF debug information to interpret it and print the filename/line number of stack frames as part of a backtrace. Historically this support in the standard library has come from a library called "libbacktrace". The libbacktrace library seems to have been extracted from gcc at some point and is written in C. We've had a lot of issues with libbacktrace over time, unfortunately, though. The library does not appear to be actively maintained since we've had patches sit for months-to-years without comments. We have discovered a good number of soundness issues with the library itself, both when parsing valid DWARF as well as invalid DWARF. This is enough of an issue that the libs team has previously decided that we cannot feed untrusted inputs to libbacktrace. This also doesn't take into account the portability of libbacktrace which has been difficult to manage and maintain over time. While possible there are lots of exceptions and it's the main C dependency of the standard library right now. For years it's been the desire to switch over to a Rust-based solution for symbolicating backtraces. It's been assumed that we'll be using the Gimli family of crates for this purpose, which are targeted at safely and efficiently parsing DWARF debug information. I've been working recently to shore up the Gimli support in the `backtrace` crate. As of a few weeks ago the `backtrace` crate, by default, uses Gimli when loaded from crates.io. This transition has gone well enough that I figured it was time to start talking seriously about this change to the standard library. This commit is a preview of what's probably the best way to integrate the `backtrace` crate into the standard library with the Gimli feature turned on. While today it's used as a crates.io dependency, this commit switches the `backtrace` crate to a submodule of this repository which will need to be updated manually. This is not done lightly, but is thought to be the best solution. The primary reason for this is that the `backtrace` crate needs to do some pretty nontrivial filesystem interactions to locate debug information. Working without `std::fs` is not an option, and while it might be possible to do some sort of trait-based solution when prototyped it was found to be too unergonomic. Using a submodule allows the `backtrace` crate to build as a submodule of the `std` crate itself, enabling it to use `std::fs` and such. Otherwise this adds new dependencies to the standard library. This step requires extra attention because this means that these crates are now going to be included with all Rust programs by default. It's important to note, however, that we're already shipping libbacktrace with all Rust programs by default and it has a bunch of C code implementing all of this internally anyway, so we're basically already switching already-shipping functionality to Rust from C. * `object` - this crate is used to parse object file headers and contents. Very low-level support is used from this crate and almost all of it is disabled. Largely we're just using struct definitions as well as convenience methods internally to read bytes and such. * `addr2line` - this is the main meat of the implementation for symbolication. This crate depends on `gimli` for DWARF parsing and then provides interfaces needed by the `backtrace` crate to turn an address into a filename / line number. This crate is actually pretty small (fits in a single file almost!) and mirrors most of what `dwarf.c` does for libbacktrace. * `miniz_oxide` - the libbacktrace crate transparently handles compressed debug information which is compressed with zlib. This crate is used to decompress compressed debug sections. * `gimli` - not actually used directly, but a dependency of `addr2line`. * `adler32`- not used directly either, but a dependency of `miniz_oxide`. The goal of this change is to improve the safety of backtrace symbolication in the standard library, especially in the face of possibly malformed DWARF debug information. Even to this day we're still seeing segfaults in libbacktrace which could possibly become security vulnerabilities. This change should almost entirely eliminate this possibility whilc also paving the way forward to adding more features like split debug information. Some references for those interested are: * Original addition of libbacktrace - #12602 * OOM with libbacktrace - #24231 * Backtrace failure due to use of uninitialized value - #28447 * Possibility to feed untrusted data to libbacktrace - #21889 * Soundness fix for libbacktrace - #33729 * Crash in libbacktrace - #39468 * Support for macOS, never merged - ianlancetaylor/libbacktrace#2 * Performance issues with libbacktrace - #29293, #37477 * Update procedure is quite complicated due to how many patches we need to carry - #50955 * Libbacktrace doesn't work on MinGW with dynamic libs - #71060 * Segfault in libbacktrace on macOS - #71397 Switching to Rust will not make us immune to all of these issues. The crashes are expected to go away, but correctness and performance may still have bugs arise. The gimli and `backtrace` crates, however, are actively maintained unlike libbacktrace, so this should enable us to at least efficiently apply fixes as situations come up.
2020-07-27mv std libs to library/mark-28/+23
2020-07-22Revert "include backtrace folder in rust-src component"Mark Rousskov-1/+0
This reverts commit d7a36d8964c927863faef5d3b42da08f37e5896c.
2020-07-20Fix rust-src component.Eric Huss-1/+1
2020-07-20Auto merge of #74543 - Manishearth:rollup-m5w6hyg, r=Manishearthbors-0/+1
Rollup of 9 pull requests Successful merges: - #73618 (Documentation for the false keyword) - #74486 (Improve Read::read_exact documentation) - #74514 (Do not clobber RUSTDOCFLAGS) - #74516 (do not try fetching the ancestors of errored trait impls) - #74520 (include backtrace folder in rust-src component) - #74523 (Improve documentation for `core::fmt` internals) - #74527 (Add myself to toolstate change notifications for rustfmt) - #74534 (Only skip impls of foreign unstable traits) - #74536 (fix documentation surrounding the `in` and `for` keywords) Failed merges: r? @ghost
2020-07-19Teach bootstrap install and dist commands about TargetSelectionJake Goulding-50/+54
With this, we can now use a target JSON file to build a cross-compiler: ``` x.py install --host ../aarch64-apple-darwin.json --target aarch64-apple-darwin ```
2020-07-19include backtrace folder in rust-src componentRalf Jung-0/+1
2020-07-17Teach bootstrap about target files vs target triplesJake Goulding-39/+40
`rustc` allows passing in predefined target triples as well as JSON target specification files. This change allows bootstrap to have the first inkling about those differences. This allows building a cross-compiler for an out-of-tree architecture (even though that compiler won't work for other reasons). Even if no one ever uses this functionality, I think the newtype around the `Interned<String>` improves the readability of the code.
2020-07-03Add rust-analyzer submoduleAleksey Kladov-1/+121
The current plan is that submodule tracks the `release` branch of rust-analyzer, which is updated once a week. rust-analyzer is a workspace (with a virtual manifest), the actual binary is provide by `crates/rust-analyzer` package. Note that we intentionally don't add rust-analyzer to `Kind::Test`, for two reasons. *First*, at the moment rust-analyzer's test suite does a couple of things which might not work in the context of rust repository. For example, it shells out directly to `rustup` and `rustfmt`. So, making this work requires non-trivial efforts. *Second*, it seems unlikely that running tests in rust-lang/rust repo would provide any additional guarantees. rust-analyzer builds with stable and does not depend on the specifics of the compiler, so changes to compiler can't break ra, unless they break stability guarantee. Additionally, rust-analyzer itself is gated on bors, so we are pretty confident that test suite passes.
2020-07-01Rollup merge of #72569 - ChrisDenton:remove-innosetup, r=nikomatsakisManish Goregaokar-21/+0
Remove legacy InnoSetup GUI installer On Windows the InnoSetup `.exe` installer was superseded by the MSI installer long ago. It's no longer needed. The `.exe` installer hasn't been linked from the [other installation methods](https://forge.rust-lang.org/infra/other-installation-methods.html#standalone) page in many years. As far as I can tell the intent was always to remove this installer once the MSI proved itself. Though admittedly both installers feel very "legacy" at this point. Removing this would mean we only maintain one Windows GUI installer and would speed up the distribution phase. As a result of removing InnoSetup, this closes #24397
2020-06-19Rollup merge of #72999 - mati865:separate-self-contained-dir, r=Mark-SimulacrumRalf Jung-5/+19
Create self-contained directory and move there some of external binaries/libs One of the steps to reach design described in https://github.com/rust-lang/rust/issues/68887#issuecomment-633048380 This PR moves things around and allows link code to handle the new directory structure.
2020-06-11Move shipped MinGW linker to self-contained dirMateusz Mikuła-1/+6
2020-06-11Move some libs to self-contained directoryMateusz Mikuła-2/+11
2020-06-11Use enum to distinguish dependency typeMateusz Mikuła-3/+3
2020-06-09Implement new gdb/lldb pretty-printersortem-3/+5
Replace old GDB and LLDB pretty-printers with new ones which were originally written for IntelliJ Rust. New LLDB pretty-printers support synthetic children. New GDB/LLDB pretty-printers support all Rust types supported by old pretty-printers, and also support: Rc, Arc, Cell, Ref, RefCell, RefMut, HashMap, HashSet.
2020-05-25Remove legacy InnoSetup GUI installerChris Denton-21/+0
On Windows the InnoSetup installer was superseded by the MSI installer. It's no longer needed.
2020-05-20Move the target libLLVM to llvm-tools-previewJosh Stone-19/+28
For running the compiler, we usually only need LLVM from `$sysroot/lib`, which rustup will make available with `LD_LIBRARY_PATH`. We've also been shipping LLVM in the `$target/lib` directory, which bloats the download and installed size. The only times we do need the latter are for the RPATH of `llvm-tools-preview` binaries, and for linking `rustc-dev` libraries. We'll move it to the `llvm-tools-preview` component directly, and `rustc-dev` will have an implicit dependency on it. Here are the dist sizes that I got before and after this change: llvm-tools-1.45.0-dev-x86_64-unknown-linux-gnu.tar.gz 1.3M 24M llvm-tools-1.45.0-dev-x86_64-unknown-linux-gnu.tar.xz 748K 17M rustc-1.45.0-dev-x86_64-unknown-linux-gnu.tar.gz 83M 61M rustc-1.45.0-dev-x86_64-unknown-linux-gnu.tar.xz 56M 41M The installed size should reduce by exactly one `libLLVM.so` (~70-80M), unless you also install `llvm-tools`, and then it should be identical.
2020-05-10remove lldb package from bootstrap, config and build-manifestRalf Jung-121/+0
it's not been built since a long time ago
2020-05-02Gate on clippy on CIOliver Scherer-49/+28
2020-03-02remove non-sysroot sources from rust-src componentRalf Jung-2/+0
2020-03-01Rollup merge of #69549 - mati865:mingw, r=kennytmYuki Okushi-1/+8
Improve MinGW detection when cross compiling Official mingw-w64 builds, MSYS2 and LLVM MinGW provide both `gcc.exe` and `$ARCH-w64-mingw32-gcc.exe` so they should not regress but I included CI changes to verify it though `@bors try` (I don't have permission). This change will come handy when cross compiling from Linux or Cygwin since they use `gcc` as native compiler and `$ARCH-w64-mingw32-gcc.exe` for MinGW. This means users will no longer have to override the linker.
2020-02-29Make it build againVadim Petrochenkov-1/+1
2020-02-29Update src/bootstrap/dist.rsMateusz Mikuła-1/+1
Co-Authored-By: kennytm <kennytm@gmail.com>
2020-02-28Improve MinGW detection when cross compilingMateusz Mikuła-1/+8
2020-02-04Rollup merge of #68805 - matthiaskrgr:cleanup_bootstrap, r=Mark-SimulacrumDylan DPC-2/+2
bootstrap: fix clippy warnings r? @oli-obk
2020-02-03bootstrap: fix clippy warningsMatthias Krüger-2/+2
2020-01-31Install robots.txt into rust-docs tarballsMark Rousskov-0/+1
2020-01-09Remove sanitizer runtime cratesTomasz Miąsko-4/+0
2019-12-22Format the worldMark Rousskov-447/+563
2019-12-11Fix some linking of LLVM's dynamic libraryAlex Crichton-4/+15
Ensure it shows up in the same places it did before so tools can find it at runtime.
2019-12-11rustc: Link LLVM directly into rustc againAlex Crichton-10/+0
This commit builds on #65501 continue to simplify the build system and compiler now that we no longer have multiple LLVM backends to ship by default. Here this switches the compiler back to what it once was long long ago, which is linking LLVM directly to the compiler rather than dynamically loading it at runtime. The `codegen-backends` directory of the sysroot no longer exists and all relevant support in the build system is removed. Note that `rustc` still supports a dynamically loaded codegen backend as it did previously, it just no longer supports dynamically loaded codegen backends in its own sysroot. Additionally as part of this the `librustc_codegen_llvm` crate now once again explicitly depends on all of its crates instead of implicitly loading them through the sysroot. This involved filling out its `Cargo.toml` and deleting all the now-unnecessary `extern crate` annotations in the header of the crate. (this in turn required adding a number of imports for names of macros too). The end results of this change are: * Rustbuild's build process for the compiler as all the "oh don't forget the codegen backend" checks can be easily removed. * Building `rustc_codegen_llvm` is much simpler since it's simply another compiler crate. * Managing the dependencies of `rustc_codegen_llvm` is much simpler since it's "just another `Cargo.toml` to edit" * The build process should be a smidge faster because there's more parallelism in the main rustc build step rather than splitting `librustc_codegen_llvm` out to its own step. * The compiler is expected to be slightly faster by default because the codegen backend does not need to be dynamically loaded. * Disabling LLVM as part of rustbuild is still supported, supporting multiple codegen backends is still supported, and dynamic loading of a codegen backend is still supported.
2019-11-20debuginfo: Support for std::collections::Hash* in windows debuggers.MaulingMonkey-0/+1
2019-10-30Statically link libstdc++ on windows-gnuMateusz Mikuła-1/+1
2019-10-24Auto merge of #65474 - Mark-Simulacrum:rustc-dev-split, r=pietroalbinibors-33/+96
Split the rustc target libraries into separate rustc-dev component This is re-applies a squashed version of #64823 as well as including #65337 to fix bugs noted after merging the first PR. The second PR is confirmed as fixing windows-gnu, and presumably also fixes other platforms, such as musl (i.e. #65335 should be fixed); `RUSTUP_DIST_SERVER=https://dev-static.rust-lang.org rustup toolchain install nightly-2019-10-16` can be installed to confirm that this is indeed the case.
2019-10-21Remove `src/llvm-emscripten` submoduleAlex Crichton-4/+0
With #65251 landed there's no need to build two LLVM backends and ship them with rustc, every target we have now uses the same LLVM backend! This removes the `src/llvm-emscripten` submodule and additionally removes all support from rustbuild for building the emscripten LLVM backend. Multiple codegen backend support is left in place for now, and this is intended to be an easy 10-15 minute win on CI times by avoiding having to build LLVM twice.
2019-10-15minimize the rust-std componentJosh Stone-33/+96
This splits out a rustc-dev component with the compiler crates, and keeps the status quo of default installed files on nightly. The default changing to not install compiler libraries by default is left for a future pull request. However, on stable and beta, this does remove the compiler libraries from the set of libraries installed by default, as they are never needed there (per our stability story, they "cannot" be used).
2019-10-12Revert "Auto merge of #64823 - cuviper:min-std, r=Mark-Simulacrum"Mark Rousskov-96/+33
This reverts commit 000d90b11f7be70ffb7812680f7abc6deb52ec88, reversing changes made to 898f36c83cc28d7921a1d7b3605323dc5cfcf533.
2019-10-07add dist::RustcDev for unstable compiler librariesJosh Stone-57/+45
2019-10-07Use builder.compiler_for() to find the libstd stampJosh Stone-2/+2
2019-10-07[WIP] minimize the rust-std componentJosh Stone-2/+77
2019-09-21Rollup merge of #64618 - alexcrichton:improve-dist-output, r=Mark-SimulacrumMazdak Farrokhzad-19/+47
rustbuild: Improve output of `dist` step * Pass `/Q` to `iscc` on Windows to supress the thousands of lines of output about compressing documentation. * Print out what's happening before long steps * Use `timeit` to print out timing information for long-running installer assemblies. * Try to scope output of `Dist ...` to not also encompass actual build steps
2019-09-19rustbuild: Improve output of `dist` stepAlex Crichton-19/+47
* Pass `/Q` to `iscc` on Windows to supress the thousands of lines of output about compressing documentation. * Print out what's happening before long steps * Use `timeit` to print out timing information for long-running installer assemblies.
2019-09-19rustbuild: Don't package libstd twiceAlex Crichton-1/+1
Looks like the packaging step for the standard library was happening twice on CI, but it only needs to happen once! The `Analysis` packaging step accidentally packaged `Std` instead of relying on compiling `Std`, which meant that we ended up packaging it twice erroneously.
2019-09-17build-manifest: add some commentsRalf Jung-4/+10
2019-09-17Revert "Rollup merge of #64451 - RalfJung:miri-manifest, r=pietroalbini"Pietro Albini-10/+4
This reverts commit 7975973e2b806a7ee8e54b40f9e774528a777e31, reversing changes made to f0320e54c7c2c923e2e05996ac1d74f781115bbc.
2019-09-14when BUILD_MANIFEST_DISABLE_SIGNING is set, we don't need gpg-password-fileRalf Jung-4/+10
2019-09-06Include compiler-rt in the source tarballMatthew Maurer-0/+1
In #60981 we switched to using src/llvm-project/compiler-rt inside compiler-builtins rather than a separate copy of it. In order to have the "c" feature turn on in builds from the source tarball, we need to include that path in its creation. fixes #64239
2019-08-23bootstrap: Merge the libtest build step with libstdAlex Crichton-6/+2
Since its inception rustbuild has always worked in three stages: one for libstd, one for libtest, and one for rustc. These three stages were architected around crates.io dependencies, where rustc wants to depend on crates.io crates but said crates don't explicitly depend on libstd, requiring a sysroot assembly step in the middle. This same logic was applied for libtest where libtest wants to depend on crates.io crates (`getopts`) but `getopts` didn't say that it depended on std, so it needed `std` built ahead of time. Lots of time has passed since the inception of rustbuild, however, and we've since gotten to the point where even `std` itself is depending on crates.io crates (albeit with some wonky configuration). This commit applies the same logic to the two dependencies that the `test` crate pulls in from crates.io, `getopts` and `unicode-width`. Over the many years since rustbuild's inception `unicode-width` was the only dependency picked up by the `test` crate, so the extra configuration necessary to get crates building in this crate graph is unlikely to be too much of a burden on developers. After this patch it means that there are now only two build phasese of rustbuild, one for libstd and one for rustc. The libtest/libproc_macro build phase is all lumped into one now with `std`. This was originally motivated by rust-lang/cargo#7216 where Cargo was having to deal with synthesizing dependency edges but this commit makes them explicit in this repository.
2019-08-07Fix double resolving custom libdirO01eg-4/+9
2019-07-15Update the stdarch submodulegnzlbg-1/+1