From cfe8e8561c2cc31ff51a298bc1dfd0636eaffa13 Mon Sep 17 00:00:00 2001 From: jyn Date: Sat, 20 May 2023 10:40:30 -0500 Subject: Make `x test --dry-run` less verbose Previously, this would print a message for each doctest, which was quite verbose: ``` doc tests for: /home/jyn/src/rust/src/doc/rustc/src/exploit-mitigations.md doc tests for: /home/jyn/src/rust/src/doc/rustc/src/instrument-coverage.md doc tests for: /home/jyn/src/rust/src/doc/rustc/src/json.md doc tests for: /home/jyn/src/rust/src/doc/rustc/src/linker-plugin-lto.md doc tests for: /home/jyn/src/rust/src/doc/rustc/src/lints/groups.md doc tests for: /home/jyn/src/rust/src/doc/rustc/src/lints/index.md doc tests for: /home/jyn/src/rust/src/doc/rustc/src/lints/levels.md doc tests for: /home/jyn/src/rust/src/doc/rustc/src/platform-support/aarch64-apple-ios-sim.md doc tests for: /home/jyn/src/rust/src/doc/rustc/src/platform-support/aarch64-nintendo-switch-freestanding.md doc tests for: /home/jyn/src/rust/src/doc/rustc/src/platform-support/apple-watchos.md doc tests for: /home/jyn/src/rust/src/doc/rustc/src/platform-support/armeb-unknown-linux-gnueabi.md doc tests for: /home/jyn/src/rust/src/doc/rustc/src/platform-support/armv4t-none-eabi.md doc tests for: /home/jyn/src/rust/src/doc/rustc/src/platform-support/armv5te-none-eabi.md doc tests for: /home/jyn/src/rust/src/doc/rustc/src/platform-support/armv6k-nintendo-3ds.md doc tests for: /home/jyn/src/rust/src/doc/rustc/src/platform-support/armv7-sony-vita-newlibeabihf.md doc tests for: /home/jyn/src/rust/src/doc/rustc/src/platform-support/armv7-unknown-linux-uclibceabi.md doc tests for: /home/jyn/src/rust/src/doc/rustc/src/platform-support/armv7-unknown-linux-uclibceabihf.md doc tests for: /home/jyn/src/rust/src/doc/rustc/src/platform-support/esp-idf.md doc tests for: /home/jyn/src/rust/src/doc/rustc/src/platform-support/fuchsia.md doc tests for: /home/jyn/src/rust/src/doc/rustc/src/platform-support/kmc-solid.md doc tests for: /home/jyn/src/rust/src/doc/rustc/src/platform-support/loongarch-linux.md doc tests for: /home/jyn/src/rust/src/doc/rustc/src/platform-support/m68k-unknown-linux-gnu.md doc tests for: /home/jyn/src/rust/src/doc/rustc/src/platform-support/mipsel-sony-psx.md doc tests for: /home/jyn/src/rust/src/doc/rustc/src/platform-support/nto-qnx.md doc tests for: /home/jyn/src/rust/src/doc/rustc/src/platform-support/openbsd.md doc tests for: /home/jyn/src/rust/src/doc/rustc/src/platform-support/openharmony.md doc tests for: /home/jyn/src/rust/src/doc/rustc/src/platform-support/riscv32imac-unknown-xous-elf.md doc tests for: /home/jyn/src/rust/src/doc/rustc/src/platform-support/unknown-uefi.md doc tests for: /home/jyn/src/rust/src/doc/rustc/src/platform-support/wasm64-unknown-unknown.md doc tests for: /home/jyn/src/rust/src/doc/rustc/src/platform-support/x86_64-fortanix-unknown-sgx.md doc tests for: /home/jyn/src/rust/src/doc/rustc/src/platform-support/x86_64-unknown-none.md doc tests for: /home/jyn/src/rust/src/doc/rustc/src/profile-guided-optimization.md doc tests for: /home/jyn/src/rust/src/doc/rustc/src/target-tier-policy.md doc tests for: /home/jyn/src/rust/src/doc/rustc/src/targets/custom.md doc tests for: /home/jyn/src/rust/src/doc/rustc/src/targets/index.md doc tests for: /home/jyn/src/rust/src/doc/rustc/src/tests/index.md doc tests for: /home/jyn/src/rust/src/doc/rustc/src/what-is-rustc.md ``` --- src/bootstrap/test.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 2d600704e02..27b1f76a069 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -1796,6 +1796,14 @@ impl Step for BookTest { /// /// This uses the `rustdoc` that sits next to `compiler`. fn run(self, builder: &Builder<'_>) { + let host = self.compiler.host; + let _guard = builder.msg( + Kind::Test, + self.compiler.stage, + &format!("book {}", self.name), + host, + host, + ); // External docs are different from local because: // - Some books need pre-processing by mdbook before being tested. // - They need to save their state to toolstate. @@ -1987,7 +1995,7 @@ fn markdown_test(builder: &Builder<'_>, compiler: Compiler, markdown: &Path) -> } } - builder.info(&format!("doc tests for: {}", markdown.display())); + builder.verbose(&format!("doc tests for: {}", markdown.display())); let mut cmd = builder.rustdoc_cmd(compiler); builder.add_rust_test_threads(&mut cmd); // allow for unstable options such as new editions -- cgit 1.4.1-3-g733a5 From 64025bb168f3ae37428387ca37ba89eb80be6544 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Mon, 1 May 2023 10:05:44 -0700 Subject: bootstrap: enable Cargo `public-dependency` feature for `libstd` --- library/std/Cargo.toml | 10 ++++++---- library/std/tests/common/mod.rs | 2 ++ src/bootstrap/metadata.rs | 1 + src/tools/tidy/src/main.rs | 4 ++++ 4 files changed, 13 insertions(+), 4 deletions(-) (limited to 'src/bootstrap') diff --git a/library/std/Cargo.toml b/library/std/Cargo.toml index 824abc72a22..4765bb5d25a 100644 --- a/library/std/Cargo.toml +++ b/library/std/Cargo.toml @@ -1,3 +1,5 @@ +cargo-features = ["public-dependency"] + [package] name = "std" version = "0.0.0" @@ -10,12 +12,12 @@ edition = "2021" crate-type = ["dylib", "rlib"] [dependencies] -alloc = { path = "../alloc" } +alloc = { path = "../alloc", public = true } cfg-if = { version = "1.0", features = ['rustc-dep-of-std'] } panic_unwind = { path = "../panic_unwind", optional = true } panic_abort = { path = "../panic_abort" } -core = { path = "../core" } -libc = { version = "0.2.143", default-features = false, features = ['rustc-dep-of-std'] } +core = { path = "../core", public = true } +libc = { version = "0.2.143", default-features = false, features = ['rustc-dep-of-std'], public = true } compiler_builtins = { version = "0.1.92" } profiler_builtins = { path = "../profiler_builtins", optional = true } unwind = { path = "../unwind" } @@ -25,7 +27,7 @@ std_detect = { path = "../stdarch/crates/std_detect", default-features = false, # Dependencies of the `backtrace` crate addr2line = { version = "0.19.0", optional = true, default-features = false } rustc-demangle = { version = "0.1.21", features = ['rustc-dep-of-std'] } -miniz_oxide = { version = "0.6.0", optional = true, default-features = false } +miniz_oxide = { version = "0.6.0", optional = true, default-features = false, public = false } [dependencies.object] version = "0.30.0" optional = true diff --git a/library/std/tests/common/mod.rs b/library/std/tests/common/mod.rs index fce220223a0..37336e1c08f 100644 --- a/library/std/tests/common/mod.rs +++ b/library/std/tests/common/mod.rs @@ -1,5 +1,7 @@ #![allow(unused)] +#![allow(exported_private_dependencies)] + use std::env; use std::fs; use std::path::{Path, PathBuf}; diff --git a/src/bootstrap/metadata.rs b/src/bootstrap/metadata.rs index 8f2c3faca3a..d8671ef2639 100644 --- a/src/bootstrap/metadata.rs +++ b/src/bootstrap/metadata.rs @@ -74,6 +74,7 @@ fn workspace_members(build: &Build) -> impl Iterator { let collect_metadata = |manifest_path| { let mut cargo = Command::new(&build.initial_cargo); cargo + .env("RUSTC_BOOTSTRAP", "1") .arg("metadata") .arg("--format-version") .arg("1") diff --git a/src/tools/tidy/src/main.rs b/src/tools/tidy/src/main.rs index f59406c404b..2ad0ae527ac 100644 --- a/src/tools/tidy/src/main.rs +++ b/src/tools/tidy/src/main.rs @@ -16,6 +16,10 @@ use std::sync::atomic::{AtomicBool, Ordering}; use std::thread::{self, scope, ScopedJoinHandle}; fn main() { + // Allow using unstable cargo features in the standard library. + // `setenv` might not be thread safe, so run it before using multiple threads. + env::set_var("RUSTC_BOOTSTRAP", "1"); + let root_path: PathBuf = env::args_os().nth(1).expect("need path to root of repo").into(); let cargo: PathBuf = env::args_os().nth(2).expect("need path to cargo").into(); let output_directory: PathBuf = -- cgit 1.4.1-3-g733a5 From 374024336a0dfed4a5cf5e97ccc99648b18cf00c Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Mon, 8 May 2023 12:04:27 -0700 Subject: Improve comments --- compiler/rustc_metadata/src/rmeta/decoder.rs | 5 +++-- src/bootstrap/metadata.rs | 2 ++ src/tools/rust-installer/combine-installers.sh | 2 ++ src/tools/rust-installer/gen-installer.sh | 2 ++ src/tools/rust-installer/make-tarballs.sh | 2 ++ src/tools/tidy/src/main.rs | 4 +++- 6 files changed, 14 insertions(+), 3 deletions(-) (limited to 'src/bootstrap') diff --git a/compiler/rustc_metadata/src/rmeta/decoder.rs b/compiler/rustc_metadata/src/rmeta/decoder.rs index 46d469f0703..ccba77d7aa7 100644 --- a/compiler/rustc_metadata/src/rmeta/decoder.rs +++ b/compiler/rustc_metadata/src/rmeta/decoder.rs @@ -111,8 +111,9 @@ pub(crate) struct CrateMetadata { dep_kind: Lock, /// Filesystem location of this crate. source: Lrc, - /// Whether or not this crate should be consider a private dependency - /// for purposes of the 'exported_private_dependencies' lint + /// Whether or not this crate should be consider a private dependency. + /// Used by the 'exported_private_dependencies' lint, and for determining + /// whether to emit suggestions that reference this crate. private_dep: Lock, /// The hash for the host proc macro. Used to support `-Z dual-proc-macro`. host_hash: Option, diff --git a/src/bootstrap/metadata.rs b/src/bootstrap/metadata.rs index d8671ef2639..3b20ceac875 100644 --- a/src/bootstrap/metadata.rs +++ b/src/bootstrap/metadata.rs @@ -74,6 +74,8 @@ fn workspace_members(build: &Build) -> impl Iterator { let collect_metadata = |manifest_path| { let mut cargo = Command::new(&build.initial_cargo); cargo + // Will read the libstd Cargo.toml + // which uses the unstable `public-dependency` feature. .env("RUSTC_BOOTSTRAP", "1") .arg("metadata") .arg("--format-version") diff --git a/src/tools/rust-installer/combine-installers.sh b/src/tools/rust-installer/combine-installers.sh index c2de3385a80..01e5a00af4a 100755 --- a/src/tools/rust-installer/combine-installers.sh +++ b/src/tools/rust-installer/combine-installers.sh @@ -11,6 +11,8 @@ abs_path() { (unset CDPATH && cd "$path" > /dev/null && pwd) } +# Running cargo will read the libstd Cargo.toml +# which uses the unstable `public-dependency` feature. export RUSTC_BOOTSTRAP=1 src_dir="$(abs_path $(dirname "$0"))" diff --git a/src/tools/rust-installer/gen-installer.sh b/src/tools/rust-installer/gen-installer.sh index 10a69ff5ac5..cc45b5e0803 100755 --- a/src/tools/rust-installer/gen-installer.sh +++ b/src/tools/rust-installer/gen-installer.sh @@ -11,6 +11,8 @@ abs_path() { (unset CDPATH && cd "$path" > /dev/null && pwd) } +# Running cargo will read the libstd Cargo.toml +# which uses the unstable `public-dependency` feature. export RUSTC_BOOTSTRAP=1 src_dir="$(abs_path $(dirname "$0"))" diff --git a/src/tools/rust-installer/make-tarballs.sh b/src/tools/rust-installer/make-tarballs.sh index 4aadf078ff1..374e103e89c 100755 --- a/src/tools/rust-installer/make-tarballs.sh +++ b/src/tools/rust-installer/make-tarballs.sh @@ -11,6 +11,8 @@ abs_path() { (unset CDPATH && cd "$path" > /dev/null && pwd) } +# Running cargo will read the libstd Cargo.toml +# which uses the unstable `public-dependency` feature. export RUSTC_BOOTSTRAP=1 src_dir="$(abs_path $(dirname "$0"))" diff --git a/src/tools/tidy/src/main.rs b/src/tools/tidy/src/main.rs index 2ad0ae527ac..a9eada22fc0 100644 --- a/src/tools/tidy/src/main.rs +++ b/src/tools/tidy/src/main.rs @@ -16,7 +16,9 @@ use std::sync::atomic::{AtomicBool, Ordering}; use std::thread::{self, scope, ScopedJoinHandle}; fn main() { - // Allow using unstable cargo features in the standard library. + // Running Cargo will read the libstd Cargo.toml + // which uses the unstable `public-dependency` feature. + // // `setenv` might not be thread safe, so run it before using multiple threads. env::set_var("RUSTC_BOOTSTRAP", "1"); -- cgit 1.4.1-3-g733a5 From 2e52f4deb0544480b6aefe2c0cc1e6f3c893b081 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Mon, 15 May 2023 22:28:08 -0700 Subject: bootstrap: use RUSTC_BOOTSTRAP to vendor sources --- src/bootstrap/dist.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/bootstrap') diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index b49845386da..338667de03a 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -1013,6 +1013,9 @@ impl Step for PlainSourceTarball { .arg(builder.src.join("./compiler/rustc_codegen_cranelift/Cargo.toml")) .arg("--sync") .arg(builder.src.join("./src/bootstrap/Cargo.toml")) + // Will read the libstd Cargo.toml + // which uses the unstable `public-dependency` feature. + .env("RUSTC_BOOTSTRAP", "1") .current_dir(&plain_dst_src); let config = if !builder.config.dry_run() { -- cgit 1.4.1-3-g733a5 From 64cfc212890515fe4c41374acbc986034450d3b7 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Thu, 25 May 2023 15:12:33 -0700 Subject: bootstrap: use RUSTC_BOOTSTRAP in distcheck --- src/bootstrap/test.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/bootstrap') diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 2b72d6c48eb..8b6048464e8 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -2514,6 +2514,9 @@ impl Step for Distcheck { let toml = dir.join("rust-src/lib/rustlib/src/rust/library/std/Cargo.toml"); builder.run( Command::new(&builder.initial_cargo) + // Will read the libstd Cargo.toml + // which uses the unstable `public-dependency` feature. + .env("RUSTC_BOOTSTRAP", "1") .arg("generate-lockfile") .arg("--manifest-path") .arg(&toml) -- cgit 1.4.1-3-g733a5 From 6674dcda7a1da4c66e0aa0cfc67b27e42f4ebb34 Mon Sep 17 00:00:00 2001 From: jyn Date: Sun, 21 May 2023 16:34:19 -0500 Subject: respect CARGOFLAGS in bootstrap.py --- src/bootstrap/bootstrap.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/bootstrap') diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index 50ace987193..d75ffd4ac22 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -917,6 +917,10 @@ class RustBuild(object): args.append("--color=always") elif color == "never": args.append("--color=never") + try: + args += env["CARGOFLAGS"].split() + except KeyError: + pass # Run this from the source directory so cargo finds .cargo/config run(args, env=env, verbose=self.verbose, cwd=self.rust_root) -- cgit 1.4.1-3-g733a5 From 157d936c31e4f5ff51cc6f20c748e16537f33b9c Mon Sep 17 00:00:00 2001 From: jyn Date: Thu, 25 May 2023 20:42:13 -0500 Subject: Stop normalizing so many different prefixes Previously, we would normalize *all* of - the absolute path to the repository checkout - the /rustc/$sha for stage1 (if `remap-debuginfo` was enabled) - the /rustc/$sha for download-rustc - the sysroot for download-rustc Now, we consistently only normalize /rustc/FAKE_PREFIX. Not only is this much simpler, but it also avoids ongoing maintenance for download-rustc and makes it much less likely that tests break by accident. - Change `tests/ui/track-diagnostics/track6.rs` to use a relative path instead of an absolute one. I am not actually sure why `track_caller` works here, but it does seem to work :shrug: - Pass `-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX` to all suites, not just UI. In particular, mir-opt tests emit /rustc/ paths in their output. --- compiler/rustc_session/src/parse.rs | 1 + src/bootstrap/test.rs | 4 --- src/tools/compiletest/src/runtest.rs | 47 ++++++++++++-------------------- tests/ui/track-diagnostics/track6.stderr | 2 +- 4 files changed, 20 insertions(+), 34 deletions(-) (limited to 'src/bootstrap') diff --git a/compiler/rustc_session/src/parse.rs b/compiler/rustc_session/src/parse.rs index 7b396dde91b..0184fec8e3e 100644 --- a/compiler/rustc_session/src/parse.rs +++ b/compiler/rustc_session/src/parse.rs @@ -84,6 +84,7 @@ impl SymbolGallery { /// Construct a diagnostic for a language feature error due to the given `span`. /// The `feature`'s `Symbol` is the one you used in `active.rs` and `rustc_span::symbols`. +#[track_caller] pub fn feature_err( sess: &ParseSess, feature: Symbol, diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 2b72d6c48eb..b495ed65268 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -1753,10 +1753,6 @@ note: if you're sure you want to do this, please open an issue as to why. In the cmd.arg("--git-hash"); } - if let Some(commit) = builder.config.download_rustc_commit() { - cmd.env("FAKE_DOWNLOAD_RUSTC_PREFIX", format!("/rustc/{commit}")); - } - builder.ci_env.force_coloring_in_ci(&mut cmd); builder.info(&format!( diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 5bc4d164265..c2e18ce2547 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -1939,6 +1939,17 @@ impl<'test> TestCx<'test> { // Use a single thread for efficiency and a deterministic error message order rustc.arg("-Zthreads=1"); + // Hide libstd sources from ui tests to make sure we generate the stderr + // output that users will see. + // Without this, we may be producing good diagnostics in-tree but users + // will not see half the information. + // + // This also has the benefit of more effectively normalizing output between different + // compilers, so that we don't have to know the `/rustc/$sha` output to normalize after the + // fact. + rustc.arg("-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX"); + rustc.arg("-Ztranslate-remapped-path-to-local-path=no"); + // Optionally prevent default --sysroot if specified in test compile-flags. if !self.props.compile_flags.iter().any(|flag| flag.starts_with("--sysroot")) { // In stage 0, make sure we use `stage0-sysroot` instead of the bootstrap sysroot. @@ -2014,13 +2025,6 @@ impl<'test> TestCx<'test> { rustc.arg("-Ccodegen-units=1"); // Hide line numbers to reduce churn rustc.arg("-Zui-testing"); - // Hide libstd sources from ui tests to make sure we generate the stderr - // output that users will see. - // Without this, we may be producing good diagnostics in-tree but users - // will not see half the information. - rustc.arg("-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX"); - rustc.arg("-Ztranslate-remapped-path-to-local-path=no"); - rustc.arg("-Zdeduplicate-diagnostics=no"); // FIXME: use this for other modes too, for perf? rustc.arg("-Cstrip=debuginfo"); @@ -3729,28 +3733,13 @@ impl<'test> TestCx<'test> { normalize_path(&remapped_parent_dir, "$DIR"); } - let source_bases = &[ - // Source base on the current filesystem (calculated as parent of `tests/$suite`): - Some(self.config.src_base.parent().unwrap().parent().unwrap().into()), - // Source base on the sysroot (from the src components downloaded by `download-rustc`): - Some(self.config.sysroot_base.join("lib").join("rustlib").join("src").join("rust")), - // Virtual `/rustc/$sha` remapped paths (if `remap-debuginfo` is enabled): - option_env!("CFG_VIRTUAL_RUST_SOURCE_BASE_DIR").map(PathBuf::from), - // Virtual `/rustc/$sha` coming from download-rustc: - std::env::var_os("FAKE_DOWNLOAD_RUSTC_PREFIX").map(PathBuf::from), - // Tests using -Zsimulate-remapped-rust-src-base should use this fake path - Some("/rustc/FAKE_PREFIX".into()), - ]; - for base_dir in source_bases { - if let Some(base_dir) = base_dir { - // Paths into the libstd/libcore - normalize_path(&base_dir.join("library"), "$SRC_DIR"); - // `ui-fulldeps` tests can show paths to the compiler source when testing macros from - // `rustc_macros` - // eg. /home/user/rust/compiler - normalize_path(&base_dir.join("compiler"), "$COMPILER_DIR"); - } - } + let base_dir = Path::new("/rustc/FAKE_PREFIX"); + // Paths into the libstd/libcore + normalize_path(&base_dir.join("library"), "$SRC_DIR"); + // `ui-fulldeps` tests can show paths to the compiler source when testing macros from + // `rustc_macros` + // eg. /home/user/rust/compiler + normalize_path(&base_dir.join("compiler"), "$COMPILER_DIR"); // Paths into the build directory let test_build_dir = &self.config.build_base; diff --git a/tests/ui/track-diagnostics/track6.stderr b/tests/ui/track-diagnostics/track6.stderr index 89438aea9ad..583b02555b4 100644 --- a/tests/ui/track-diagnostics/track6.stderr +++ b/tests/ui/track-diagnostics/track6.stderr @@ -3,7 +3,7 @@ error[E0658]: specialization is unstable | LL | default fn bar() {} | ^^^^^^^^^^^^^^^^^^^ --Ztrack-diagnostics: created at $COMPILER_DIR/rustc_session/src/parse.rs:LL:CC +-Ztrack-diagnostics: created at compiler/rustc_ast_passes/src/feature_gate.rs:LL:CC | = note: see issue #31844 for more information = help: add `#![feature(specialization)]` to the crate attributes to enable -- cgit 1.4.1-3-g733a5 From b65c2afdfd9aaee977302516c9ef177861abfe74 Mon Sep 17 00:00:00 2001 From: Ximin Luo Date: Thu, 18 May 2023 22:21:59 -0600 Subject: Fix linkage for large binaries on mips64 platforms ... ... by enabling xgot feature Co-Authored-By: Zixing Liu --- .../rustc_target/src/spec/mips64_unknown_linux_gnuabi64.rs | 2 +- .../rustc_target/src/spec/mips64el_unknown_linux_gnuabi64.rs | 2 +- src/bootstrap/bootstrap.py | 6 ++++++ tests/assembly/asm/mips-types.rs | 12 ++++++++---- 4 files changed, 16 insertions(+), 6 deletions(-) (limited to 'src/bootstrap') diff --git a/compiler/rustc_target/src/spec/mips64_unknown_linux_gnuabi64.rs b/compiler/rustc_target/src/spec/mips64_unknown_linux_gnuabi64.rs index fc5dbd114e4..b9df0046b12 100644 --- a/compiler/rustc_target/src/spec/mips64_unknown_linux_gnuabi64.rs +++ b/compiler/rustc_target/src/spec/mips64_unknown_linux_gnuabi64.rs @@ -12,7 +12,7 @@ pub fn target() -> Target { endian: Endian::Big, // NOTE(mips64r2) matches C toolchain cpu: "mips64r2".into(), - features: "+mips64r2".into(), + features: "+mips64r2,+xgot".into(), max_atomic_width: Some(64), mcount: "_mcount".into(), diff --git a/compiler/rustc_target/src/spec/mips64el_unknown_linux_gnuabi64.rs b/compiler/rustc_target/src/spec/mips64el_unknown_linux_gnuabi64.rs index e0d5f6f57f1..57ad8c47399 100644 --- a/compiler/rustc_target/src/spec/mips64el_unknown_linux_gnuabi64.rs +++ b/compiler/rustc_target/src/spec/mips64el_unknown_linux_gnuabi64.rs @@ -10,7 +10,7 @@ pub fn target() -> Target { abi: "abi64".into(), // NOTE(mips64r2) matches C toolchain cpu: "mips64r2".into(), - features: "+mips64r2".into(), + features: "+mips64r2,+xgot".into(), max_atomic_width: Some(64), mcount: "_mcount".into(), diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index 58d1926ad96..de484f3a571 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -877,6 +877,12 @@ class RustBuild(object): # preserve existing RUSTFLAGS env.setdefault("RUSTFLAGS", "") + # we need to explicitly add +xgot here so that we can successfully bootstrap + # a usable stage1 compiler + # FIXME: remove this if condition on the next bootstrap bump + # cfg(bootstrap) + if self.build_triple().startswith('mips'): + env["RUSTFLAGS"] += " -Ctarget-feature=+xgot" target_features = [] if self.get_toml("crt-static", build_section) == "true": target_features += ["+crt-static"] diff --git a/tests/assembly/asm/mips-types.rs b/tests/assembly/asm/mips-types.rs index 6aa28b062db..27469b22980 100644 --- a/tests/assembly/asm/mips-types.rs +++ b/tests/assembly/asm/mips-types.rs @@ -72,7 +72,7 @@ macro_rules! check_reg { ($func:ident, $ty:ty, $reg:tt, $mov:literal) => { // mips32-LABEL: sym_static_32: // mips32: #APP -// mips32: lw $3, %got(extern_static) +// mips32: lw $3, %got(extern_static)($gp) // mips32: #NO_APP #[cfg(mips32)] #[no_mangle] @@ -82,7 +82,7 @@ pub unsafe fn sym_static_32() { // mips32-LABEL: sym_fn_32: // mips32: #APP -// mips32: lw $3, %got(extern_func) +// mips32: lw $3, %got(extern_func)($gp) // mips32: #NO_APP #[cfg(mips32)] #[no_mangle] @@ -92,7 +92,9 @@ pub unsafe fn sym_fn_32() { // mips64-LABEL: sym_static_64: // mips64: #APP -// mips64: ld $3, %got_disp(extern_static) +// mips64: lui $3, %got_hi(extern_static) +// mips64: daddu $3, $3, $gp +// mips64: ld $3, %got_lo(extern_static)($3) // mips64: #NO_APP #[cfg(mips64)] #[no_mangle] @@ -102,7 +104,9 @@ pub unsafe fn sym_static_64() { // mips64-LABEL: sym_fn_64: // mips64: #APP -// mips64: ld $3, %got_disp(extern_func) +// mips64: lui $3, %got_hi(extern_func) +// mips64: daddu $3, $3, $gp +// mips64: ld $3, %got_lo(extern_func)($3) // mips64: #NO_APP #[cfg(mips64)] #[no_mangle] -- cgit 1.4.1-3-g733a5 From 023e6c4be3785d0d8260b3c0d4fd87b88d9b48d9 Mon Sep 17 00:00:00 2001 From: Jakub Beránek Date: Tue, 30 May 2023 00:03:51 +0200 Subject: Add `--warnings warn` flag to `x.py` So that bootstrap itself can be built with warnings not being treated as errors. --- src/bootstrap/bootstrap.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index 58d1926ad96..06c30842e17 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -835,7 +835,7 @@ class RustBuild(object): """ return os.path.join(self.build_dir, "bootstrap", "debug", "bootstrap") - def build_bootstrap(self, color, verbose_count): + def build_bootstrap(self, color, warnings, verbose_count): """Build bootstrap""" env = os.environ.copy() if "GITHUB_ACTIONS" in env: @@ -888,7 +888,11 @@ class RustBuild(object): if target_linker is not None: env["RUSTFLAGS"] += " -C linker=" + target_linker env["RUSTFLAGS"] += " -Wrust_2018_idioms -Wunused_lifetimes" - if self.get_toml("deny-warnings", "rust") != "false": + if warnings == "default": + deny_warnings = self.get_toml("deny-warnings", "rust") != "false" + else: + deny_warnings = warnings == "deny" + if deny_warnings: env["RUSTFLAGS"] += " -Dwarnings" env["PATH"] = os.path.join(self.bin_root(), "bin") + \ @@ -977,6 +981,7 @@ def parse_args(): parser.add_argument('--color', choices=['always', 'never', 'auto']) parser.add_argument('--clean', action='store_true') parser.add_argument('--json-output', action='store_true') + parser.add_argument('--warnings', choices=['deny', 'warn', 'default'], default='default') parser.add_argument('-v', '--verbose', action='count', default=0) return parser.parse_known_args(sys.argv)[0] @@ -1042,7 +1047,7 @@ def bootstrap(args): # Fetch/build the bootstrap build.download_toolchain() sys.stdout.flush() - build.build_bootstrap(args.color, verbose_count) + build.build_bootstrap(args.color, args.warnings, verbose_count) sys.stdout.flush() # Run the bootstrap -- cgit 1.4.1-3-g733a5