Skip to content

Commit cca4102

Browse files
committed
Add support for x86-64-{2,3,4} target CPUs and pass -Ctarget-cpu=x86-64-v2
1 parent f7801d6 commit cca4102

File tree

6 files changed

+17
-13
lines changed

6 files changed

+17
-13
lines changed

.gitmodules

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
url = https://github.com/rust-lang/edition-guide.git
3737
[submodule "src/llvm-project"]
3838
path = src/llvm-project
39-
url = https://github.com/rust-lang/llvm-project.git
40-
branch = rustc/11.0-2020-10-12
39+
url = https://github.com/est31/llvm-project.git
40+
branch = rustc/11.0-2020-11-14
4141
[submodule "src/doc/embedded-book"]
4242
path = src/doc/embedded-book
4343
url = https://github.com/rust-embedded/book.git

src/bootstrap/check.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ impl Step for Rustc {
149149
target,
150150
cargo_subcommand(builder.kind),
151151
);
152-
rustc_cargo(builder, &mut cargo, target);
152+
rustc_cargo(builder, &mut cargo, target, compiler);
153153
if let Subcommand::Check { all_targets: true, .. } = builder.config.cmd {
154154
cargo.arg("--all-targets");
155155
}
@@ -215,7 +215,7 @@ impl Step for CodegenBackend {
215215
cargo
216216
.arg("--manifest-path")
217217
.arg(builder.src.join(format!("compiler/rustc_codegen_{}/Cargo.toml", backend)));
218-
rustc_cargo_env(builder, &mut cargo, target);
218+
rustc_cargo_env(builder, &mut cargo, target, compiler);
219219

220220
run_cargo(
221221
builder,

src/bootstrap/compile.rs

+10-6
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ impl Step for Rustc {
499499
});
500500

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

504504
builder.info(&format!(
505505
"Building stage{} compiler artifacts ({} -> {})",
@@ -522,16 +522,16 @@ impl Step for Rustc {
522522
}
523523
}
524524

525-
pub fn rustc_cargo(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetSelection) {
525+
pub fn rustc_cargo(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetSelection, compiler: Compiler) {
526526
cargo
527527
.arg("--features")
528528
.arg(builder.rustc_features())
529529
.arg("--manifest-path")
530530
.arg(builder.src.join("compiler/rustc/Cargo.toml"));
531-
rustc_cargo_env(builder, cargo, target);
531+
rustc_cargo_env(builder, cargo, target, compiler);
532532
}
533533

534-
pub fn rustc_cargo_env(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetSelection) {
534+
pub fn rustc_cargo_env(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetSelection, compiler: Compiler) {
535535
// Set some configuration variables picked up by build scripts and
536536
// the compiler alike
537537
cargo
@@ -561,7 +561,11 @@ pub fn rustc_cargo_env(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetS
561561
if builder.config.rust_verify_llvm_ir {
562562
cargo.env("RUSTC_VERIFY_LLVM_IR", "1");
563563
}
564-
564+
if target == "x86_64-unknown-linux-gnu" && compiler.stage > 0 {
565+
if builder.is_rust_llvm(target) {
566+
cargo.rustflag("-Ctarget-cpu=x86-64-v2");
567+
}
568+
}
565569
// Pass down configuration from the LLVM build into the build of
566570
// rustc_llvm and rustc_codegen_llvm.
567571
//
@@ -701,7 +705,7 @@ impl Step for CodegenBackend {
701705
cargo
702706
.arg("--manifest-path")
703707
.arg(builder.src.join(format!("compiler/rustc_codegen_{}/Cargo.toml", backend)));
704-
rustc_cargo_env(builder, &mut cargo, target);
708+
rustc_cargo_env(builder, &mut cargo, target, compiler);
705709

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

src/bootstrap/doc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ impl Step for Rustc {
527527
cargo.rustdocflag("--document-private-items");
528528
cargo.rustdocflag("--enable-index-page");
529529
cargo.rustdocflag("-Zunstable-options");
530-
compile::rustc_cargo(builder, &mut cargo, target);
530+
compile::rustc_cargo(builder, &mut cargo, target, compiler);
531531

532532
// Only include compiler crates, no dependencies of those, such as `libc`.
533533
cargo.arg("--no-deps");

src/bootstrap/test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1732,7 +1732,7 @@ impl Step for Crate {
17321732
}
17331733
Mode::Rustc => {
17341734
builder.ensure(compile::Rustc { compiler, target });
1735-
compile::rustc_cargo(builder, &mut cargo, target);
1735+
compile::rustc_cargo(builder, &mut cargo, target, compiler);
17361736
}
17371737
_ => panic!("can only test libraries"),
17381738
};

0 commit comments

Comments
 (0)