1//===-- RISCVELFObjectWriter.cpp - RISC-V ELF Writer ----------------------===// 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 7//===----------------------------------------------------------------------===// 24 RISCVELFObjectWriter(
uint8_t OSABI,
bool Is64Bit);
26 ~RISCVELFObjectWriter()
override;
28// Return true if the given relocation must be with a symbol rather than 29// section plus offset. 31unsignedType)
const override{
32// TODO: this is very conservative, update once RISC-V psABI requirements 43RISCVELFObjectWriter::RISCVELFObjectWriter(
uint8_t OSABI,
bool Is64Bit)
45/*HasRelocationAddend*/true) {}
47RISCVELFObjectWriter::~RISCVELFObjectWriter() =
default;
49unsigned RISCVELFObjectWriter::getRelocType(
MCContext &Ctx,
54// Determine the type of the relocation 62return ELF::R_RISCV_NONE;
67 : ELF::R_RISCV_32_PCREL;
69return ELF::R_RISCV_PCREL_HI20;
71return ELF::R_RISCV_PCREL_LO12_I;
73return ELF::R_RISCV_PCREL_LO12_S;
75return ELF::R_RISCV_GOT_HI20;
77return ELF::R_RISCV_TLS_GOT_HI20;
79return ELF::R_RISCV_TLS_GD_HI20;
81return ELF::R_RISCV_TLSDESC_HI20;
83return ELF::R_RISCV_TLSDESC_LOAD_LO12;
85return ELF::R_RISCV_TLSDESC_ADD_LO12;
87return ELF::R_RISCV_TLSDESC_CALL;
89return ELF::R_RISCV_JAL;
91return ELF::R_RISCV_BRANCH;
93return ELF::R_RISCV_RVC_JUMP;
95return ELF::R_RISCV_RVC_BRANCH;
97return ELF::R_RISCV_CALL_PLT;
99return ELF::R_RISCV_CALL_PLT;
106return ELF::R_RISCV_NONE;
108return ELF::R_RISCV_TLSDESC_LOAD_LO12;
110return ELF::R_RISCV_TLSDESC_ADD_LO12;
112return ELF::R_RISCV_TLSDESC_CALL;
116return ELF::R_RISCV_NONE;
119return ELF::R_RISCV_NONE;
123return ELF::R_RISCV_32_PCREL;
125return ELF::R_RISCV_GOT32_PCREL;
126return ELF::R_RISCV_32;
128return ELF::R_RISCV_64;
130return ELF::R_RISCV_HI20;
132return ELF::R_RISCV_LO12_I;
134return ELF::R_RISCV_LO12_S;
136return ELF::R_RISCV_TPREL_HI20;
138return ELF::R_RISCV_TPREL_LO12_I;
140return ELF::R_RISCV_TPREL_LO12_S;
142return ELF::R_RISCV_TPREL_ADD;
144return ELF::R_RISCV_RELAX;
146return ELF::R_RISCV_ALIGN;
150std::unique_ptr<MCObjectTargetWriter>
152return std::make_unique<RISCVELFObjectWriter>(OSABI, Is64Bit);
PowerPC TLS Dynamic Call Fixup
Context object for machine code objects.
void reportError(SMLoc L, const Twine &Msg)
virtual bool needsRelocateWithSymbol(const MCValue &Val, const MCSymbol &Sym, unsigned Type) const
virtual unsigned getRelocType(MCContext &Ctx, const MCValue &Target, const MCFixup &Fixup, bool IsPCRel) const =0
Base class for the full range of assembler expressions which are needed for parsing.
@ Target
Target specific expression.
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
This represents an "assembler immediate".
Target - Wrapper for Target specific information.
The instances of the Type class are immutable: once they are created, they are never changed.
@ fixup_riscv_tprel_lo12_s
@ fixup_riscv_tls_got_hi20
@ fixup_riscv_tls_gd_hi20
@ fixup_riscv_pcrel_lo12_i
@ fixup_riscv_tlsdesc_call
@ fixup_riscv_pcrel_lo12_s
@ fixup_riscv_tprel_lo12_i
@ fixup_riscv_tlsdesc_load_lo12
@ fixup_riscv_tlsdesc_hi20
@ fixup_riscv_tlsdesc_add_lo12
This is an optimization pass for GlobalISel generic memory operations.
std::unique_ptr< MCObjectTargetWriter > createRISCVELFObjectWriter(uint8_t OSABI, bool Is64Bit)
@ FK_PCRel_4
A four-byte pc relative fixup.
@ FirstLiteralRelocationKind
The range [FirstLiteralRelocationKind, MaxTargetFixupKind) is used for relocations coming from ....
@ FK_Data_8
A eight-byte fixup.
@ FK_Data_1
A one-byte fixup.
@ FK_Data_4
A four-byte fixup.
@ FK_Data_2
A two-byte fixup.