@@ -14,42 +14,59 @@ use common::Config;
14
14
/// Conversion table from triple OS name to Rust SYSNAME
15
15
const OS_TABLE : & ' static [ ( & ' static str , & ' static str ) ] = & [
16
16
( "android" , "android" ) ,
17
+ ( "androideabi" , "android" ) ,
17
18
( "bitrig" , "bitrig" ) ,
18
19
( "cloudabi" , "cloudabi" ) ,
19
20
( "darwin" , "macos" ) ,
20
21
( "dragonfly" , "dragonfly" ) ,
22
+ ( "emscripten" , "emscripten" ) ,
21
23
( "freebsd" , "freebsd" ) ,
24
+ ( "fuchsia" , "fuchsia" ) ,
22
25
( "haiku" , "haiku" ) ,
23
26
( "ios" , "ios" ) ,
27
+ ( "l4re" , "l4re" ) ,
24
28
( "linux" , "linux" ) ,
25
29
( "mingw32" , "windows" ) ,
26
30
( "netbsd" , "netbsd" ) ,
27
31
( "openbsd" , "openbsd" ) ,
32
+ ( "redox" , "redox" ) ,
33
+ ( "solaris" , "solaris" ) ,
28
34
( "win32" , "windows" ) ,
29
35
( "windows" , "windows" ) ,
30
- ( "solaris" , "solaris" ) ,
31
- ( "emscripten" , "emscripten" ) ,
32
36
] ;
33
37
34
38
const ARCH_TABLE : & ' static [ ( & ' static str , & ' static str ) ] = & [
35
39
( "aarch64" , "aarch64" ) ,
36
40
( "amd64" , "x86_64" ) ,
37
41
( "arm" , "arm" ) ,
38
42
( "arm64" , "aarch64" ) ,
43
+ ( "armv4t" , "arm" ) ,
44
+ ( "armv5te" , "arm" ) ,
45
+ ( "armv7" , "arm" ) ,
46
+ ( "armv7s" , "arm" ) ,
47
+ ( "asmjs" , "asmjs" ) ,
39
48
( "hexagon" , "hexagon" ) ,
40
49
( "i386" , "x86" ) ,
41
50
( "i586" , "x86" ) ,
42
51
( "i686" , "x86" ) ,
43
- ( "mips64" , "mips64" ) ,
44
52
( "mips" , "mips" ) ,
53
+ ( "mips64" , "mips64" ) ,
54
+ ( "mips64el" , "mips64" ) ,
55
+ ( "mipsel" , "mips" ) ,
45
56
( "msp430" , "msp430" ) ,
46
57
( "powerpc" , "powerpc" ) ,
58
+ ( "powerpc64" , "powerpc64" ) ,
59
+ ( "powerpc64le" , "powerpc64" ) ,
47
60
( "s390x" , "s390x" ) ,
48
61
( "sparc" , "sparc" ) ,
62
+ ( "sparc64" , "sparc64" ) ,
63
+ ( "sparcv9" , "sparc64" ) ,
64
+ ( "thumbv6m" , "thumb" ) ,
65
+ ( "thumbv7em" , "thumb" ) ,
66
+ ( "thumbv7m" , "thumb" ) ,
67
+ ( "wasm32" , "wasm32" ) ,
49
68
( "x86_64" , "x86_64" ) ,
50
69
( "xcore" , "xcore" ) ,
51
- ( "asmjs" , "asmjs" ) ,
52
- ( "wasm32" , "wasm32" ) ,
53
70
] ;
54
71
55
72
pub fn matches_os ( triple : & str , name : & str ) -> bool {
@@ -58,16 +75,18 @@ pub fn matches_os(triple: &str, name: &str) -> bool {
58
75
if triple == "wasm32-unknown-unknown" {
59
76
return name == "emscripten" || name == "wasm32-bare"
60
77
}
78
+ let triple: Vec < _ > = triple. split ( '-' ) . collect ( ) ;
61
79
for & ( triple_os, os) in OS_TABLE {
62
- if triple. contains ( triple_os) {
80
+ if triple. contains ( & triple_os) {
63
81
return os == name;
64
82
}
65
83
}
66
84
panic ! ( "Cannot determine OS from triple" ) ;
67
85
}
68
86
pub fn get_arch ( triple : & str ) -> & ' static str {
87
+ let triple: Vec < _ > = triple. split ( '-' ) . collect ( ) ;
69
88
for & ( triple_arch, arch) in ARCH_TABLE {
70
- if triple. contains ( triple_arch) {
89
+ if triple. contains ( & triple_arch) {
71
90
return arch;
72
91
}
73
92
}
0 commit comments