@@ -14,42 +14,59 @@ use common::Config;
1414/// Conversion table from triple OS name to Rust SYSNAME
1515const OS_TABLE : & ' static [ ( & ' static str , & ' static str ) ] = & [
1616 ( "android" , "android" ) ,
17+ ( "androideabi" , "android" ) ,
1718 ( "bitrig" , "bitrig" ) ,
1819 ( "cloudabi" , "cloudabi" ) ,
1920 ( "darwin" , "macos" ) ,
2021 ( "dragonfly" , "dragonfly" ) ,
22+ ( "emscripten" , "emscripten" ) ,
2123 ( "freebsd" , "freebsd" ) ,
24+ ( "fuchsia" , "fuchsia" ) ,
2225 ( "haiku" , "haiku" ) ,
2326 ( "ios" , "ios" ) ,
27+ ( "l4re" , "l4re" ) ,
2428 ( "linux" , "linux" ) ,
2529 ( "mingw32" , "windows" ) ,
2630 ( "netbsd" , "netbsd" ) ,
2731 ( "openbsd" , "openbsd" ) ,
32+ ( "redox" , "redox" ) ,
33+ ( "solaris" , "solaris" ) ,
2834 ( "win32" , "windows" ) ,
2935 ( "windows" , "windows" ) ,
30- ( "solaris" , "solaris" ) ,
31- ( "emscripten" , "emscripten" ) ,
3236] ;
3337
3438const ARCH_TABLE : & ' static [ ( & ' static str , & ' static str ) ] = & [
3539 ( "aarch64" , "aarch64" ) ,
3640 ( "amd64" , "x86_64" ) ,
3741 ( "arm" , "arm" ) ,
3842 ( "arm64" , "aarch64" ) ,
43+ ( "armv4t" , "arm" ) ,
44+ ( "armv5te" , "arm" ) ,
45+ ( "armv7" , "arm" ) ,
46+ ( "armv7s" , "arm" ) ,
47+ ( "asmjs" , "asmjs" ) ,
3948 ( "hexagon" , "hexagon" ) ,
4049 ( "i386" , "x86" ) ,
4150 ( "i586" , "x86" ) ,
4251 ( "i686" , "x86" ) ,
43- ( "mips64" , "mips64" ) ,
4452 ( "mips" , "mips" ) ,
53+ ( "mips64" , "mips64" ) ,
54+ ( "mips64el" , "mips64" ) ,
55+ ( "mipsel" , "mips" ) ,
4556 ( "msp430" , "msp430" ) ,
4657 ( "powerpc" , "powerpc" ) ,
58+ ( "powerpc64" , "powerpc64" ) ,
59+ ( "powerpc64le" , "powerpc64" ) ,
4760 ( "s390x" , "s390x" ) ,
4861 ( "sparc" , "sparc" ) ,
62+ ( "sparc64" , "sparc64" ) ,
63+ ( "sparcv9" , "sparc64" ) ,
64+ ( "thumbv6m" , "thumb" ) ,
65+ ( "thumbv7em" , "thumb" ) ,
66+ ( "thumbv7m" , "thumb" ) ,
67+ ( "wasm32" , "wasm32" ) ,
4968 ( "x86_64" , "x86_64" ) ,
5069 ( "xcore" , "xcore" ) ,
51- ( "asmjs" , "asmjs" ) ,
52- ( "wasm32" , "wasm32" ) ,
5370] ;
5471
5572pub fn matches_os ( triple : & str , name : & str ) -> bool {
@@ -58,16 +75,18 @@ pub fn matches_os(triple: &str, name: &str) -> bool {
5875 if triple == "wasm32-unknown-unknown" {
5976 return name == "emscripten" || name == "wasm32-bare"
6077 }
78+ let triple: Vec < _ > = triple. split ( '-' ) . collect ( ) ;
6179 for & ( triple_os, os) in OS_TABLE {
62- if triple. contains ( triple_os) {
80+ if triple. contains ( & triple_os) {
6381 return os == name;
6482 }
6583 }
6684 panic ! ( "Cannot determine OS from triple" ) ;
6785}
6886pub fn get_arch ( triple : & str ) -> & ' static str {
87+ let triple: Vec < _ > = triple. split ( '-' ) . collect ( ) ;
6988 for & ( triple_arch, arch) in ARCH_TABLE {
70- if triple. contains ( triple_arch) {
89+ if triple. contains ( & triple_arch) {
7190 return arch;
7291 }
7392 }
0 commit comments