mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
deprecate -Csoft-float because it is unsound (and not fixable)
This commit is contained in:
parent
9b82580c73
commit
df38e644ce
@ -185,7 +185,13 @@ pub(crate) fn target_machine_factory(
|
||||
let reloc_model = to_llvm_relocation_model(sess.relocation_model());
|
||||
|
||||
let (opt_level, _) = to_llvm_opt_settings(optlvl);
|
||||
let use_softfp = sess.opts.cg.soft_float;
|
||||
let use_softfp = if sess.target.arch == "arm" && sess.target.abi == "eabihf" {
|
||||
sess.opts.cg.soft_float
|
||||
} else {
|
||||
// `validate_commandline_args_with_session_available` has already warned about this being ignored.
|
||||
// Let's make sure LLVM doesn't suddenly start using this flag on more targets.
|
||||
false
|
||||
};
|
||||
|
||||
let ffunction_sections =
|
||||
sess.opts.unstable_opts.function_sections.unwrap_or(sess.target.function_sections);
|
||||
|
@ -107,6 +107,16 @@ session_sanitizer_not_supported = {$us} sanitizer is not supported for this targ
|
||||
session_sanitizers_not_supported = {$us} sanitizers are not supported for this target
|
||||
|
||||
session_skipping_const_checks = skipping const checks
|
||||
|
||||
session_soft_float_deprecated =
|
||||
`-Csoft-float` is unsound and deprecated; use a corresponding *eabi target instead
|
||||
.note = it will be removed or ignored in a future version of Rust
|
||||
session_soft_float_deprecated_issue = see issue #129893 <https://github.com/rust-lang/rust/issues/129893> for more information
|
||||
|
||||
session_soft_float_ignored =
|
||||
`-Csoft-float` is ignored on this target; it only has an effect on *eabihf targets
|
||||
.note = this may become a hard error in a future version of Rust
|
||||
|
||||
session_split_debuginfo_unstable_platform = `-Csplit-debuginfo={$debuginfo}` is unstable on this platform
|
||||
|
||||
session_split_lto_unit_requires_lto = `-Zsplit-lto-unit` requires `-Clto`, `-Clto=thin`, or `-Clinker-plugin-lto`
|
||||
|
@ -484,3 +484,14 @@ pub(crate) struct FunctionReturnThunkExternRequiresNonLargeCodeModel;
|
||||
pub(crate) struct FailedToCreateProfiler {
|
||||
pub(crate) err: String,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(session_soft_float_ignored)]
|
||||
#[note]
|
||||
pub(crate) struct SoftFloatIgnored;
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(session_soft_float_deprecated)]
|
||||
#[note]
|
||||
#[note(session_soft_float_deprecated_issue)]
|
||||
pub(crate) struct SoftFloatDeprecated;
|
||||
|
@ -1615,7 +1615,7 @@ options! {
|
||||
save_temps: bool = (false, parse_bool, [UNTRACKED],
|
||||
"save all temporary output files during compilation (default: no)"),
|
||||
soft_float: bool = (false, parse_bool, [TRACKED],
|
||||
"use soft float ABI (*eabihf targets only) (default: no)"),
|
||||
"deprecated option: use soft float ABI (*eabihf targets only) (default: no)"),
|
||||
#[rustc_lint_opt_deny_field_access("use `Session::split_debuginfo` instead of this field")]
|
||||
split_debuginfo: Option<SplitDebuginfo> = (None, parse_split_debuginfo, [TRACKED],
|
||||
"how to handle split-debuginfo, a platform-specific option"),
|
||||
|
@ -1340,6 +1340,16 @@ fn validate_commandline_args_with_session_available(sess: &Session) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if sess.opts.cg.soft_float {
|
||||
if sess.target.arch == "arm" && sess.target.abi == "eabihf" {
|
||||
sess.dcx().emit_warn(errors::SoftFloatDeprecated);
|
||||
} else {
|
||||
// All `use_softfp` does is the equivalent of `-mfloat-abi` in GCC/clang, which only exists on ARM targets.
|
||||
// We document this flag to only affect `*eabihf` targets, so let's show a warning for all other targets.
|
||||
sess.dcx().emit_warn(errors::SoftFloatIgnored);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Holds data on the current incremental compilation session, if there is one.
|
||||
|
Loading…
Reference in New Issue
Block a user