add needs-relocation-model-pic to compiletest

This commit is contained in:
Pietro Albini 2023-09-29 12:24:35 +02:00
parent b8536c1aa1
commit 90f317b2de
No known key found for this signature in database
GPG Key ID: CD76B35F7734769E
3 changed files with 12 additions and 2 deletions

View File

@ -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 {
@ -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 {

View File

@ -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([':', ' ']) {

View File

@ -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)]