@@ -22,8 +22,8 @@ use crate::*;
2222// Constants from sgx-trts
2323pub const LAYOUT_ENTRY_NUM : usize = 43 ;
2424
25- #[ cfg( all ( feature = "tstdc" , target_env = "sgx" ) ) ]
26- #[ link( name = "sgx_tstdc" , kind = "static" ) ]
25+ #[ cfg( feature = "tstdc" ) ]
26+ #[ cfg_attr ( target_env = "sgx" , link( name = "sgx_tstdc" , kind = "static" ) ) ]
2727extern "C" {
2828 //
2929 // sgx_cpuid.h
@@ -107,13 +107,13 @@ 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( all ( feature = "tservice" , target_env = "sgx" ) ) ]
110+ #[ cfg( feature = "tservice" ) ]
111111#[ cfg_attr(
112- not( feature = "simulation" ) ,
112+ all ( target_env = "sgx" , not( feature = "simulation" ) ) ,
113113 link( name = "sgx_tservice" , kind = "static" )
114114) ]
115115#[ cfg_attr(
116- feature = "simulation" ,
116+ all ( target_env = "sgx" , feature = "simulation" ) ,
117117 link( name = "sgx_tservice_sim" , kind = "static" )
118118) ]
119119extern "C" {
@@ -278,8 +278,8 @@ extern "C" {
278278 ) -> * mut c_void ;
279279}
280280
281- #[ cfg( all ( feature = "tcrypto" , target_env = "sgx" ) ) ]
282- #[ link( name = "sgx_tcrypto" , kind = "static" ) ]
281+ #[ cfg( feature = "tcrypto" ) ]
282+ #[ cfg_attr ( target_env = "sgx" , link( name = "sgx_tcrypto" , kind = "static" ) ) ]
283283extern "C" {
284284 //
285285 // sgx_tcrypto.h
@@ -619,8 +619,8 @@ extern "C" {
619619 ) -> sgx_status_t ;
620620}
621621
622- #[ cfg( all ( feature = "tkey_exchange" , target_env = "sgx" ) ) ]
623- #[ link( name = "sgx_tkey_exchange" , kind = "static" ) ]
622+ #[ cfg( feature = "tkey_exchange" ) ]
623+ #[ cfg_attr ( target_env = "sgx" , link( name = "sgx_tkey_exchange" , kind = "static" ) ) ]
624624extern "C" {
625625 //
626626 // sgx_tkey_exchange.h
@@ -650,9 +650,15 @@ extern "C" {
650650 ) -> sgx_status_t ;
651651}
652652
653- #[ cfg( all( feature = "trts" , target_env = "sgx" ) ) ]
654- #[ cfg_attr( not( feature = "simulation" ) , link( name = "sgx_trts" , kind = "static" ) ) ]
655- #[ cfg_attr( feature = "simulation" , link( name = "sgx_trts_sim" , kind = "static" ) ) ]
653+ #[ cfg( feature = "trts" ) ]
654+ #[ cfg_attr(
655+ all( target_env = "sgx" , not( feature = "simulation" ) ) ,
656+ link( name = "sgx_trts" , kind = "static" )
657+ ) ]
658+ #[ cfg_attr(
659+ all( target_env = "sgx" , feature = "simulation" ) ,
660+ link( name = "sgx_trts_sim" , kind = "static" )
661+ ) ]
656662extern "C" {
657663
658664 pub fn abort ( ) -> !;
@@ -787,8 +793,8 @@ pub struct thread_data_t {
787793}
788794
789795/* intel sgx sdk 2.18 */
790- #[ cfg( all ( feature = "mm" , target_env = "sgx" ) ) ]
791- #[ link( name = "sgx_mm" , kind = "static" ) ]
796+ #[ cfg( feature = "mm" ) ]
797+ #[ cfg_attr ( target_env = "sgx" , link( name = "sgx_mm" , kind = "static" ) ) ]
792798extern "C" {
793799 pub fn sgx_mm_alloc (
794800 addr : * const c_void ,
@@ -1055,8 +1061,8 @@ extern "C" {
10551061}
10561062
10571063/* intel sgx sdk 1.9 */
1058- #[ cfg( all ( feature = "tprotected_fs" , target_env = "sgx" ) ) ]
1059- #[ link( name = "sgx_tprotected_fs" , kind = "static" ) ]
1064+ #[ cfg( feature = "tprotected_fs" ) ]
1065+ #[ cfg_attr ( target_env = "sgx" , link( name = "sgx_tprotected_fs" , kind = "static" ) ) ]
10601066extern "C" {
10611067 //
10621068 // sgx_tprotected_fs.h
@@ -1423,8 +1429,8 @@ extern "C" {
14231429}
14241430
14251431/* intel DCAP 1.7 */
1426- #[ cfg( all ( feature = "dcap_tvl" , target_env = "sgx" ) ) ]
1427- #[ link( name = "sgx_dcap_tvl" , kind = "static" ) ]
1432+ #[ cfg( feature = "dcap_tvl" ) ]
1433+ #[ cfg_attr ( target_env = "sgx" , link( name = "sgx_dcap_tvl" , kind = "static" ) ) ]
14281434extern "C" {
14291435 //
14301436 // sgx_dcap_tvl.h
@@ -1443,8 +1449,8 @@ extern "C" {
14431449}
14441450
14451451/* intel DCAP 1.15 */
1446- #[ cfg( all ( feature = "tdx_attest" , target_env = "sgx" ) ) ]
1447- #[ link( name = "libtdx_attest" , kind = "dylib" ) ]
1452+ #[ cfg( feature = "tdx_attest" ) ]
1453+ #[ cfg_attr ( target_env = "sgx" , link( name = "libtdx_attest" , kind = "dylib" ) ) ]
14481454extern "C" {
14491455 //
14501456 // tdx_attes.h
@@ -1475,8 +1481,8 @@ extern "C" {
14751481}
14761482
14771483/* intel sgx sdk 2.16 */
1478- #[ cfg( all ( feature = "ttls" , target_env = "sgx" ) ) ]
1479- #[ link( name = "sgx_ttls" , kind = "static" ) ]
1484+ #[ cfg( feature = "ttls" ) ]
1485+ #[ cfg_attr ( target_env = "sgx" , link( name = "sgx_ttls" , kind = "static" ) ) ]
14801486extern "C" {
14811487 //
14821488 // sgx_ttls.h
0 commit comments