Skip to content

Commit 90f317b

Browse files
committed
add needs-relocation-model-pic to compiletest
1 parent b8536c1 commit 90f317b

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
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/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

0 commit comments

Comments
 (0)