23 AMDGPUELFObjectWriter(
bool Is64Bit, uint8_t OSABI,
bool HasRelocationAddend);
26 unsigned getRelocType(
const MCFixup &,
const MCValue &,
27 bool IsPCRel)
const override;
33AMDGPUELFObjectWriter::AMDGPUELFObjectWriter(
bool Is64Bit,
uint8_t OSABI,
34 bool HasRelocationAddend)
36 HasRelocationAddend) {}
38unsigned AMDGPUELFObjectWriter::getRelocType(
const MCFixup &Fixup,
41 if (
const auto *SymA =
Target.getAddSym()) {
44 if (SymA->getName() ==
"SCRATCH_RSRC_DWORD0" ||
45 SymA->getName() ==
"SCRATCH_RSRC_DWORD1")
46 return ELF::R_AMDGPU_ABS32_LO;
53 return ELF::R_AMDGPU_GOTPCREL;
55 return ELF::R_AMDGPU_GOTPCREL32_LO;
57 return ELF::R_AMDGPU_GOTPCREL32_HI;
59 return ELF::R_AMDGPU_REL32_LO;
61 return ELF::R_AMDGPU_REL32_HI;
63 return ELF::R_AMDGPU_REL64;
65 return ELF::R_AMDGPU_ABS32_LO;
67 return ELF::R_AMDGPU_ABS32_HI;
69 return ELF::R_AMDGPU_ABS64;
77 return IsPCRel ? ELF::R_AMDGPU_REL32 : ELF::R_AMDGPU_ABS32;
79 return IsPCRel ? ELF::R_AMDGPU_REL64 : ELF::R_AMDGPU_ABS64;
84 const auto *SymA =
Target.getAddSym();
87 return ELF::R_AMDGPU_NONE;
90 if (SymA->isUndefined()) {
92 Twine(
"undefined label '") + SymA->getName() +
"'");
93 return ELF::R_AMDGPU_NONE;
99 const auto *SymELF =
static_cast<const MCSymbolELF *
>(SymA);
103 ?
"pc-relative prefetch target must be in the same section"
104 :
"pc-relative prefetch target must be a local label");
105 return ELF::R_AMDGPU_NONE;
107 return ELF::R_AMDGPU_REL16;
113std::unique_ptr<MCObjectTargetWriter>
115 bool HasRelocationAddend) {
116 return std::make_unique<AMDGPUELFObjectWriter>(Is64Bit, OSABI,
117 HasRelocationAddend);
Provides AMDGPU specific target descriptions.
static Error reportError(StringRef Message)
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Target - Wrapper for Target specific information.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ fixup_si_sopp_br
16-bit PC relative fixup for SOPP branch instructions.
@ fixup_si_smem_pcrel
24-bit PC-relative byte offset for s_prefetch_inst_pc_rel.
This is an optimization pass for GlobalISel generic memory operations.
std::unique_ptr< MCObjectTargetWriter > createAMDGPUELFObjectWriter(bool Is64Bit, uint8_t OSABI, bool HasRelocationAddend)
uint16_t MCFixupKind
Extensible enumeration to represent the type of a fixup.
@ FK_Data_8
A eight-byte fixup.
@ FK_Data_4
A four-byte fixup.
@ FK_SecRel_4
A four-byte section relative fixup.