Skip to content

Commit a9a1085

Browse files
committed
Fix SGX target_env collision
Signed-off-by: Yu Ding <[email protected]>
1 parent 35d9cc3 commit a9a1085

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ fn main() {
2222

2323
// Forcibly enable memory intrinsics on wasm32 & SGX as we don't have a libc to
2424
// provide them.
25-
if target.contains("wasm32") || target.contains("sgx") {
25+
if target.contains("wasm32") || (target.contains("sgx") && target.contains("fortanix")) {
2626
println!("cargo:rustc-cfg=feature=\"mem\"");
2727
}
2828

src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#![feature(abi_unadjusted)]
1717
#![feature(linkage)]
1818
#![feature(lang_items)]
19+
#![feature(cfg_target_vendor)]
1920
#![allow(unused_features)]
2021
#![no_builtins]
2122
#![cfg_attr(feature = "compiler-builtins", feature(staged_api))]
@@ -49,7 +50,7 @@ pub mod float;
4950

5051
#[cfg(any(all(target_arch = "wasm32", target_os = "unknown"),
5152
all(target_arch = "arm", target_os = "none"),
52-
target_env = "sgx"))]
53+
all(target_vendor = "fortanix", target_env = "sgx")))]
5354
pub mod math;
5455
pub mod mem;
5556

src/math.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ macro_rules! no_mangle {
1515
}
1616

1717
// only for the wasm32-unknown-unknown target
18-
#[cfg(any(all(target_arch = "wasm32", target_os = "unknown"), target_env = "sgx"))]
18+
#[cfg(any(all(target_arch = "wasm32", target_os = "unknown"),
19+
all(target_vendor = "fortanix", target_env = "sgx")))]
1920
no_mangle! {
2021
fn acos(x: f64) -> f64;
2122
fn asin(x: f64) -> f64;
@@ -66,7 +67,7 @@ no_mangle! {
6667
fn tanhf(n: f32) -> f32;
6768
}
6869

69-
#[cfg(target_env = "sgx")]
70+
#[cfg(all(target_vendor = "fortanix", target_env = "sgx"))]
7071
no_mangle! {
7172
fn ceil(x: f64) -> f64;
7273
fn ceilf(x: f32) -> f32;

0 commit comments

Comments
 (0)