@@ -11,12 +11,21 @@ pub enum Dlsym {
1111impl Dlsym {
1212 // Returns an error for unsupported symbols, and None if this symbol
1313 // should become a NULL pointer (pretend it does not exist).
14- pub fn from_str ( name : & str ) -> InterpResult < ' static , Option < Dlsym > > {
14+ pub fn from_str ( name : & [ u8 ] , target_os : & str ) -> InterpResult < ' static , Option < Dlsym > > {
1515 use self :: Dlsym :: * ;
16- Ok ( match name {
17- "getentropy" => Some ( GetEntropy ) ,
18- "__pthread_get_minstack" => None ,
19- _ => throw_unsup_format ! ( "unsupported dlsym: {}" , name) ,
16+ let name = String :: from_utf8_lossy ( name) ;
17+ Ok ( match target_os {
18+ "linux" | "macos" => match & * name {
19+ "getentropy" => Some ( GetEntropy ) ,
20+ "__pthread_get_minstack" => None ,
21+ _ => throw_unsup_format ! ( "unsupported dlsym: {}" , name) ,
22+ }
23+ "windows" => match & * name {
24+ "SetThreadStackGuarantee" => None ,
25+ "AcquireSRWLockExclusive" => None ,
26+ _ => throw_unsup_format ! ( "unsupported dlsym: {}" , name) ,
27+ }
28+ os => bug ! ( "dlsym not implemented for target_os {}" , os) ,
2029 } )
2130 }
2231}
0 commit comments