29 X86ELFObjectWriter(
bool IsELF64, uint8_t OSABI,
uint16_t EMachine);
30 ~X86ELFObjectWriter()
override =
default;
39X86ELFObjectWriter::X86ELFObjectWriter(
bool IsELF64, uint8_t OSABI,
52 switch (
unsigned(Kind)) {
94 "32 bit reloc applied to a field with a different size");
100 "64 bit reloc applied to a field with a different size");
115 return ELF::R_X86_64_NONE;
118 return IsPCRel ? ELF::R_X86_64_PC64 : ELF::R_X86_64_64;
120 return IsPCRel ? ELF::R_X86_64_PC32 : ELF::R_X86_64_32;
122 return ELF::R_X86_64_32S;
124 return IsPCRel ? ELF::R_X86_64_PC16 : ELF::R_X86_64_16;
126 return IsPCRel ? ELF::R_X86_64_PC8 : ELF::R_X86_64_8;
132 return IsPCRel ? ELF::R_X86_64_GOTPC64 : ELF::R_X86_64_GOT64;
134 return IsPCRel ? ELF::R_X86_64_GOTPC32 : ELF::R_X86_64_GOT32;
145 Ctx.
reportError(Loc,
"unsupported relocation type");
146 return ELF::R_X86_64_GOTOFF64;
151 return ELF::R_X86_64_TPOFF64;
153 return ELF::R_X86_64_TPOFF32;
165 return ELF::R_X86_64_DTPOFF64;
167 return ELF::R_X86_64_DTPOFF32;
179 return ELF::R_X86_64_SIZE64;
181 return ELF::R_X86_64_SIZE32;
190 return ELF::R_X86_64_TLSDESC_CALL;
192 return ELF::R_X86_64_GOTPC32_TLSDESC;
195 return ELF::R_X86_64_TLSGD;
198 return ELF::R_X86_64_GOTTPOFF;
201 return ELF::R_X86_64_TLSLD;
204 return ELF::R_X86_64_PLT32;
211 return ELF::R_X86_64_GOTPCREL;
212 switch (
unsigned(Kind)) {
214 return ELF::R_X86_64_GOTPCREL;
216 return ELF::R_X86_64_GOTPCRELX;
219 return ELF::R_X86_64_REX_GOTPCRELX;
224 return ELF::R_X86_64_GOTPCREL;
227 return ELF::R_X86_64_PLTOFF64;
245 return ELF::R_386_NONE;
248 return IsPCRel ? ELF::R_386_PC32 : ELF::R_386_32;
250 return IsPCRel ? ELF::R_386_PC16 : ELF::R_386_16;
252 return IsPCRel ? ELF::R_386_PC8 : ELF::R_386_8;
259 return ELF::R_386_GOTPC;
263 return ELF::R_386_GOT32;
272 return ELF::R_386_GOTOFF;
274 return ELF::R_386_TLS_DESC_CALL;
276 return ELF::R_386_TLS_GOTDESC;
281 return ELF::R_386_TLS_LE_32;
286 return ELF::R_386_TLS_LDO_32;
291 return ELF::R_386_TLS_GD;
296 return ELF::R_386_TLS_IE_32;
300 return ELF::R_386_PLT32;
305 return ELF::R_386_TLS_IE;
310 return ELF::R_386_TLS_LE;
315 return ELF::R_386_TLS_GOTIE;
320 return ELF::R_386_TLS_LDM;
322 Ctx.
reportError(Loc,
"unsupported relocation type");
323 return ELF::R_386_NONE;
328 bool IsPCRel)
const {
338 "Unsupported ELF machine type.");
346 return ELF::R_386_NONE;
361std::unique_ptr<MCObjectTargetWriter>
363 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_signed_4byte_relax
@ reloc_branch_4byte_pcrel
@ reloc_riprel_4byte_relax
@ reloc_riprel_4byte_relax_rex
@ reloc_global_offset_table
@ reloc_riprel_4byte_movq_load
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.