Skip to content

Commit

Permalink
Fix SGX target_env collision
Browse files Browse the repository at this point in the history
Signed-off-by: Yu Ding <dingelish@gmail.com>
  • Loading branch information
dingelish committed Jan 3, 2019
1 parent 35d9cc3 commit a9a1085
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ fn main() {

// Forcibly enable memory intrinsics on wasm32 & SGX as we don't have a libc to
// 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\"");
}

Expand Down
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#![feature(abi_unadjusted)]
#![feature(linkage)]
#![feature(lang_items)]
#![feature(cfg_target_vendor)]
#![allow(unused_features)]
#![no_builtins]
#![cfg_attr(feature = "compiler-builtins", feature(staged_api))]
Expand Down Expand Up @@ -49,7 +50,7 @@ pub mod float;

#[cfg(any(all(target_arch = "wasm32", target_os = "unknown"),
all(target_arch = "arm", target_os = "none"),
target_env = "sgx"))]
all(target_vendor = "fortanix", target_env = "sgx")))]
pub mod math;
pub mod mem;

Expand Down
5 changes: 3 additions & 2 deletions src/math.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ macro_rules! no_mangle {
}

// 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! {
fn acos(x: f64) -> f64;
fn asin(x: f64) -> f64;
Expand Down Expand Up @@ -66,7 +67,7 @@ no_mangle! {
fn tanhf(n: f32) -> f32;
}

#[cfg(target_env = "sgx")]
#[cfg(all(target_vendor = "fortanix", target_env = "sgx"))]
no_mangle! {
fn ceil(x: f64) -> f64;
fn ceilf(x: f32) -> f32;
Expand Down

0 comments on commit a9a1085

Please sign in to comment.