28 bool getAArch64FixupKindMachOInfo(
const MCFixup &
Fixup,
unsigned &RelocType,
33 AArch64MachObjectWriter(uint32_t
CPUType, uint32_t CPUSubtype)
39 uint64_t &FixedValue)
override;
43 bool AArch64MachObjectWriter::getAArch64FixupKindMachOInfo(
49 switch ((
unsigned)Fixup.
getKind()) {
95 "ADR/ADRP relocations must be GOT relative");
142 void AArch64MachObjectWriter::recordRelocation(
145 uint64_t &FixedValue) {
150 unsigned Log2Size = 0;
155 const MCSymbol *RelSymbol =
nullptr;
161 FixedValue += FixupOffset;
174 "conditional branch requires assembler-local"
185 "Invalid relocation on conditional branch!");
189 if (!getAArch64FixupKindMachOInfo(Fixup, Type, Target.
getSymA(), Log2Size,
204 "PC relative absolute relocation!");
228 MRE.
r_word1 = (IsPCRel << 24) | (Log2Size << 25) | (Type << 28);
235 "unsupported relocation of modified symbol");
240 "unsupported pc-relative relocation of "
252 "unsupported relocation of local symbol '" + A->
getName() +
253 "'. Must have non-local symbol earlier in section.");
257 "unsupported relocation of local symbol '" + B->
getName() +
258 "'. Must have non-local symbol earlier in section.");
260 if (A_Base == B_Base && A_Base)
262 "unsupported relocation with identical base");
275 MRE.
r_word1 = (IsPCRel << 24) | (Log2Size << 25) | (Type << 28);
285 bool CanUseLocalRelocation =
287 if (Symbol->
isTemporary() && (Value || !CanUseLocalRelocation)) {
314 "unable to resolve variable '" +
316 return recordRelocation(Writer, Asm, Layout, Fragment, Fixup, Target,
340 if (!CanUseLocalRelocation)
343 "unsupported relocation of local symbol '" + Symbol->
getName() +
344 "'. Must have non-local symbol earlier in section.");
365 "unsupported relocation of variable '" +
377 assert((Value & 0xff000000) == 0 &&
"Added relocation out of range!");
382 (Index << 0) | (IsPCRel << 24) | (Log2Size << 25) | (Type << 28);
403 (Index << 0) | (IsPCRel << 24) | (Log2Size << 25) | (Type << 28);
409 uint32_t CPUSubtype) {
411 new AArch64MachObjectWriter(CPUType, CPUSubtype), OS,
Instances of this class represent a uniqued identifier for a section in the current translation unit...
const MCAsmInfo * getAsmInfo() const
MCSectionMachO - This represents a section on a Mach-O system (used by Mac OS X). ...
const MCSymbol & getSymbol() const
This represents an "assembler immediate".
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
LLVM_ATTRIBUTE_NORETURN void reportFatalError(SMLoc L, const Twine &Msg) const
static bool canUseLocalRelocation(const MCSectionMachO &Section, const MCSymbol &Symbol, unsigned Log2Size)
bool getSymbolOffset(const MCSymbol &S, uint64_t &Val) const
Get the offset of the given symbol, as computed in the current layout.
virtual bool isSectionAtomizableBySymbols(const MCSection &Section) const
True if the section is atomized using the symbols in it.
MCContext & getContext() const
Defines the object file and target independent interfaces used by the assembler backend to write nati...
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Encapsulates the layout of an assembly file at a particular point in time.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
const MCExpr * getVariableValue() const
getVariableValue() - Get the value for variable symbols.
Represent a reference to a symbol from inside an expression.
bool isInSection() const
isInSection - Check if this symbol is defined in some section (i.e., it is defined but not absolute)...
bool isFixupKindPCRel(const MCAssembler &Asm, unsigned Kind)
void addRelocation(const MCSymbol *RelSymbol, const MCSection *Sec, MachO::any_relocation_info &MRE)
StringRef getSectionName() const
bool isAbsolute() const
Is this an absolute (as opposed to relocatable) value.
const MCSymbol * getAtom(const MCSymbol &S) const
Find the symbol which defines the atom containing the given symbol, or null if there is no such symbo...
uint32_t getOffset() const
SectionAddrMap & getSectionAddressMap()
The instances of the Type class are immutable: once they are created, they are never changed...
bool hasAttribute(unsigned Value) const
void setUsedInReloc() const
MCFragment * getFragment() const
unsigned getOrdinal() const
MCObjectWriter * createAArch64MachObjectWriter(raw_pwrite_stream &OS, uint32_t CPUType, uint32_t CPUSubtype)
S_CSTRING_LITERALS - Section with literal C strings.
MCFixupKind getKind() const
const MCSymbolRefExpr * getSymB() const
PowerPC TLS Dynamic Call Fixup
const MCSymbolRefExpr * getSymA() const
MCSection & getSection() const
Get the section associated with a defined, non-absolute symbol.
MachO::SectionType getType() const
uint64_t getFragmentAddress(const MCFragment *Fragment, const MCAsmLayout &Layout) const
MCSection * getParent() const
unsigned Log2_32(uint32_t Value)
Log2_32 - This function returns the floor log base 2 of the specified value, -1 if the value is zero...
bool evaluateAsRelocatable(MCValue &Res, const MCAsmLayout *Layout, const MCFixup *Fixup) const
Try to evaluate the expression to a relocatable value, i.e.
Target - Wrapper for Target specific information.
MCObjectWriter * createMachObjectWriter(MCMachObjectTargetWriter *MOTW, raw_pwrite_stream &OS, bool IsLittleEndian)
Construct a new Mach-O writer instance.
bool isTemporary() const
isTemporary - Check if this is an assembler temporary symbol.
StringRef getSegmentName() const
StringRef getName() const
getName - Get the symbol name.
S_ATTR_DEBUG - A debug section.
uint64_t getFragmentOffset(const MCFragment *F) const
Get the offset of the given fragment inside its containing section.
bool isVariable() const
isVariable - Check if this is a variable symbol.
An abstract base class for streams implementations that also support a pwrite operation.
VariantKind getKind() const
int64_t getConstant() const
const ARM::ArchExtKind Kind
LLVM Value Representation.
uint64_t getSymbolAddress(const MCSymbol &S, const MCAsmLayout &Layout) const