summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorSimon Atanasyan <simon@atanasyan.com>2019-02-26 14:45:17 +0000
committerSimon Atanasyan <simon@atanasyan.com>2019-02-26 14:45:17 +0000
commit8cb497027d262372d33d56040d513a4935d08b7a (patch)
treeba0cbaca6e2bfa322879a79b222c7d0c5cd8498f /llvm/lib
parent0d4f9216aabfefe2dc9e9d74427a9699793db4bc (diff)
downloadbcm5719-llvm-8cb497027d262372d33d56040d513a4935d08b7a.tar.gz
bcm5719-llvm-8cb497027d262372d33d56040d513a4935d08b7a.zip
[mips] Emit `.module softfloat` directive
This change fixes crash on an assertion in case of using `soft float` ABI for mips32r6 target. llvm-svn: 354882
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp7
-rw-r--r--llvm/lib/Target/Mips/MipsAsmPrinter.cpp3
2 files changed, 7 insertions, 3 deletions
diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp b/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
index f00a9fe20ef..ba645d2f6ab 100644
--- a/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
+++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
@@ -699,8 +699,11 @@ void MipsTargetAsmStreamer::emitDirectiveCpreturn(unsigned SaveLocation,
}
void MipsTargetAsmStreamer::emitDirectiveModuleFP() {
- OS << "\t.module\tfp=";
- OS << ABIFlagsSection.getFpABIString(ABIFlagsSection.getFpABI()) << "\n";
+ MipsABIFlagsSection::FpABIKind FpABI = ABIFlagsSection.getFpABI();
+ if (FpABI == MipsABIFlagsSection::FpABIKind::SOFT)
+ OS << "\t.module\tsoftfloat\n";
+ else
+ OS << "\t.module\tfp=" << ABIFlagsSection.getFpABIString(FpABI) << "\n";
}
void MipsTargetAsmStreamer::emitDirectiveSetFp(
diff --git a/llvm/lib/Target/Mips/MipsAsmPrinter.cpp b/llvm/lib/Target/Mips/MipsAsmPrinter.cpp
index d4a8d41c460..c523e20ab03 100644
--- a/llvm/lib/Target/Mips/MipsAsmPrinter.cpp
+++ b/llvm/lib/Target/Mips/MipsAsmPrinter.cpp
@@ -812,7 +812,8 @@ void MipsAsmPrinter::EmitStartOfAsmFile(Module &M) {
// We should always emit a '.module fp=...' but binutils 2.24 does not accept
// it. We therefore emit it when it contradicts the ABI defaults (-mfpxx or
// -mfp64) and omit it otherwise.
- if (ABI.IsO32() && (STI.isABI_FPXX() || STI.isFP64bit()))
+ if ((ABI.IsO32() && (STI.isABI_FPXX() || STI.isFP64bit())) ||
+ STI.useSoftFloat())
TS.emitDirectiveModuleFP();
// We should always emit a '.module [no]oddspreg' but binutils 2.24 does not
OpenPOWER on IntegriCloud