28 bool getAArch64FixupKindMachOInfo(
const MCFixup &Fixup,
unsigned &RelocType,
39 uint64_t &FixedValue)
override;
43 bool AArch64MachObjectWriter::getAArch64FixupKindMachOInfo(
49 switch ((
unsigned)Fixup.
getKind()) {
95 "ADR/ADRP relocations must be GOT relative");
144 void AArch64MachObjectWriter::recordRelocation(
147 uint64_t &FixedValue) {
152 unsigned Log2Size = 0;
157 const MCSymbol *RelSymbol =
nullptr;
163 FixedValue += FixupOffset;
176 "conditional branch requires assembler-local"
187 "Invalid relocation on conditional branch!");
191 if (!getAArch64FixupKindMachOInfo(Fixup, Type, Target.
getSymA(), Log2Size,
206 "PC relative absolute relocation!");
231 MRE.
r_word1 = (IsPCRel << 24) | (Log2Size << 25) | (Type << 28);
238 "unsupported relocation of modified symbol");
245 "unsupported pc-relative relocation of "
259 "unsupported relocation of local symbol '" + A->
getName() +
260 "'. Must have non-local symbol earlier in section.");
266 "unsupported relocation of local symbol '" + B->
getName() +
267 "'. Must have non-local symbol earlier in section.");
271 if (A_Base == B_Base && A_Base) {
273 Fixup.
getLoc(),
"unsupported relocation with identical base");
288 MRE.
r_word1 = (IsPCRel << 24) | (Log2Size << 25) | (Type << 28);
298 bool CanUseLocalRelocation =
300 if (Symbol->
isTemporary() && (Value || !CanUseLocalRelocation)) {
327 "unable to resolve variable '" +
331 return recordRelocation(Writer, Asm, Layout, Fragment, Fixup, Target,
355 if (!CanUseLocalRelocation) {
358 "unsupported relocation of local symbol '" + Symbol->
getName() +
359 "'. Must have non-local symbol earlier in section.");
382 "unsupported relocation of variable '" +
395 assert((Value & 0xff000000) == 0 &&
"Added relocation out of range!");
400 (Index << 0) | (IsPCRel << 24) | (Log2Size << 25) | (Type << 28);
421 (Index << 0) | (IsPCRel << 24) | (Log2Size << 25) | (Type << 28);
429 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
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 ...
S_ATTR_DEBUG - A debug section.
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.
Represent a reference to a symbol from inside an expression.
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.
static GCRegistry::Add< OcamlGC > B("ocaml","ocaml 3.10-compatible GC")
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
void reportError(SMLoc L, const Twine &Msg)
unsigned getOrdinal() const
MCObjectWriter * createAArch64MachObjectWriter(raw_pwrite_stream &OS, uint32_t CPUType, uint32_t CPUSubtype)
bool isInSection(bool SetUsed=true) const
isInSection - Check if this symbol is defined in some section (i.e., it is defined but not absolute)...
S_CSTRING_LITERALS - Section with literal C strings.
MCFixupKind getKind() const
const MCSymbolRefExpr * getSymB() const
const MCSymbolRefExpr * getSymA() const
CPUType
These values correspond to the CV_CPU_TYPE_e enumeration, and are documented here: https://msdn...
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.
const MCExpr * getVariableValue(bool SetUsed=true) const
getVariableValue - Get the value for variable symbols.
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
MCSection & getSection(bool SetUsed=true) const
Get the section associated with a defined, non-absolute symbol.
StringRef getName() const
getName - Get the symbol name.
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.
MCFragment * getFragment(bool SetUsed=true) const
An abstract base class for streams implementations that also support a pwrite operation.
VariantKind getKind() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
int64_t getConstant() const
LLVM Value Representation.
uint64_t getSymbolAddress(const MCSymbol &S, const MCAsmLayout &Layout) const
static GCRegistry::Add< ErlangGC > A("erlang","erlang-compatible garbage collector")