[mips] Fix an initialization issue with MipsABIInfo in MipsTargetELFStreamer

DebugInfoDWARFTests is the only user so far which initializes the
MCObjectStreamer without initializing the ASMParser. The MIPS backend
relies on the ASMParser to initialize the MipsABIInfo object and to
update the target streamer with it. This should turn the mips buildbots
green.

Reviewers: atanasyan, zoran.jovanovic

Differential Revision: https://reviews.llvm.org/D28025

llvm-svn: 293772
This commit is contained in:
Simon Dardis 2017-02-01 15:39:23 +00:00
parent 165fe63b4e
commit 6433d5af6b
1 changed files with 12 additions and 0 deletions

View File

@ -11,6 +11,7 @@
//
//===----------------------------------------------------------------------===//
#include "MCTargetDesc/MipsABIInfo.h"
#include "MipsTargetStreamer.h"
#include "InstPrinter/MipsInstPrinter.h"
#include "MipsELFStreamer.h"
@ -685,6 +686,17 @@ MipsTargetELFStreamer::MipsTargetELFStreamer(MCStreamer &S,
// 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;