29 X86ELFObjectWriter(
bool IsELF64, uint8_t OSABI,
uint16_t EMachine);
30 ~X86ELFObjectWriter()
override =
default;
34 const MCFixup &Fixup,
bool IsPCRel)
const override;
39 X86ELFObjectWriter::X86ELFObjectWriter(
bool IsELF64, uint8_t OSABI,
44 (EMachine != ELF::
EM_386) &&
52 switch (
unsigned(Kind)) {
94 "32 bit reloc applied to a field with a different size");
109 return ELF::R_X86_64_NONE;
112 return IsPCRel ? ELF::R_X86_64_PC64 : ELF::R_X86_64_64;
114 return IsPCRel ? ELF::R_X86_64_PC32 : ELF::R_X86_64_32;
116 return ELF::R_X86_64_32S;
118 return IsPCRel ? ELF::R_X86_64_PC16 : ELF::R_X86_64_16;
120 return IsPCRel ? ELF::R_X86_64_PC8 : ELF::R_X86_64_8;
126 return IsPCRel ? ELF::R_X86_64_GOTPC64 : ELF::R_X86_64_GOT64;
128 return IsPCRel ? ELF::R_X86_64_GOTPC32 : ELF::R_X86_64_GOT32;
139 return ELF::R_X86_64_GOTOFF64;
144 return ELF::R_X86_64_TPOFF64;
146 return ELF::R_X86_64_TPOFF32;
158 return ELF::R_X86_64_DTPOFF64;
160 return ELF::R_X86_64_DTPOFF32;
172 return ELF::R_X86_64_SIZE64;
174 return ELF::R_X86_64_SIZE32;
183 return ELF::R_X86_64_TLSDESC_CALL;
185 return ELF::R_X86_64_GOTPC32_TLSDESC;
188 return ELF::R_X86_64_TLSGD;
191 return ELF::R_X86_64_GOTTPOFF;
194 return ELF::R_X86_64_TLSLD;
197 return ELF::R_X86_64_PLT32;
204 return ELF::R_X86_64_GOTPCREL;
205 switch (
unsigned(Kind)) {
207 return ELF::R_X86_64_GOTPCREL;
209 return ELF::R_X86_64_GOTPCRELX;
212 return ELF::R_X86_64_REX_GOTPCRELX;
249 return ELF::R_386_NONE;
252 return IsPCRel ? ELF::R_386_PC32 : ELF::R_386_32;
254 return IsPCRel ? ELF::R_386_PC16 : ELF::R_386_16;
256 return IsPCRel ? ELF::R_386_PC8 : ELF::R_386_8;
262 return ELF::R_386_GOTPC;
266 return ELF::R_386_GOT32;
274 return ELF::R_386_GOTOFF;
276 return ELF::R_386_TLS_DESC_CALL;
278 return ELF::R_386_TLS_GOTDESC;
282 return ELF::R_386_TLS_LE_32;
286 return ELF::R_386_TLS_LDO_32;
290 return ELF::R_386_TLS_GD;
294 return ELF::R_386_TLS_IE_32;
297 return ELF::R_386_PLT32;
301 return ELF::R_386_TLS_IE;
305 return ELF::R_386_TLS_LE;
309 return ELF::R_386_TLS_GOTIE;
313 return ELF::R_386_TLS_LDM;
319 bool IsPCRel)
const {
327 "Unsupported ELF machine type.");
331 std::unique_ptr<MCObjectTargetWriter>
333 return std::make_unique<X86ELFObjectWriter>(IsELF64, OSABI, EMachine);
const MCAsmInfo * getAsmInfo() const
This class represents lattice values for constants.
This represents an "assembler immediate".
MCSymbolRefExpr::VariantKind getAccessVariant() const
bool canRelaxRelocations() const
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
A one-byte pc relative fixup.
static void checkIs32(MCContext &Ctx, SMLoc Loc, X86_64RelType Type)
static unsigned getRelocType(const MCValue &Target, const MCFixupKind FixupKind, const bool IsPCRel)
Translates generic PPC fixup kind to Mach-O/PPC relocation type enum.
Context object for machine code objects.
static unsigned getRelocType32(MCContext &Ctx, MCSymbolRefExpr::VariantKind Modifier, X86_32RelType Type, bool IsPCRel, MCFixupKind Kind)
std::unique_ptr< MCObjectTargetWriter > createX86ELFObjectWriter(bool IsELF64, uint8_t OSABI, uint16_t EMachine)
Construct an X86 ELF object writer.
static X86_64RelType getType64(MCFixupKind Kind, MCSymbolRefExpr::VariantKind &Modifier, bool &IsPCRel)
The instances of the Type class are immutable: once they are created, they are never changed...
static X86_32RelType getType32(X86_64RelType T)
MCFixupKind
Extensible enumeration to represent the type of a fixup.
void reportError(SMLoc L, const Twine &Msg)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
PowerPC TLS Dynamic Call Fixup
A two-byte pc relative fixup.
A four-byte pc relative fixup.
Target - Wrapper for Target specific information.
static unsigned getRelocType64(MCContext &Ctx, SMLoc Loc, MCSymbolRefExpr::VariantKind Modifier, X86_64RelType Type, bool IsPCRel, MCFixupKind Kind)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Represents a location in source code.
MCFixupKind getKind() const