This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +14
-6
lines changed Expand file tree Collapse file tree 5 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -10,8 +10,10 @@ use crate::sys::pal::waitqueue::SpinMutex;
1010// The current allocator here is the `dlmalloc` crate which we've got included
1111// in the rust-lang/rust repository as a submodule. The crate is a port of
1212// dlmalloc.c from C to Rust.
13+ //
14+ // Specifying linkage/symbol name is solely to ensure a single instance between this crate and its unit tests
1315#[ cfg_attr( test, linkage = "available_externally" ) ]
14- #[ unsafe( export_name = "_ZN16__rust_internals3std3sys3sgx5alloc8DLMALLOCE " ) ]
16+ #[ unsafe( export_name = "_ZN16__rust_internals3std3sys5alloc3sgx8DLMALLOCE " ) ]
1517static DLMALLOC : SpinMutex < dlmalloc:: Dlmalloc < Sgx > > =
1618 SpinMutex :: new ( dlmalloc:: Dlmalloc :: new_with_allocator ( Sgx { } ) ) ;
1719
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ use crate::sys::pal::abi::usercalls::raw::ByteBuffer;
88use crate :: sys_common:: FromInner ;
99use crate :: { fmt, slice} ;
1010
11+ // Specifying linkage/symbol name is solely to ensure a single instance between this crate and its unit tests
1112#[ cfg_attr( test, linkage = "available_externally" ) ]
1213#[ unsafe( export_name = "_ZN16__rust_internals3std3sys3sgx4args4ARGSE" ) ]
1314static ARGS : AtomicUsize = AtomicUsize :: new ( 0 ) ;
Original file line number Diff line number Diff line change @@ -11,15 +11,17 @@ const USIZE_BITS: usize = 64;
1111const TLS_KEYS : usize = 128 ; // Same as POSIX minimum
1212const TLS_KEYS_BITSET_SIZE : usize = ( TLS_KEYS + ( USIZE_BITS - 1 ) ) / USIZE_BITS ;
1313
14+ // Specifying linkage/symbol name is solely to ensure a single instance between this crate and its unit tests
1415#[ cfg_attr( test, linkage = "available_externally" ) ]
15- #[ unsafe( export_name = "_ZN16__rust_internals3std3sys3sgx3abi3tls14TLS_KEY_IN_USEE " ) ]
16+ #[ unsafe( export_name = "_ZN16__rust_internals3std3sys3pal3sgx3abi3tls14TLS_KEY_IN_USEE " ) ]
1617static TLS_KEY_IN_USE : SyncBitset = SYNC_BITSET_INIT ;
1718macro_rules! dup {
1819 ( ( * $( $exp: tt) * ) $( $val: tt) * ) => ( dup!( ( $( $exp) * ) $( $val) * $( $val) * ) ) ;
1920 ( ( ) $( $val: tt) * ) => ( [ $( $val) ,* ] )
2021}
22+ // Specifying linkage/symbol name is solely to ensure a single instance between this crate and its unit tests
2123#[ cfg_attr( test, linkage = "available_externally" ) ]
22- #[ unsafe( export_name = "_ZN16__rust_internals3std3sys3sgx3abi3tls14TLS_DESTRUCTORE " ) ]
24+ #[ unsafe( export_name = "_ZN16__rust_internals3std3sys3pal3sgx3abi3tls14TLS_DESTRUCTORE " ) ]
2325static TLS_DESTRUCTOR : [ AtomicUsize ; TLS_KEYS ] = dup ! ( ( * * * * * * * ) ( AtomicUsize :: new( 0 ) ) ) ;
2426
2527unsafe extern "C" {
Original file line number Diff line number Diff line change @@ -73,11 +73,13 @@ pub fn current_exe() -> io::Result<PathBuf> {
7373 unsupported ( )
7474}
7575
76+ // Specifying linkage/symbol name is solely to ensure a single instance between this crate and its unit tests
7677#[ cfg_attr( test, linkage = "available_externally" ) ]
77- #[ unsafe( export_name = "_ZN16__rust_internals3std3sys3sgx2os3ENVE " ) ]
78+ #[ unsafe( export_name = "_ZN16__rust_internals3std3sys3pal3sgx2os3ENVE " ) ]
7879static ENV : AtomicUsize = AtomicUsize :: new ( 0 ) ;
80+ // Specifying linkage/symbol name is solely to ensure a single instance between this crate and its unit tests
7981#[ cfg_attr( test, linkage = "available_externally" ) ]
80- #[ unsafe( export_name = "_ZN16__rust_internals3std3sys3sgx2os8ENV_INITE " ) ]
82+ #[ unsafe( export_name = "_ZN16__rust_internals3std3sys3pal3sgx2os8ENV_INITE " ) ]
8183static ENV_INIT : Once = Once :: new ( ) ;
8284type EnvStore = Mutex < HashMap < OsString , OsString > > ;
8385
Original file line number Diff line number Diff line change @@ -45,8 +45,9 @@ mod task_queue {
4545 }
4646 }
4747
48+ // Specifying linkage/symbol name is solely to ensure a single instance between this crate and its unit tests
4849 #[ cfg_attr( test, linkage = "available_externally" ) ]
49- #[ unsafe( export_name = "_ZN16__rust_internals3std3sys3sgx6thread10TASK_QUEUEE " ) ]
50+ #[ unsafe( export_name = "_ZN16__rust_internals3std3sys3pal3sgx6thread10TASK_QUEUEE " ) ]
5051 static TASK_QUEUE : Mutex < Vec < Task > > = Mutex :: new ( Vec :: new ( ) ) ;
5152
5253 pub ( super ) fn lock ( ) -> MutexGuard < ' static , Vec < Task > > {
You can’t perform that action at this time.
0 commit comments