Fix SGX target_env collision

Signed-off-by: Yu Ding <dingelish@gmail.com>
This commit is contained in:
Yu Ding 2019-01-03 12:53:08 -08:00
parent 35d9cc37bb
commit a9a108548c
3 changed files with 6 additions and 4 deletions

View File

@ -22,7 +22,7 @@ fn main() {
// Forcibly enable memory intrinsics on wasm32 & SGX as we don't have a libc to // Forcibly enable memory intrinsics on wasm32 & SGX as we don't have a libc to
// provide them. // provide them.
if target.contains("wasm32") || target.contains("sgx") { if target.contains("wasm32") || (target.contains("sgx") && target.contains("fortanix")) {
println!("cargo:rustc-cfg=feature=\"mem\""); println!("cargo:rustc-cfg=feature=\"mem\"");
} }

View File

@ -16,6 +16,7 @@
#![feature(abi_unadjusted)] #![feature(abi_unadjusted)]
#![feature(linkage)] #![feature(linkage)]
#![feature(lang_items)] #![feature(lang_items)]
#![feature(cfg_target_vendor)]
#![allow(unused_features)] #![allow(unused_features)]
#![no_builtins] #![no_builtins]
#![cfg_attr(feature = "compiler-builtins", feature(staged_api))] #![cfg_attr(feature = "compiler-builtins", feature(staged_api))]
@ -49,7 +50,7 @@ pub mod float;
#[cfg(any(all(target_arch = "wasm32", target_os = "unknown"), #[cfg(any(all(target_arch = "wasm32", target_os = "unknown"),
all(target_arch = "arm", target_os = "none"), all(target_arch = "arm", target_os = "none"),
target_env = "sgx"))] all(target_vendor = "fortanix", target_env = "sgx")))]
pub mod math; pub mod math;
pub mod mem; pub mod mem;

View File

@ -15,7 +15,8 @@ macro_rules! no_mangle {
} }
// only for the wasm32-unknown-unknown target // only for the wasm32-unknown-unknown target
#[cfg(any(all(target_arch = "wasm32", target_os = "unknown"), target_env = "sgx"))] #[cfg(any(all(target_arch = "wasm32", target_os = "unknown"),
all(target_vendor = "fortanix", target_env = "sgx")))]
no_mangle! { no_mangle! {
fn acos(x: f64) -> f64; fn acos(x: f64) -> f64;
fn asin(x: f64) -> f64; fn asin(x: f64) -> f64;
@ -66,7 +67,7 @@ no_mangle! {
fn tanhf(n: f32) -> f32; fn tanhf(n: f32) -> f32;
} }
#[cfg(target_env = "sgx")] #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))]
no_mangle! { no_mangle! {
fn ceil(x: f64) -> f64; fn ceil(x: f64) -> f64;
fn ceilf(x: f32) -> f32; fn ceilf(x: f32) -> f32;