Files
archived-llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFObjectWriter.cpp
Alex Bradbury 5f1fa48a24 [RISCV] Fix two abuses of llvm_unreachable
Replace with report_fatal_error.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311276 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-20 06:57:27 +00:00

48 lines
1.7 KiB
C++

//===-- RISCVELFObjectWriter.cpp - RISCV ELF Writer -----------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "MCTargetDesc/RISCVMCTargetDesc.h"
#include "llvm/MC/MCELFObjectWriter.h"
#include "llvm/MC/MCFixup.h"
#include "llvm/Support/ErrorHandling.h"
using namespace llvm;
namespace {
class RISCVELFObjectWriter : public MCELFObjectTargetWriter {
public:
RISCVELFObjectWriter(uint8_t OSABI, bool Is64Bit);
~RISCVELFObjectWriter() override;
protected:
unsigned getRelocType(MCContext &Ctx, const MCValue &Target,
const MCFixup &Fixup, bool IsPCRel) const override;
};
}
RISCVELFObjectWriter::RISCVELFObjectWriter(uint8_t OSABI, bool Is64Bit)
: MCELFObjectTargetWriter(Is64Bit, OSABI, ELF::EM_RISCV,
/*HasRelocationAddend*/ true) {}
RISCVELFObjectWriter::~RISCVELFObjectWriter() {}
unsigned RISCVELFObjectWriter::getRelocType(MCContext &Ctx,
const MCValue &Target,
const MCFixup &Fixup,
bool IsPCRel) const {
report_fatal_error("invalid fixup kind!");
}
MCObjectWriter *llvm::createRISCVELFObjectWriter(raw_pwrite_stream &OS,
uint8_t OSABI, bool Is64Bit) {
MCELFObjectTargetWriter *MOTW = new RISCVELFObjectWriter(OSABI, Is64Bit);
return createELFObjectWriter(MOTW, OS, /*IsLittleEndian*/ true);
}