Skip to content

Commit

Permalink
Unrolled build for rust-lang#116263
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rust-timer authored Sep 29, 2023
2 parents 56ada88 + 3853774 commit 4759812
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 4 deletions.
6 changes: 6 additions & 0 deletions src/tools/compiletest/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,8 @@ pub struct TargetCfg {
pub(crate) sanitizers: Vec<Sanitizer>,
#[serde(rename = "supports-xray", default)]
pub(crate) xray: bool,
#[serde(default = "default_reloc_model")]
pub(crate) relocation_model: String,
}

impl TargetCfg {
Expand All @@ -592,6 +594,10 @@ fn default_os() -> String {
"none".into()
}

fn default_reloc_model() -> String {
"pic".into()
}

#[derive(Eq, PartialEq, Clone, Debug, Default, serde::Deserialize)]
#[serde(rename_all = "kebab-case")]
pub enum Endian {
Expand Down
5 changes: 5 additions & 0 deletions src/tools/compiletest/src/header/needs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@ pub(super) fn handle_needs(
condition: config.target_cfg().dynamic_linking,
ignore_reason: "ignored on targets without dynamic linking",
},
Need {
name: "needs-relocation-model-pic",
condition: config.target_cfg().relocation_model == "pic",
ignore_reason: "ignored on targets without PIC relocation model",
},
];

let (name, comment) = match ln.split_once([':', ' ']) {
Expand Down
1 change: 1 addition & 0 deletions tests/incremental/change_crate_dep_kind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// needs-unwind
// revisions:cfail1 cfail2
// compile-flags: -Z query-dep-graph -Cpanic=unwind
// needs-unwind
// build-pass (FIXME(62277): could be check-pass?)

#![feature(panic_unwind)]
Expand Down
3 changes: 1 addition & 2 deletions tests/ui/abi/relocation_model_pic.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// run-pass
// compile-flags: -C relocation-model=pic
// ignore-emscripten no pic
// ignore-wasm
// needs-relocation-model-pic

#![feature(cfg_relocation_model)]

Expand Down
1 change: 1 addition & 0 deletions tests/ui/panics/short-ice-remove-middle-frames-2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// run-fail
// check-run-results
// exec-env:RUST_BACKTRACE=1
// needs-unwind
// ignore-android FIXME #17520
// ignore-wasm no panic support
// ignore-openbsd no support for libbacktrace without filename
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
thread 'main' panicked at $DIR/short-ice-remove-middle-frames-2.rs:56:5:
thread 'main' panicked at $DIR/short-ice-remove-middle-frames-2.rs:57:5:
debug!!!
stack backtrace:
0: std::panicking::begin_panic
Expand Down
1 change: 1 addition & 0 deletions tests/ui/panics/short-ice-remove-middle-frames.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// run-fail
// check-run-results
// exec-env:RUST_BACKTRACE=1
// needs-unwind
// ignore-android FIXME #17520
// ignore-wasm no panic support
// ignore-openbsd no support for libbacktrace without filename
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/panics/short-ice-remove-middle-frames.run.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
thread 'main' panicked at $DIR/short-ice-remove-middle-frames.rs:52:5:
thread 'main' panicked at $DIR/short-ice-remove-middle-frames.rs:53:5:
debug!!!
stack backtrace:
0: std::panicking::begin_panic
Expand Down

0 comments on commit 4759812

Please sign in to comment.