Skip to content

Commit 3ee2c52

Browse files
authored
Rollup merge of rust-lang#116263 - ferrocene:pa-more-bare-metal-fixes, r=oli-obk
More fixes for running the test suite on a bare metal target This PR adds more fixes needed to run the test suite on bare metal targets (in this case, without unwinding and with static relocations). There is no CI job exercising tests without unwinds, but I can confirm this worked in Ferrocene's CI.
2 parents 4db2b74 + 3853774 commit 3ee2c52

8 files changed

+17
-4
lines changed

Diff for: src/tools/compiletest/src/common.rs

+6
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,8 @@ pub struct TargetCfg {
580580
pub(crate) sanitizers: Vec<Sanitizer>,
581581
#[serde(rename = "supports-xray", default)]
582582
pub(crate) xray: bool,
583+
#[serde(default = "default_reloc_model")]
584+
pub(crate) relocation_model: String,
583585
}
584586

585587
impl TargetCfg {
@@ -592,6 +594,10 @@ fn default_os() -> String {
592594
"none".into()
593595
}
594596

597+
fn default_reloc_model() -> String {
598+
"pic".into()
599+
}
600+
595601
#[derive(Eq, PartialEq, Clone, Debug, Default, serde::Deserialize)]
596602
#[serde(rename_all = "kebab-case")]
597603
pub enum Endian {

Diff for: src/tools/compiletest/src/header/needs.rs

+5
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,11 @@ pub(super) fn handle_needs(
134134
condition: config.target_cfg().dynamic_linking,
135135
ignore_reason: "ignored on targets without dynamic linking",
136136
},
137+
Need {
138+
name: "needs-relocation-model-pic",
139+
condition: config.target_cfg().relocation_model == "pic",
140+
ignore_reason: "ignored on targets without PIC relocation model",
141+
},
137142
];
138143

139144
let (name, comment) = match ln.split_once([':', ' ']) {

Diff for: tests/incremental/change_crate_dep_kind.rs

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// needs-unwind
66
// revisions:cfail1 cfail2
77
// compile-flags: -Z query-dep-graph -Cpanic=unwind
8+
// needs-unwind
89
// build-pass (FIXME(62277): could be check-pass?)
910

1011
#![feature(panic_unwind)]

Diff for: tests/ui/abi/relocation_model_pic.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// run-pass
22
// compile-flags: -C relocation-model=pic
3-
// ignore-emscripten no pic
4-
// ignore-wasm
3+
// needs-relocation-model-pic
54

65
#![feature(cfg_relocation_model)]
76

Diff for: tests/ui/panics/short-ice-remove-middle-frames-2.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// run-fail
33
// check-run-results
44
// exec-env:RUST_BACKTRACE=1
5+
// needs-unwind
56
// ignore-android FIXME #17520
67
// ignore-wasm no panic support
78
// ignore-openbsd no support for libbacktrace without filename

Diff for: tests/ui/panics/short-ice-remove-middle-frames-2.run.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
thread 'main' panicked at $DIR/short-ice-remove-middle-frames-2.rs:56:5:
1+
thread 'main' panicked at $DIR/short-ice-remove-middle-frames-2.rs:57:5:
22
debug!!!
33
stack backtrace:
44
0: std::panicking::begin_panic

Diff for: tests/ui/panics/short-ice-remove-middle-frames.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// run-fail
33
// check-run-results
44
// exec-env:RUST_BACKTRACE=1
5+
// needs-unwind
56
// ignore-android FIXME #17520
67
// ignore-wasm no panic support
78
// ignore-openbsd no support for libbacktrace without filename

Diff for: tests/ui/panics/short-ice-remove-middle-frames.run.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
thread 'main' panicked at $DIR/short-ice-remove-middle-frames.rs:52:5:
1+
thread 'main' panicked at $DIR/short-ice-remove-middle-frames.rs:53:5:
22
debug!!!
33
stack backtrace:
44
0: std::panicking::begin_panic

0 commit comments

Comments
 (0)