Skip to content

Commit ea45e08

Browse files
committed
add target_env checks
Signed-off-by: Jun Kimura <junkxdev@gmail.com>
1 parent a665b62 commit ea45e08

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

sgx-types/src/function.rs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use crate::*;
2222
// Constants from sgx-trts
2323
pub const LAYOUT_ENTRY_NUM: usize = 43;
2424

25-
#[cfg(feature = "tstdc")]
25+
#[cfg(all(feature = "tstdc", target_env = "sgx"))]
2626
#[link(name = "sgx_tstdc", kind = "static")]
2727
extern "C" {
2828
//
@@ -107,7 +107,7 @@ extern "C" {
107107
pub fn sgx_alloc_rsrv_mem_ex(desired_addr: *const c_void, length: size_t) -> *mut c_void;
108108
}
109109

110-
#[cfg(feature = "tservice")]
110+
#[cfg(all(feature = "tservice", target_env = "sgx"))]
111111
#[cfg_attr(
112112
not(feature = "simulation"),
113113
link(name = "sgx_tservice", kind = "static")
@@ -278,7 +278,7 @@ extern "C" {
278278
) -> *mut c_void;
279279
}
280280

281-
#[cfg(feature = "tcrypto")]
281+
#[cfg(all(feature = "tcrypto", target_env = "sgx"))]
282282
#[link(name = "sgx_tcrypto", kind = "static")]
283283
extern "C" {
284284
//
@@ -619,7 +619,7 @@ extern "C" {
619619
) -> sgx_status_t;
620620
}
621621

622-
#[cfg(feature = "tkey_exchange")]
622+
#[cfg(all(feature = "tkey_exchange", target_env = "sgx"))]
623623
#[link(name = "sgx_tkey_exchange", kind = "static")]
624624
extern "C" {
625625
//
@@ -650,7 +650,7 @@ extern "C" {
650650
) -> sgx_status_t;
651651
}
652652

653-
#[cfg(feature = "trts")]
653+
#[cfg(all(feature = "trts", target_env = "sgx"))]
654654
#[cfg_attr(not(feature = "simulation"), link(name = "sgx_trts", kind = "static"))]
655655
#[cfg_attr(feature = "simulation", link(name = "sgx_trts_sim", kind = "static"))]
656656
extern "C" {
@@ -787,7 +787,7 @@ pub struct thread_data_t {
787787
}
788788

789789
/* intel sgx sdk 2.18 */
790-
#[cfg(feature = "mm")]
790+
#[cfg(all(feature = "mm", target_env = "sgx"))]
791791
#[link(name = "sgx_mm", kind = "static")]
792792
extern "C" {
793793
pub fn sgx_mm_alloc(
@@ -813,7 +813,7 @@ extern "C" {
813813
pub fn sgx_mm_modify_type(addr: *const c_void, length: size_t, page_type: int32_t) -> int32_t;
814814
}
815815

816-
#[cfg(feature = "epid")]
816+
#[cfg(all(feature = "epid", not(target_env = "sgx")))]
817817
#[link(name = "sgx_epid", kind = "dylib")]
818818
extern "C" {
819819
//
@@ -863,7 +863,7 @@ extern "C" {
863863
) -> sgx_status_t;
864864
}
865865

866-
#[cfg(feature = "launch")]
866+
#[cfg(all(feature = "launch", not(target_env = "sgx")))]
867867
#[link(name = "sgx_launch", kind = "dylib")]
868868
extern "C" {
869869
//
@@ -880,7 +880,7 @@ extern "C" {
880880
) -> sgx_status_t;
881881
}
882882

883-
#[cfg(feature = "platform")]
883+
#[cfg(all(feature = "platform", not(target_env = "sgx")))]
884884
#[link(name = "sgx_platform", kind = "dylib")]
885885
extern "C" {
886886
//
@@ -889,7 +889,7 @@ extern "C" {
889889
pub fn sgx_get_ps_cap(p_sgx_ps_cap: *mut sgx_ps_cap_t) -> sgx_status_t;
890890
}
891891

892-
#[cfg(feature = "quote_ex")]
892+
#[cfg(all(feature = "quote_ex", not(target_env = "sgx")))]
893893
#[link(name = "sgx_quote_ex", kind = "dylib")]
894894
extern "C" {
895895
//
@@ -931,7 +931,7 @@ extern "C" {
931931
) -> sgx_status_t;
932932
}
933933

934-
#[cfg(feature = "uae_service")]
934+
#[cfg(all(feature = "uae_service", not(target_env = "sgx")))]
935935
#[link(name = "sgx_uae_service", kind = "dylib")]
936936
extern "C" {
937937
//
@@ -943,7 +943,7 @@ extern "C" {
943943
//
944944
}
945945

946-
#[cfg(feature = "ukey_exchange")]
946+
#[cfg(all(feature = "ukey_exchange", not(target_env = "sgx")))]
947947
#[link(name = "sgx_ukey_exchange", kind = "dylib")]
948948
extern "C" {
949949
//
@@ -989,7 +989,7 @@ extern "C" {
989989
) -> sgx_status_t;
990990
}
991991

992-
#[cfg(feature = "urts")]
992+
#[cfg(all(feature = "urts", not(target_env = "sgx")))]
993993
#[cfg_attr(not(feature = "simulation"), link(name = "sgx_urts", kind = "dylib"))]
994994
#[cfg_attr(feature = "simulation", link(name = "sgx_urts_sim", kind = "dylib"))]
995995
extern "C" {
@@ -1055,7 +1055,7 @@ extern "C" {
10551055
}
10561056

10571057
/* intel sgx sdk 1.9 */
1058-
#[cfg(feature = "tprotected_fs")]
1058+
#[cfg(all(feature = "tprotected_fs", target_env = "sgx"))]
10591059
#[link(name = "sgx_tprotected_fs", kind = "static")]
10601060
extern "C" {
10611061
//
@@ -1094,7 +1094,7 @@ extern "C" {
10941094
}
10951095

10961096
/* intel sgx sdk 2.0 */
1097-
#[cfg(feature = "capable")]
1097+
#[cfg(all(feature = "capable", not(target_env = "sgx")))]
10981098
#[link(name = "sgx_capable", kind = "dylib")]
10991099
extern "C" {
11001100
//
@@ -1105,7 +1105,7 @@ extern "C" {
11051105
pub fn sgx_cap_get_status(sgx_device_status: *mut sgx_device_status_t) -> sgx_status_t;
11061106
}
11071107

1108-
#[cfg(feature = "pce_wrapper")]
1108+
#[cfg(all(feature = "pce_wrapper", not(target_env = "sgx")))]
11091109
#[link(name = "sgx_pce_wrapper", kind = "dylib")]
11101110
extern "C" {
11111111
//
@@ -1144,7 +1144,7 @@ extern "C" {
11441144
) -> sgx_pce_error_t;
11451145
}
11461146

1147-
#[cfg(feature = "dcap_ql")]
1147+
#[cfg(all(feature = "dcap_ql", not(target_env = "sgx")))]
11481148
#[link(name = "sgx_dcap_ql", kind = "dylib")]
11491149
extern "C" {
11501150
//
@@ -1167,7 +1167,7 @@ extern "C" {
11671167
) -> sgx_quote3_error_t;
11681168
}
11691169

1170-
#[cfg(feature = "dcap_quoteprov")]
1170+
#[cfg(all(feature = "dcap_quoteprov", not(target_env = "sgx")))]
11711171
#[link(name = "dcap_quoteprov", kind = "dylib")]
11721172
extern "C" {
11731173
//
@@ -1242,7 +1242,7 @@ extern "C" {
12421242
pub fn sgx_qpl_global_cleanup() -> sgx_quote3_error_t;
12431243
}
12441244

1245-
#[cfg(feature = "default_qcnl_wrapper")]
1245+
#[cfg(all(feature = "default_qcnl_wrapper", not(target_env = "sgx")))]
12461246
#[link(name = "sgx_default_qcnl_wrapper", kind = "dylib")]
12471247
extern "C" {
12481248
//
@@ -1326,7 +1326,7 @@ extern "C" {
13261326
pub fn sgx_qcnl_global_cleanup() -> sgx_qcnl_error_t;
13271327
}
13281328

1329-
#[cfg(feature = "dcap_quoteverify")]
1329+
#[cfg(all(feature = "dcap_quoteverify", not(target_env = "sgx")))]
13301330
#[link(name = "dcap_quoteverify", kind = "dylib")]
13311331
extern "C" {
13321332
//
@@ -1423,7 +1423,7 @@ extern "C" {
14231423
}
14241424

14251425
/* intel DCAP 1.7 */
1426-
#[cfg(feature = "dcap_tvl")]
1426+
#[cfg(all(feature = "dcap_tvl", target_env = "sgx"))]
14271427
#[link(name = "sgx_dcap_tvl", kind = "static")]
14281428
extern "C" {
14291429
//
@@ -1443,7 +1443,7 @@ extern "C" {
14431443
}
14441444

14451445
/* intel DCAP 1.15 */
1446-
#[cfg(feature = "tdx_attest")]
1446+
#[cfg(all(feature = "tdx_attest", target_env = "sgx"))]
14471447
#[link(name = "libtdx_attest", kind = "dylib")]
14481448
extern "C" {
14491449
//
@@ -1475,7 +1475,7 @@ extern "C" {
14751475
}
14761476

14771477
/* intel sgx sdk 2.16 */
1478-
#[cfg(feature = "ttls")]
1478+
#[cfg(all(feature = "ttls", target_env = "sgx"))]
14791479
#[link(name = "sgx_ttls", kind = "static")]
14801480
extern "C" {
14811481
//
@@ -1504,7 +1504,7 @@ extern "C" {
15041504
}
15051505

15061506
/* intel sgx sdk 2.16 */
1507-
#[cfg(feature = "utls")]
1507+
#[cfg(all(feature = "utls", not(target_env = "sgx")))]
15081508
#[link(name = "sgx_utls", kind = "dylib")]
15091509
extern "C" {
15101510
//

0 commit comments

Comments
 (0)