Maintain supported sanitizers as a target property

This commit adds an additional target property – `supported_sanitizers`,
and replaces the hardcoded allowlists in argument parsing to use this
new property.

Fixes #81802
This commit is contained in:
Simonas Kazlauskas 2021-02-08 00:49:00 +02:00
parent 64af7eae1e
commit 16c1d0ae06
12 changed files with 49 additions and 66 deletions

View file

@ -614,7 +614,7 @@ impl fmt::Display for SanitizerSet {
_ => panic!("unrecognized sanitizer {:?}", s),
};
if !first {
f.write_str(",")?;
f.write_str(", ")?;
}
f.write_str(name)?;
first = false;
@ -1219,6 +1219,13 @@ pub struct TargetOptions {
/// How to handle split debug information, if at all. Specifying `None` has
/// target-specific meaning.
pub split_debuginfo: SplitDebuginfo,
/// The sanitizers supported by this target
///
/// Note that the support here is at a codegen level. If the machine code with sanitizer
/// enabled can generated on this target, but the necessary supporting libraries are not
/// distributed with the target, the sanitizer should still appear in this list for the target.
pub supported_sanitizers: SanitizerSet,
}
impl Default for TargetOptions {
@ -1320,6 +1327,7 @@ impl Default for TargetOptions {
eh_frame_header: true,
has_thumb_interworking: false,
split_debuginfo: SplitDebuginfo::Off,
supported_sanitizers: SanitizerSet::empty(),
}
}
}