30 ~X86ELFObjectWriter()
override =
default;
39X86ELFObjectWriter::X86ELFObjectWriter(
bool IsELF64,
uint8_t OSABI,
52 switch (
unsigned(Kind)) {
97 "32 bit reloc applied to a field with a different size");
103 "64 bit reloc applied to a field with a different size");
118 return ELF::R_X86_64_NONE;
121 return IsPCRel ? ELF::R_X86_64_PC64 : ELF::R_X86_64_64;
123 return IsPCRel ? ELF::R_X86_64_PC32 : ELF::R_X86_64_32;
125 return ELF::R_X86_64_32S;
127 return IsPCRel ? ELF::R_X86_64_PC16 : ELF::R_X86_64_16;
129 return IsPCRel ? ELF::R_X86_64_PC8 : ELF::R_X86_64_8;
135 return IsPCRel ? ELF::R_X86_64_GOTPC64 : ELF::R_X86_64_GOT64;
137 return IsPCRel ? ELF::R_X86_64_GOTPC32 : ELF::R_X86_64_GOT32;
148 Ctx.
reportError(Loc,
"unsupported relocation type");
149 return ELF::R_X86_64_GOTOFF64;
154 return ELF::R_X86_64_TPOFF64;
156 return ELF::R_X86_64_TPOFF32;
168 return ELF::R_X86_64_DTPOFF64;
170 return ELF::R_X86_64_DTPOFF32;
182 return ELF::R_X86_64_SIZE64;
184 return ELF::R_X86_64_SIZE32;
193 return ELF::R_X86_64_TLSDESC_CALL;
196 ? ELF::R_X86_64_CODE_4_GOTPC32_TLSDESC
197 : ELF::R_X86_64_GOTPC32_TLSDESC;
200 return ELF::R_X86_64_TLSGD;
205 return ELF::R_X86_64_CODE_4_GOTTPOFF;
207 return ELF::R_X86_64_CODE_6_GOTTPOFF;
208 return ELF::R_X86_64_GOTTPOFF;
211 return ELF::R_X86_64_TLSLD;
214 return ELF::R_X86_64_PLT32;
221 return ELF::R_X86_64_GOTPCREL;
222 switch (
unsigned(Kind)) {
224 return ELF::R_X86_64_GOTPCREL;
226 return ELF::R_X86_64_GOTPCRELX;
229 return ELF::R_X86_64_REX_GOTPCRELX;
232 return ELF::R_X86_64_CODE_4_GOTPCRELX;
237 return ELF::R_X86_64_GOTPCREL;
240 return ELF::R_X86_64_PLTOFF64;
258 return ELF::R_386_NONE;
261 return IsPCRel ? ELF::R_386_PC32 : ELF::R_386_32;
263 return IsPCRel ? ELF::R_386_PC16 : ELF::R_386_16;
265 return IsPCRel ? ELF::R_386_PC8 : ELF::R_386_8;
272 return ELF::R_386_GOTPC;
276 return ELF::R_386_GOT32;
285 return ELF::R_386_GOTOFF;
287 return ELF::R_386_TLS_DESC_CALL;
289 return ELF::R_386_TLS_GOTDESC;
294 return ELF::R_386_TLS_LE_32;
299 return ELF::R_386_TLS_LDO_32;
304 return ELF::R_386_TLS_GD;
309 return ELF::R_386_TLS_IE_32;
313 return ELF::R_386_PLT32;
318 return ELF::R_386_TLS_IE;
323 return ELF::R_386_TLS_LE;
328 return ELF::R_386_TLS_GOTIE;
333 return ELF::R_386_TLS_LDM;
335 Ctx.
reportError(Loc,
"unsupported relocation type");
336 return ELF::R_386_NONE;
341 bool IsPCRel)
const {
351 "Unsupported ELF machine type.");
359 return ELF::R_386_NONE;
374std::unique_ptr<MCObjectTargetWriter>
376 return std::make_unique<X86ELFObjectWriter>(IsELF64, OSABI, EMachine);
PowerPC TLS Dynamic Call Fixup
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static void checkIs64(MCContext &Ctx, SMLoc Loc, X86_64RelType Type)
static X86_64RelType getType64(MCFixupKind Kind, MCSymbolRefExpr::VariantKind &Modifier, bool &IsPCRel)
static void checkIs32(MCContext &Ctx, SMLoc Loc, X86_64RelType Type)
static unsigned getRelocType32(MCContext &Ctx, SMLoc Loc, MCSymbolRefExpr::VariantKind Modifier, X86_32RelType Type, bool IsPCRel, MCFixupKind Kind)
static unsigned getRelocType64(MCContext &Ctx, SMLoc Loc, MCSymbolRefExpr::VariantKind Modifier, X86_64RelType Type, bool IsPCRel, MCFixupKind Kind)
Context object for machine code objects.
void reportError(SMLoc L, const Twine &Msg)
const MCTargetOptions * getTargetOptions() const
virtual unsigned getRelocType(MCContext &Ctx, const MCValue &Target, const MCFixup &Fixup, bool IsPCRel) const =0
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
This represents an "assembler immediate".
Represents a location in source code.
Target - Wrapper for Target specific information.
The instances of the Type class are immutable: once they are created, they are never changed.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ reloc_global_offset_table8
@ reloc_riprel_4byte_movq_load_rex2
@ reloc_signed_4byte_relax
@ reloc_branch_4byte_pcrel
@ reloc_riprel_4byte_relax
@ reloc_riprel_4byte_relax_evex
@ reloc_riprel_4byte_relax_rex
@ reloc_global_offset_table
@ reloc_riprel_4byte_movq_load
@ reloc_riprel_4byte_relax_rex2
This is an optimization pass for GlobalISel generic memory operations.
MCFixupKind
Extensible enumeration to represent the type of a fixup.
@ FK_PCRel_4
A four-byte pc relative fixup.
@ FK_PCRel_2
A two-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_PCRel_1
A one-byte pc relative fixup.
@ FK_Data_2
A two-byte fixup.
std::unique_ptr< MCObjectTargetWriter > createX86ELFObjectWriter(bool IsELF64, uint8_t OSABI, uint16_t EMachine)
Construct an X86 ELF object writer.