xref: /llvm-project/llvm/lib/Target/VE/MCTargetDesc/VEELFObjectWriter.cpp (revision 0e0907fa0e257ba63d6f820eafbf2079502153ed)
1 //===-- VEELFObjectWriter.cpp - VE ELF Writer -----------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "VEFixupKinds.h"
10 #include "VEMCTargetDesc.h"
11 #include "llvm/MC/MCELFObjectWriter.h"
12 #include "llvm/MC/MCExpr.h"
13 #include "llvm/MC/MCObjectWriter.h"
14 #include "llvm/MC/MCValue.h"
15 #include "llvm/Support/ErrorHandling.h"
16 
17 using namespace llvm;
18 
19 namespace {
20 class VEELFObjectWriter : public MCELFObjectTargetWriter {
21 public:
22   VEELFObjectWriter(uint8_t OSABI)
23       : MCELFObjectTargetWriter(/* Is64Bit */ true, OSABI, ELF::EM_VE,
24                                 /* HasRelocationAddend */ true) {}
25 
26   ~VEELFObjectWriter() override {}
27 
28 protected:
29   unsigned getRelocType(MCContext &Ctx, const MCValue &Target,
30                         const MCFixup &Fixup, bool IsPCRel) const override;
31 
32   bool needsRelocateWithSymbol(const MCSymbol &Sym,
33                                unsigned Type) const override;
34 };
35 } // namespace
36 
37 unsigned VEELFObjectWriter::getRelocType(MCContext &Ctx, const MCValue &Target,
38                                          const MCFixup &Fixup,
39                                          bool IsPCRel) const {
40   // FIXME: implements.
41   return ELF::R_VE_NONE;
42 }
43 
44 bool VEELFObjectWriter::needsRelocateWithSymbol(const MCSymbol &Sym,
45                                                 unsigned Type) const {
46   // FIXME: implements.
47   return false;
48 }
49 
50 std::unique_ptr<MCObjectTargetWriter>
51 llvm::createVEELFObjectWriter(uint8_t OSABI) {
52   return std::make_unique<VEELFObjectWriter>(OSABI);
53 }
54