LLVM  4.0.0
RISCVELFObjectWriter.cpp
Go to the documentation of this file.
1 //===-- RISCVELFObjectWriter.cpp - RISCV ELF Writer -----------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
12 #include "llvm/MC/MCFixup.h"
14 
15 using namespace llvm;
16 
17 namespace {
18 class RISCVELFObjectWriter : public MCELFObjectTargetWriter {
19 public:
20  RISCVELFObjectWriter(uint8_t OSABI, bool Is64Bit);
21 
22  ~RISCVELFObjectWriter() override;
23 
24 protected:
25  unsigned getRelocType(MCContext &Ctx, const MCValue &Target,
26  const MCFixup &Fixup, bool IsPCRel) const override;
27 };
28 }
29 
30 RISCVELFObjectWriter::RISCVELFObjectWriter(uint8_t OSABI, bool Is64Bit)
31  : MCELFObjectTargetWriter(Is64Bit, OSABI, ELF::EM_RISCV,
32  /*HasRelocationAddend*/ false) {}
33 
34 RISCVELFObjectWriter::~RISCVELFObjectWriter() {}
35 
37  const MCValue &Target,
38  const MCFixup &Fixup,
39  bool IsPCRel) const {
40  llvm_unreachable("invalid fixup kind!");
41 }
42 
44  uint8_t OSABI, bool Is64Bit) {
45  MCELFObjectTargetWriter *MOTW = new RISCVELFObjectWriter(OSABI, Is64Bit);
46  return createELFObjectWriter(MOTW, OS, /*IsLittleEndian*/ true);
47 }
This represents an "assembler immediate".
Definition: MCValue.h:40
Defines the object file and target independent interfaces used by the assembler backend to write nati...
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Definition: MCFixup.h:66
static unsigned getRelocType(const MCValue &Target, const MCFixupKind FixupKind, const bool IsPCRel)
Translates generic PPC fixup kind to Mach-O/PPC relocation type enum.
Context object for machine code objects.
Definition: MCContext.h:51
Function Alias Analysis false
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
PowerPC TLS Dynamic Call Fixup
Target - Wrapper for Target specific information.
MCObjectWriter * createELFObjectWriter(MCELFObjectTargetWriter *MOTW, raw_pwrite_stream &OS, bool IsLittleEndian)
Construct a new ELF writer instance.
An abstract base class for streams implementations that also support a pwrite operation.
Definition: raw_ostream.h:333
MCObjectWriter * createRISCVELFObjectWriter(raw_pwrite_stream &OS, uint8_t OSABI, bool Is64Bit)