Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build the compiler with -Ctarget-cpu=x86-64-v2 #79043

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
url = https://github.com/rust-lang/edition-guide.git
[submodule "src/llvm-project"]
path = src/llvm-project
url = https://github.com/rust-lang/llvm-project.git
branch = rustc/11.0-2020-10-12
url = https://github.com/est31/llvm-project.git
branch = rustc/11.0-2020-11-14
[submodule "src/doc/embedded-book"]
path = src/doc/embedded-book
url = https://github.com/rust-embedded/book.git
Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ impl Step for Rustc {
target,
cargo_subcommand(builder.kind),
);
rustc_cargo(builder, &mut cargo, target);
rustc_cargo(builder, &mut cargo, target, compiler);
if let Subcommand::Check { all_targets: true, .. } = builder.config.cmd {
cargo.arg("--all-targets");
}
Expand Down Expand Up @@ -215,7 +215,7 @@ impl Step for CodegenBackend {
cargo
.arg("--manifest-path")
.arg(builder.src.join(format!("compiler/rustc_codegen_{}/Cargo.toml", backend)));
rustc_cargo_env(builder, &mut cargo, target);
rustc_cargo_env(builder, &mut cargo, target, compiler);

run_cargo(
builder,
Expand Down
16 changes: 10 additions & 6 deletions src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ impl Step for Rustc {
});

let mut cargo = builder.cargo(compiler, Mode::Rustc, SourceType::InTree, target, "build");
rustc_cargo(builder, &mut cargo, target);
rustc_cargo(builder, &mut cargo, target, compiler);

builder.info(&format!(
"Building stage{} compiler artifacts ({} -> {})",
Expand All @@ -522,16 +522,16 @@ impl Step for Rustc {
}
}

pub fn rustc_cargo(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetSelection) {
pub fn rustc_cargo(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetSelection, compiler: Compiler) {
cargo
.arg("--features")
.arg(builder.rustc_features())
.arg("--manifest-path")
.arg(builder.src.join("compiler/rustc/Cargo.toml"));
rustc_cargo_env(builder, cargo, target);
rustc_cargo_env(builder, cargo, target, compiler);
}

pub fn rustc_cargo_env(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetSelection) {
pub fn rustc_cargo_env(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetSelection, compiler: Compiler) {
// Set some configuration variables picked up by build scripts and
// the compiler alike
cargo
Expand Down Expand Up @@ -561,7 +561,11 @@ pub fn rustc_cargo_env(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetS
if builder.config.rust_verify_llvm_ir {
cargo.env("RUSTC_VERIFY_LLVM_IR", "1");
}

if target == "x86_64-unknown-linux-gnu" && compiler.stage > 0 {
if builder.is_rust_llvm(target) {
cargo.rustflag("-Ctarget-cpu=x86-64-v3");
}
}
// Pass down configuration from the LLVM build into the build of
// rustc_llvm and rustc_codegen_llvm.
//
Expand Down Expand Up @@ -701,7 +705,7 @@ impl Step for CodegenBackend {
cargo
.arg("--manifest-path")
.arg(builder.src.join(format!("compiler/rustc_codegen_{}/Cargo.toml", backend)));
rustc_cargo_env(builder, &mut cargo, target);
rustc_cargo_env(builder, &mut cargo, target, compiler);

let tmp_stamp = out_dir.join(".tmp.stamp");

Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ impl Step for Rustc {
cargo.rustdocflag("--document-private-items");
cargo.rustdocflag("--enable-index-page");
cargo.rustdocflag("-Zunstable-options");
compile::rustc_cargo(builder, &mut cargo, target);
compile::rustc_cargo(builder, &mut cargo, target, compiler);

// Only include compiler crates, no dependencies of those, such as `libc`.
cargo.arg("--no-deps");
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1732,7 +1732,7 @@ impl Step for Crate {
}
Mode::Rustc => {
builder.ensure(compile::Rustc { compiler, target });
compile::rustc_cargo(builder, &mut cargo, target);
compile::rustc_cargo(builder, &mut cargo, target, compiler);
}
_ => panic!("can only test libraries"),
};
Expand Down