@@ -7,12 +7,6 @@ fn main() {
77 let target_vendor =
88 env:: var ( "CARGO_CFG_TARGET_VENDOR" ) . expect ( "CARGO_CFG_TARGET_VENDOR was not set" ) ;
99 let target_env = env:: var ( "CARGO_CFG_TARGET_ENV" ) . expect ( "CARGO_CFG_TARGET_ENV was not set" ) ;
10- let target_abi = env:: var ( "CARGO_CFG_TARGET_ABI" ) . expect ( "CARGO_CFG_TARGET_ABI was not set" ) ;
11- let target_pointer_width: u32 = env:: var ( "CARGO_CFG_TARGET_POINTER_WIDTH" )
12- . expect ( "CARGO_CFG_TARGET_POINTER_WIDTH was not set" )
13- . parse ( )
14- . unwrap ( ) ;
15- let is_miri = env:: var_os ( "CARGO_CFG_MIRI" ) . is_some ( ) ;
1610
1711 println ! ( "cargo:rustc-check-cfg=cfg(netbsd10)" ) ;
1812 if target_os == "netbsd" && env:: var ( "RUSTC_STD_NETBSD10" ) . is_ok ( ) {
@@ -80,108 +74,4 @@ fn main() {
8074 println ! ( "cargo:rustc-cfg=backtrace_in_libstd" ) ;
8175
8276 println ! ( "cargo:rustc-env=STD_ENV_ARCH={}" , env:: var( "CARGO_CFG_TARGET_ARCH" ) . unwrap( ) ) ;
83-
84- // Emit these on platforms that have no known ABI bugs, LLVM selection bugs, lowering bugs,
85- // missing symbols, or other problems, to determine when tests get run.
86- // If more broken platforms are found, please update the tracking issue at
87- // <https://github.com/rust-lang/rust/issues/116909>
88- //
89- // Some of these match arms are redundant; the goal is to separate reasons that the type is
90- // unreliable, even when multiple reasons might fail the same platform.
91- println ! ( "cargo:rustc-check-cfg=cfg(reliable_f16)" ) ;
92- println ! ( "cargo:rustc-check-cfg=cfg(reliable_f128)" ) ;
93-
94- // This is a step beyond only having the types and basic functions available. Math functions
95- // aren't consistently available or correct.
96- println ! ( "cargo:rustc-check-cfg=cfg(reliable_f16_math)" ) ;
97- println ! ( "cargo:rustc-check-cfg=cfg(reliable_f128_math)" ) ;
98-
99- let has_reliable_f16 = match ( target_arch. as_str ( ) , target_os. as_str ( ) ) {
100- // We can always enable these in Miri as that is not affected by codegen bugs.
101- _ if is_miri => true ,
102- // Selection failure <https://github.com/llvm/llvm-project/issues/50374>
103- ( "s390x" , _) => false ,
104- // Unsupported <https://github.com/llvm/llvm-project/issues/94434>
105- ( "arm64ec" , _) => false ,
106- // MinGW ABI bugs <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115054>
107- ( "x86_64" , "windows" ) if target_env == "gnu" && target_abi != "llvm" => false ,
108- // Infinite recursion <https://github.com/llvm/llvm-project/issues/97981>
109- ( "csky" , _) => false ,
110- ( "hexagon" , _) => false ,
111- ( "powerpc" | "powerpc64" , _) => false ,
112- ( "sparc" | "sparc64" , _) => false ,
113- ( "wasm32" | "wasm64" , _) => false ,
114- // `f16` support only requires that symbols converting to and from `f32` are available. We
115- // provide these in `compiler-builtins`, so `f16` should be available on all platforms that
116- // do not have other ABI issues or LLVM crashes.
117- _ => true ,
118- } ;
119-
120- let has_reliable_f128 = match ( target_arch. as_str ( ) , target_os. as_str ( ) ) {
121- // We can always enable these in Miri as that is not affected by codegen bugs.
122- _ if is_miri => true ,
123- // Unsupported <https://github.com/llvm/llvm-project/issues/94434>
124- ( "arm64ec" , _) => false ,
125- // Selection bug <https://github.com/llvm/llvm-project/issues/96432>
126- ( "mips64" | "mips64r6" , _) => false ,
127- // Selection bug <https://github.com/llvm/llvm-project/issues/95471>
128- ( "nvptx64" , _) => false ,
129- // ABI bugs <https://github.com/rust-lang/rust/issues/125109> et al. (full
130- // list at <https://github.com/rust-lang/rust/issues/116909>)
131- ( "powerpc" | "powerpc64" , _) => false ,
132- // ABI unsupported <https://github.com/llvm/llvm-project/issues/41838>
133- ( "sparc" , _) => false ,
134- // Stack alignment bug <https://github.com/llvm/llvm-project/issues/77401>. NB: tests may
135- // not fail if our compiler-builtins is linked.
136- ( "x86" , _) => false ,
137- // MinGW ABI bugs <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115054>
138- ( "x86_64" , "windows" ) if target_env == "gnu" && target_abi != "llvm" => false ,
139- // There are no known problems on other platforms, so the only requirement is that symbols
140- // are available. `compiler-builtins` provides all symbols required for core `f128`
141- // support, so this should work for everything else.
142- _ => true ,
143- } ;
144-
145- // Configure platforms that have reliable basics but may have unreliable math.
146-
147- // LLVM is currently adding missing routines, <https://github.com/llvm/llvm-project/issues/93566>
148- let has_reliable_f16_math = has_reliable_f16
149- && match ( target_arch. as_str ( ) , target_os. as_str ( ) ) {
150- // FIXME: Disabled on Miri as the intrinsics are not implemented yet.
151- _ if is_miri => false ,
152- // x86 has a crash for `powi`: <https://github.com/llvm/llvm-project/issues/105747>
153- ( "x86" | "x86_64" , _) => false ,
154- // Assume that working `f16` means working `f16` math for most platforms, since
155- // operations just go through `f32`.
156- _ => true ,
157- } ;
158-
159- let has_reliable_f128_math = has_reliable_f128
160- && match ( target_arch. as_str ( ) , target_os. as_str ( ) ) {
161- // FIXME: Disabled on Miri as the intrinsics are not implemented yet.
162- _ if is_miri => false ,
163- // LLVM lowers `fp128` math to `long double` symbols even on platforms where
164- // `long double` is not IEEE binary128. See
165- // <https://github.com/llvm/llvm-project/issues/44744>.
166- //
167- // This rules out anything that doesn't have `long double` = `binary128`; <= 32 bits
168- // (ld is `f64`), anything other than Linux (Windows and MacOS use `f64`), and `x86`
169- // (ld is 80-bit extended precision).
170- ( "x86_64" , _) => false ,
171- ( _, "linux" ) if target_pointer_width == 64 => true ,
172- _ => false ,
173- } ;
174-
175- if has_reliable_f16 {
176- println ! ( "cargo:rustc-cfg=reliable_f16" ) ;
177- }
178- if has_reliable_f128 {
179- println ! ( "cargo:rustc-cfg=reliable_f128" ) ;
180- }
181- if has_reliable_f16_math {
182- println ! ( "cargo:rustc-cfg=reliable_f16_math" ) ;
183- }
184- if has_reliable_f128_math {
185- println ! ( "cargo:rustc-cfg=reliable_f128_math" ) ;
186- }
18777}
0 commit comments