[PATCH] D28025: [mips] Fix an initialization issue with MipsABIInfo in MipsTargetELFStreamer

Simon Dardis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 1 07:50:50 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL293772: [mips] Fix an initialization issue with MipsABIInfo in MipsTargetELFStreamer (authored by sdardis).

Changed prior to commit:
  https://reviews.llvm.org/D28025?vs=82238&id=86638#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D28025

Files:
  llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp


Index: llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
===================================================================
--- llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
+++ llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
@@ -11,6 +11,7 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "MCTargetDesc/MipsABIInfo.h"
 #include "MipsTargetStreamer.h"
 #include "InstPrinter/MipsInstPrinter.h"
 #include "MipsELFStreamer.h"
@@ -685,6 +686,17 @@
   // issues as well.
   unsigned EFlags = MCA.getELFHeaderEFlags();
 
+  // FIXME: Fix a dependency issue by instantiating the ABI object to some
+  // default based off the triple. The triple doesn't describe the target
+  // fully, but any external user of the API that uses the MCTargetStreamer
+  // would otherwise crash on assertion failure.
+
+  ABI = MipsABIInfo(
+      STI.getTargetTriple().getArch() == Triple::ArchType::mipsel ||
+              STI.getTargetTriple().getArch() == Triple::ArchType::mips
+          ? MipsABIInfo::O32()
+          : MipsABIInfo::N64());
+
   // Architecture
   if (Features[Mips::FeatureMips64r6])
     EFlags |= ELF::EF_MIPS_ARCH_64R6;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28025.86638.patch
Type: text/x-patch
Size: 1225 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170201/a2205bee/attachment.bin>


More information about the llvm-commits mailing list