@@ -35,7 +35,7 @@ use crate::back::profiling::{
3535 selfprofile_after_pass_callback, selfprofile_before_pass_callback, LlvmSelfProfiler ,
3636} ;
3737use crate :: errors:: {
38- CopyBitcode , FromLlvmDiag , FromLlvmOptimizationDiag , LlvmError , UnknownCompression ,
38+ self , CopyBitcode , FromLlvmDiag , FromLlvmOptimizationDiag , LlvmError , UnknownCompression ,
3939 WithLlvmError , WriteBytecode ,
4040} ;
4141use crate :: llvm:: diagnostic:: OptimizationDiagnosticKind ;
@@ -185,7 +185,17 @@ pub(crate) fn target_machine_factory(
185185 let reloc_model = to_llvm_relocation_model ( sess. relocation_model ( ) ) ;
186186
187187 let ( opt_level, _) = to_llvm_opt_settings ( optlvl) ;
188- let use_softfp = sess. opts . cg . soft_float ;
188+ let use_softfp = if sess. target . arch == "arm" && sess. target . abi == "eabihf" {
189+ sess. opts . cg . soft_float
190+ } else {
191+ // All `use_softfp` does is the equivalent of `-mfloat-abi` in GCC/clang, which only exists on ARM targets.
192+ // We document this flag to only affect `*eabihf` targets, so let's show a warning for all other targets.
193+ if sess. opts . cg . soft_float {
194+ sess. dcx ( ) . emit_warn ( errors:: SoftFloatIgnored ) ;
195+ }
196+ // Let's make sure LLVM doesn't suddenly start using this flag on more targets.
197+ false
198+ } ;
189199
190200 let ffunction_sections =
191201 sess. opts . unstable_opts . function_sections . unwrap_or ( sess. target . function_sections ) ;
0 commit comments