Mercurial > hg > CbC > CbC_llvm
comparison lib/Target/Lanai/MCTargetDesc/LanaiELFObjectWriter.cpp @ 121:803732b1fca8
LLVM 5.0
author | kono |
---|---|
date | Fri, 27 Oct 2017 17:07:41 +0900 |
parents | 1172e4bd9c6f |
children | c2174574ed3a |
comparison
equal
deleted
inserted
replaced
120:1172e4bd9c6f | 121:803732b1fca8 |
---|---|
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 | 9 |
10 #include "MCTargetDesc/LanaiBaseInfo.h" | 10 #include "MCTargetDesc/LanaiBaseInfo.h" |
11 #include "MCTargetDesc/LanaiFixupKinds.h" | 11 #include "MCTargetDesc/LanaiFixupKinds.h" |
12 #include "MCTargetDesc/LanaiMCTargetDesc.h" | 12 #include "llvm/BinaryFormat/ELF.h" |
13 #include "llvm/MC/MCELFObjectWriter.h" | 13 #include "llvm/MC/MCELFObjectWriter.h" |
14 #include "llvm/MC/MCSymbol.h" | 14 #include "llvm/MC/MCObjectWriter.h" |
15 #include "llvm/Support/ErrorHandling.h" | 15 #include "llvm/Support/ErrorHandling.h" |
16 #include "llvm/Support/raw_ostream.h" | |
17 | 16 |
18 using namespace llvm; | 17 using namespace llvm; |
19 | 18 |
20 namespace { | 19 namespace { |
20 | |
21 class LanaiELFObjectWriter : public MCELFObjectTargetWriter { | 21 class LanaiELFObjectWriter : public MCELFObjectTargetWriter { |
22 public: | 22 public: |
23 explicit LanaiELFObjectWriter(uint8_t OSABI); | 23 explicit LanaiELFObjectWriter(uint8_t OSABI); |
24 | 24 |
25 ~LanaiELFObjectWriter() override; | 25 ~LanaiELFObjectWriter() override = default; |
26 | 26 |
27 protected: | 27 protected: |
28 unsigned getRelocType(MCContext &Ctx, const MCValue &Target, | 28 unsigned getRelocType(MCContext &Ctx, const MCValue &Target, |
29 const MCFixup &Fixup, bool IsPCRel) const override; | 29 const MCFixup &Fixup, bool IsPCRel) const override; |
30 bool needsRelocateWithSymbol(const MCSymbol &SD, | 30 bool needsRelocateWithSymbol(const MCSymbol &SD, |
31 unsigned Type) const override; | 31 unsigned Type) const override; |
32 }; | 32 }; |
33 } // namespace | 33 |
34 } // end anonymous namespace | |
34 | 35 |
35 LanaiELFObjectWriter::LanaiELFObjectWriter(uint8_t OSABI) | 36 LanaiELFObjectWriter::LanaiELFObjectWriter(uint8_t OSABI) |
36 : MCELFObjectTargetWriter(/*Is64Bit_=*/false, OSABI, ELF::EM_LANAI, | 37 : MCELFObjectTargetWriter(/*Is64Bit_=*/false, OSABI, ELF::EM_LANAI, |
37 /*HasRelocationAddend=*/true) {} | 38 /*HasRelocationAddend=*/true) {} |
38 | |
39 LanaiELFObjectWriter::~LanaiELFObjectWriter() {} | |
40 | 39 |
41 unsigned LanaiELFObjectWriter::getRelocType(MCContext & /*Ctx*/, | 40 unsigned LanaiELFObjectWriter::getRelocType(MCContext & /*Ctx*/, |
42 const MCValue & /*Target*/, | 41 const MCValue & /*Target*/, |
43 const MCFixup &Fixup, | 42 const MCFixup &Fixup, |
44 bool /*IsPCRel*/) const { | 43 bool /*IsPCRel*/) const { |
86 default: | 85 default: |
87 return false; | 86 return false; |
88 } | 87 } |
89 } | 88 } |
90 | 89 |
91 MCObjectWriter *llvm::createLanaiELFObjectWriter(raw_pwrite_stream &OS, | 90 std::unique_ptr<MCObjectWriter> |
92 uint8_t OSABI) { | 91 llvm::createLanaiELFObjectWriter(raw_pwrite_stream &OS, uint8_t OSABI) { |
93 MCELFObjectTargetWriter *MOTW = new LanaiELFObjectWriter(OSABI); | 92 return createELFObjectWriter(llvm::make_unique<LanaiELFObjectWriter>(OSABI), |
94 return createELFObjectWriter(MOTW, OS, /*IsLittleEndian=*/false); | 93 OS, /*IsLittleEndian=*/false); |
95 } | 94 } |