add llvm_floatabi field to target spec that controls FloatABIType
This commit is contained in:
parent
fff026c8e5
commit
a0dbb37ebd
3 changed files with 67 additions and 4 deletions
|
@ -26,7 +26,7 @@ use rustc_session::config::{
|
|||
self, Lto, OutputType, Passes, RemapPathScopeComponents, SplitDwarfKind, SwitchWithOptPath,
|
||||
};
|
||||
use rustc_span::{BytePos, InnerSpan, Pos, SpanData, SyntaxContext, sym};
|
||||
use rustc_target::spec::{CodeModel, RelocModel, SanitizerSet, SplitDebuginfo, TlsModel};
|
||||
use rustc_target::spec::{CodeModel, FloatAbi, RelocModel, SanitizerSet, SplitDebuginfo, TlsModel};
|
||||
use tracing::debug;
|
||||
|
||||
use crate::back::lto::ThinBuffer;
|
||||
|
@ -40,7 +40,7 @@ use crate::errors::{
|
|||
WithLlvmError, WriteBytecode,
|
||||
};
|
||||
use crate::llvm::diagnostic::OptimizationDiagnosticKind::*;
|
||||
use crate::llvm::{self, DiagnosticInfo, FloatAbi, PassManager};
|
||||
use crate::llvm::{self, DiagnosticInfo, PassManager};
|
||||
use crate::type_::Type;
|
||||
use crate::{LlvmCodegenBackend, ModuleLlvm, base, common, llvm_util};
|
||||
|
||||
|
@ -181,6 +181,14 @@ pub(crate) fn to_llvm_code_model(code_model: Option<CodeModel>) -> llvm::CodeMod
|
|||
}
|
||||
}
|
||||
|
||||
fn to_llvm_float_abi(float_abi: Option<FloatAbi>) -> llvm::FloatAbi {
|
||||
match float_abi {
|
||||
None => llvm::FloatAbi::Default,
|
||||
Some(FloatAbi::Soft) => llvm::FloatAbi::Soft,
|
||||
Some(FloatAbi::Hard) => llvm::FloatAbi::Hard,
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn target_machine_factory(
|
||||
sess: &Session,
|
||||
optlvl: config::OptLevel,
|
||||
|
@ -190,11 +198,11 @@ pub(crate) fn target_machine_factory(
|
|||
|
||||
let (opt_level, _) = to_llvm_opt_settings(optlvl);
|
||||
let float_abi = if sess.target.arch == "arm" && sess.opts.cg.soft_float {
|
||||
FloatAbi::Soft
|
||||
llvm::FloatAbi::Soft
|
||||
} 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.
|
||||
FloatAbi::Default
|
||||
to_llvm_float_abi(sess.target.llvm_floatabi)
|
||||
};
|
||||
|
||||
let ffunction_sections =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue