LLVM  14.0.0git
CSKYELFObjectWriter.cpp
Go to the documentation of this file.
1 //===-- CSKYELFObjectWriter.cpp - CSKY 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 "CSKYMCTargetDesc.h"
10 #include "llvm/MC/MCContext.h"
12 #include "llvm/MC/MCObjectWriter.h"
13 
14 #define DEBUG_TYPE "csky-elf-object-writer"
15 
16 using namespace llvm;
17 
18 namespace {
19 
20 class CSKYELFObjectWriter : public MCELFObjectTargetWriter {
21 public:
22  CSKYELFObjectWriter(uint8_t OSABI = 0)
23  : MCELFObjectTargetWriter(false, OSABI, ELF::EM_CSKY, true){};
24  ~CSKYELFObjectWriter() {}
25 
26  unsigned getRelocType(MCContext &Ctx, const MCValue &Target,
27  const MCFixup &Fixup, bool IsPCRel) const override;
28 };
29 
30 } // namespace
31 
32 unsigned CSKYELFObjectWriter::getRelocType(MCContext &Ctx,
33  const MCValue &Target,
34  const MCFixup &Fixup,
35  bool IsPCRel) const {
36  // Determine the type of the relocation.
37  switch ((unsigned)Fixup.getKind()) {
38  default:
39  llvm_unreachable("invalid fixup kind!");
40  }
41 }
42 
43 std::unique_ptr<MCObjectTargetWriter> llvm::createCSKYELFObjectWriter() {
44  return std::make_unique<CSKYELFObjectWriter>();
45 }
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
llvm::MCContext
Context object for machine code objects.
Definition: MCContext.h:72
llvm::Target
Target - Wrapper for Target specific information.
Definition: TargetRegistry.h:137
llvm::ELF::EM_CSKY
@ EM_CSKY
Definition: ELF.h:322
MCContext.h
llvm::MCELFObjectTargetWriter
Definition: MCELFObjectWriter.h:53
MCELFObjectWriter.h
CSKYMCTargetDesc.h
Fixup
PowerPC TLS Dynamic Call Fixup
Definition: PPCTLSDynamicCall.cpp:235
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:134
llvm::createCSKYELFObjectWriter
std::unique_ptr< MCObjectTargetWriter > createCSKYELFObjectWriter()
Definition: CSKYELFObjectWriter.cpp:43
MCObjectWriter.h
llvm::MCValue
This represents an "assembler immediate".
Definition: MCValue.h:37
llvm::MCFixup
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Definition: MCFixup.h:71