diff options
| author | bors <bors@rust-lang.org> | 2025-01-30 20:21:50 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-01-30 20:21:50 +0000 |
| commit | a730edcd67c7cb29d4458e170d4eb290387c27c3 (patch) | |
| tree | f13c435c36768d04e0e503ad556bb9165c1f4a17 /tests/run-make | |
| parent | 6ac88786155774da429213a1362d4cb085047af3 (diff) | |
| parent | 53238c3db6b293546f0b3bbd835ca85517ae9d8f (diff) | |
| download | rust-a730edcd67c7cb29d4458e170d4eb290387c27c3.tar.gz rust-a730edcd67c7cb29d4458e170d4eb290387c27c3.zip | |
Auto merge of #135030 - Flakebi:require-cpu, r=workingjubilee
Target option to require explicit cpu Some targets have many different CPUs and no generic CPU that can be used as a default. For these targets, the user needs to explicitly specify a CPU through `-C target-cpu=`. Add an option for targets and an error message if no CPU is set. This affects the proposed amdgpu and avr targets. amdgpu tracking issue: #135024 AVR MCP: https://github.com/rust-lang/compiler-team/issues/800
Diffstat (limited to 'tests/run-make')
| -rw-r--r-- | tests/run-make/target-specs/require-explicit-cpu.json | 11 | ||||
| -rw-r--r-- | tests/run-make/target-specs/rmake.rs | 13 |
2 files changed, 24 insertions, 0 deletions
diff --git a/tests/run-make/target-specs/require-explicit-cpu.json b/tests/run-make/target-specs/require-explicit-cpu.json new file mode 100644 index 00000000000..5cbb9573b3f --- /dev/null +++ b/tests/run-make/target-specs/require-explicit-cpu.json @@ -0,0 +1,11 @@ +{ + "data-layout": "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i128:128-f64:32:64-f80:32-n8:16:32-S128", + "linker-flavor": "gcc", + "llvm-target": "i686-unknown-linux-gnu", + "target-endian": "little", + "target-pointer-width": "32", + "target-c-int-width": "32", + "arch": "x86", + "os": "linux", + "need-explicit-cpu": true +} diff --git a/tests/run-make/target-specs/rmake.rs b/tests/run-make/target-specs/rmake.rs index 79c888ab340..f36a5784c89 100644 --- a/tests/run-make/target-specs/rmake.rs +++ b/tests/run-make/target-specs/rmake.rs @@ -63,4 +63,17 @@ fn main() { .crate_type("lib") .run_fail() .assert_stderr_contains("data-layout for target"); + rustc() + .input("foo.rs") + .target("require-explicit-cpu") + .crate_type("lib") + .run_fail() + .assert_stderr_contains("target requires explicitly specifying a cpu"); + rustc() + .input("foo.rs") + .target("require-explicit-cpu") + .crate_type("lib") + .arg("-Ctarget-cpu=generic") + .run(); + rustc().target("require-explicit-cpu").arg("--print=target-cpus").run(); } |
