37 uint64_t &FixedValue);
43 uint64_t &FixedValue);
47 const MCFragment &Fragment,
unsigned RelocType,
48 const MCSymbol &S, uint64_t FixedValue);
51 ARMMachObjectWriter(
bool Is64Bit, uint32_t
CPUType, uint32_t CPUSubtype)
57 uint64_t &FixedValue)
override;
138 void ARMMachObjectWriter::
145 uint64_t &FixedValue) {
156 "' can not be undefined in a subtraction expression");
161 FixedValue += SecAddr;
164 const MCSymbol *SB = &B->getSymbol();
168 "symbol '" + B->getSymbol().getName() +
169 "' can not be undefined in a subtraction expression");
191 unsigned ThumbBit = 0;
192 unsigned MovtBit = 0;
193 switch ((
unsigned)Fixup.
getKind()) {
201 FixedValue &= 0xfffffffe;
205 FixedValue &= 0xfffffffe;
214 uint32_t OtherHalf = MovtBit
215 ? (FixedValue & 0xffff) : ((FixedValue & 0xffff0000) >> 16);
218 MRE.
r_word0 = ((OtherHalf << 0) |
224 MRE.r_word1 = Value2;
229 MRE.
r_word0 = ((FixupOffset << 0) |
239 void ARMMachObjectWriter::RecordARMScatteredRelocation(
MachObjectWriter *Writer,
247 uint64_t &FixedValue) {
257 "' can not be undefined in a subtraction expression");
261 FixedValue += SecAddr;
266 const MCSymbol *SB = &B->getSymbol();
270 "symbol '" + B->getSymbol().getName() +
271 "' can not be undefined in a subtraction expression");
293 MRE.
r_word0 = ((FixupOffset << 0) |
302 bool ARMMachObjectWriter::requiresExternRelocation(
MachObjectWriter *Writer,
307 uint64_t FixedValue) {
311 int64_t Value = (int64_t)FixedValue;
335 if (Value > Range || Value < -(Range + 1))
345 uint64_t &FixedValue) {
355 "unsupported relocation on symbol");
362 return RecordARMScatteredHalfRelocation(Writer, Asm, Layout, Fragment,
363 Fixup, Target, FixedValue);
364 return RecordARMScatteredRelocation(Writer, Asm, Layout, Fragment, Fixup,
365 Target, RelocType, Log2Size,
381 Offset += 1 << Log2Size;
383 return RecordARMScatteredRelocation(Writer, Asm, Layout, Fragment, Fixup,
384 Target, RelocType, Log2Size,
391 const MCSymbol *RelSymbol =
nullptr;
396 "not yet implemented");
409 if (requiresExternRelocation(Writer, Asm, *Fragment, RelocType, *A,
435 (Index << 0) | (IsPCRel << 24) | (Log2Size << 25) | (Type << 28);
443 switch ((
unsigned)Fixup.
getKind()) {
447 Value = (FixedValue >> 16) & 0xffff;
451 Value = FixedValue & 0xffff;
456 MREPair.
r_word1 = ((0xffffff << 0) |
467 bool Is64Bit, uint32_t
CPUType,
468 uint32_t CPUSubtype) {
Instances of this class represent a uniqued identifier for a section in the current translation unit...
const MCSymbol & getSymbol() const
bool doesSymbolRequireExternRelocation(const MCSymbol &S)
This represents an "assembler immediate".
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
uint64_t getSectionAddress(const MCSection *Sec) const
LLVM_ATTRIBUTE_NORETURN void reportFatalError(SMLoc L, const Twine &Msg) const
bool getSymbolOffset(const MCSymbol &S, uint64_t &Val) const
Get the offset of the given symbol, as computed in the current layout.
MCObjectWriter * createARMMachObjectWriter(raw_pwrite_stream &OS, bool Is64Bit, uint32_t CPUType, uint32_t CPUSubtype)
Construct an ARM Mach-O object writer.
MCContext & getContext() const
Defines the object file and target independent interfaces used by the assembler backend to write nati...
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(const char *reason, bool gen_crash_diag=true)
Reports a serious error, calling any installed error handler.
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.
const MCExpr * getVariableValue() const
getVariableValue() - Get the value for variable symbols.
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)
bool isAbsolute() const
Is this an absolute (as opposed to relocatable) value.
bool isThumbFunc(const MCSymbol *Func) const
Check whether a given symbol has been flagged with .thumb_func.
uint32_t getOffset() const
SectionAddrMap & getSectionAddressMap()
The instances of the Type class are immutable: once they are created, they are never changed...
static bool getARMFixupKindMachOInfo(unsigned Kind, unsigned &RelocType, unsigned &Log2Size)
MCFragment * getFragment() const
unsigned getOrdinal() const
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.
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...
Target - Wrapper for Target specific information.
MCObjectWriter * createMachObjectWriter(MCMachObjectTargetWriter *MOTW, raw_pwrite_stream &OS, bool IsLittleEndian)
Construct a new Mach-O writer instance.
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.
An abstract base class for streams implementations that also support a pwrite operation.
int64_t getConstant() const
const ARM::ArchExtKind Kind
LLVM Value Representation.
bool isUndefined() const
isUndefined - Check if this symbol undefined (i.e., implicitly defined).
uint64_t getSymbolAddress(const MCSymbol &S, const MCAsmLayout &Layout) const