Implement cfg(target_abi) (RFC 2992)
Add an `abi` field to `TargetOptions`, defaulting to "". Support using `cfg(target_abi = "...")` for conditional compilation on that field. Gated by `feature(cfg_target_abi)`. Add a test for `target_abi`, and a test for the feature gate. Add `target_abi` to tidy as a platform-specific cfg. This does not add an abi to any existing target.
This commit is contained in:
parent
c0bd5a584d
commit
84d6e8aed3
9 changed files with 76 additions and 1 deletions
|
@ -805,6 +805,7 @@ fn default_configuration(sess: &Session) -> CrateConfig {
|
|||
let wordsz = sess.target.pointer_width.to_string();
|
||||
let os = &sess.target.os;
|
||||
let env = &sess.target.env;
|
||||
let abi = &sess.target.abi;
|
||||
let vendor = &sess.target.vendor;
|
||||
let min_atomic_width = sess.target.min_atomic_width();
|
||||
let max_atomic_width = sess.target.max_atomic_width();
|
||||
|
@ -814,7 +815,7 @@ fn default_configuration(sess: &Session) -> CrateConfig {
|
|||
});
|
||||
|
||||
let mut ret = FxHashSet::default();
|
||||
ret.reserve(6); // the minimum number of insertions
|
||||
ret.reserve(7); // the minimum number of insertions
|
||||
// Target bindings.
|
||||
ret.insert((sym::target_os, Some(Symbol::intern(os))));
|
||||
for fam in &sess.target.families {
|
||||
|
@ -829,6 +830,7 @@ fn default_configuration(sess: &Session) -> CrateConfig {
|
|||
ret.insert((sym::target_endian, Some(Symbol::intern(end.as_str()))));
|
||||
ret.insert((sym::target_pointer_width, Some(Symbol::intern(&wordsz))));
|
||||
ret.insert((sym::target_env, Some(Symbol::intern(env))));
|
||||
ret.insert((sym::target_abi, Some(Symbol::intern(abi))));
|
||||
ret.insert((sym::target_vendor, Some(Symbol::intern(vendor))));
|
||||
if sess.target.has_elf_tls {
|
||||
ret.insert((sym::target_thread_local, None));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue