Skip to content

Commit 431cebd

Browse files
committed
Introduce #[cfg(target_feature = "cg_clif")]
1 parent 392348d commit 431cebd

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

patches/0016-Disable-cpuid-intrinsic.patch

+4-2
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@ diff --git a/src/stdarch/crates/core_arch/src/x86/cpuid.rs b/src/stdarch/crates/
1111
index f313c42..ff952bc 100644
1212
--- a/src/stdarch/crates/core_arch/src/x86/cpuid.rs
1313
+++ b/src/stdarch/crates/core_arch/src/x86/cpuid.rs
14-
@@ -84,6 +84,9 @@ pub unsafe fn __cpuid(leaf: u32) -> CpuidResult {
14+
@@ -84,6 +84,11 @@ pub unsafe fn __cpuid(leaf: u32) -> CpuidResult {
1515
/// Does the host support the `cpuid` instruction?
1616
#[inline]
1717
pub fn has_cpuid() -> bool {
1818
+ // __cpuid intrinsic is not yet implemented
19-
+ return false;
19+
+ #[cfg(target_feature = "cg_clif")] {
20+
+ return false;
21+
+ }
2022
+
2123
#[cfg(target_env = "sgx")]
2224
{

src/lib.rs

+6
Original file line numberDiff line numberDiff line change
@@ -188,18 +188,24 @@ impl CodegenBackend for CraneliftCodegenBackend {
188188
// rustdoc needs to be able to document functions that use all the features, so
189189
// whitelist them all
190190
target_features_whitelist::all_known_features()
191+
.chain(Some(("cg_clif", None)))
191192
.map(|(a, b)| (a.to_string(), b))
192193
.collect()
193194
} else {
194195
target_features_whitelist::target_feature_whitelist(tcx.sess)
195196
.iter()
197+
.chain(&Some(("cg_clif", None)))
196198
.map(|&(a, b)| (a.to_string(), b))
197199
.collect()
198200
}
199201
};
200202
}
201203
fn provide_extern(&self, _providers: &mut Providers<'_>) {}
202204

205+
fn target_features(&self, _sess: &Session) -> Vec<rustc_span::Symbol> {
206+
vec![rustc_span::Symbol::intern("cg_clif")]
207+
}
208+
203209
fn codegen_crate<'tcx>(
204210
&self,
205211
tcx: TyCtxt<'tcx>,

0 commit comments

Comments
 (0)