33 unsigned Type,
unsigned Log2Size,
43 const MCFragment &Fragment,
unsigned RelocType,
133void ARMMachObjectWriter::recordARMScatteredHalfRelocation(
137 uint32_t FixupOffset =
Asm.getFragmentOffset(*Fragment) +
Fixup.getOffset();
139 if (FixupOffset & 0xff000000) {
141 utohexstr(FixupOffset) +
142 "' in resulting scattered relocation.");
146 unsigned IsPCRel =
Fixup.isPCRel();
152 if (!
A->getFragment()) {
154 "symbol '" +
A->getName() +
155 "' can not be undefined in a subtraction expression");
162 FixedValue += SecAddr;
165 if (!SB->getFragment()) {
167 "symbol '" + SB->getName() +
168 "' can not be undefined in a subtraction expression");
192 unsigned ThumbBit = 0;
193 unsigned MovtBit = 0;
194 switch (
Fixup.getKind()) {
201 if (
Asm.isThumbFunc(
A))
202 FixedValue &= 0xfffffffe;
205 if (
Asm.isThumbFunc(
A))
206 FixedValue &= 0xfffffffe;
216 ? (FixedValue & 0xffff) : ((FixedValue & 0xffff0000) >> 16);
219 MRE.
r_word0 = ((OtherHalf << 0) |
225 MRE.r_word1 = Value2;
230 MRE.
r_word0 = ((FixupOffset << 0) |
240void ARMMachObjectWriter::recordARMScatteredRelocation(
243 unsigned Type,
unsigned Log2Size,
uint64_t &FixedValue) {
244 uint32_t FixupOffset =
Asm.getFragmentOffset(*Fragment) +
Fixup.getOffset();
246 if (FixupOffset & 0xff000000) {
248 utohexstr(FixupOffset) +
249 "' in resulting scattered relocation.");
253 unsigned IsPCRel =
Fixup.isPCRel();
258 if (!
A->getFragment()) {
260 "symbol '" +
A->getName() +
261 "' can not be undefined in a subtraction expression");
267 FixedValue += SecAddr;
273 if (!SB->getFragment()) {
275 "symbol '" + SB->getName() +
276 "' can not be undefined in a subtraction expression");
300 MRE.
r_word0 = ((FixupOffset << 0) |
318 int64_t
Value = (int64_t)FixedValue;
360 unsigned IsPCRel =
Fixup.isPCRel();
377 return recordARMScatteredHalfRelocation(Writer, Asm, Fragment,
Fixup,
379 return recordARMScatteredRelocation(Writer, Asm, Fragment,
Fixup,
Target,
380 RelocType, Log2Size, FixedValue);
396 return recordARMScatteredRelocation(Writer, Asm, Fragment,
Fixup,
Target,
397 RelocType, Log2Size, FixedValue);
400 uint32_t FixupOffset =
Asm.getFragmentOffset(*Fragment) +
Fixup.getOffset();
403 const MCSymbol *RelSymbol =
nullptr;
410 "not yet implemented");
413 if (
A->isVariable()) {
416 A->getVariableValue()->evaluateAsRelocatable(Val, &Asm);
431 if (requiresExternRelocation(Writer, Asm, *Fragment, RelocType, *
A,
438 if (!
A->isUndefined())
439 FixedValue -=
Asm.getSymbolOffset(*
A);
457 (
Index << 0) | (IsPCRel << 24) | (Log2Size << 25) | (
Type << 28);
467 switch (
Fixup.getKind()) {
471 Value = (FixedValue >> 16) & 0xffff;
475 Value = FixedValue & 0xffff;
480 MREPair.
r_word1 = ((0xffffff << 0) |
490std::unique_ptr<MCObjectTargetWriter>
493 return std::make_unique<ARMMachObjectWriter>(Is64Bit, CPUType, CPUSubtype);
506 getStreamer().getAssembler().setIsThumbFunc(Symbol);
513 return new ARMTargetMachOStreamer(S);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static bool getARMFixupKindMachOInfo(unsigned Kind, unsigned &RelocType, unsigned &Log2Size)
static Error reportError(StringRef Message)
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
ConstantRange Range(APInt(BitWidth, Low), APInt(BitWidth, High))
PowerPC TLS Dynamic Call Fixup
virtual void emitThumbFunc(MCSymbol *Symbol)
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
MCSection * getParent() const
virtual void recordRelocation(MachObjectWriter *Writer, MCAssembler &Asm, const MCFragment *Fragment, const MCFixup &Fixup, MCValue Target, uint64_t &FixedValue)=0
Streaming object file generation interface.
Instances of this class represent a uniqued identifier for a section in the current translation unit.
unsigned getOrdinal() const
Streaming machine code generation interface.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
MCSection & getSection() const
Get the section associated with a defined, non-absolute symbol.
bool isTemporary() const
isTemporary - Check if this is an assembler temporary symbol.
Target specific streamer interface.
MCStreamer & getStreamer()
const MCSymbol * getAddSym() const
int64_t getConstant() const
const MCSymbol * getSubSym() const
bool isAbsolute() const
Is this an absolute (as opposed to relocatable) value.
bool doesSymbolRequireExternRelocation(const MCSymbol &S)
uint64_t getSectionAddress(const MCSection *Sec) const
void addRelocation(const MCSymbol *RelSymbol, const MCSection *Sec, MachO::any_relocation_info &MRE)
uint64_t getSymbolAddress(const MCSymbol &S) const
Target - Wrapper for Target specific information.
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM Value Representation.
@ fixup_arm_ldst_pcrel_12
@ ARM_RELOC_LOCAL_SECTDIFF
@ ARM_RELOC_HALF_SECTDIFF
This is an optimization pass for GlobalISel generic memory operations.
@ FK_Data_8
A eight-byte fixup.
@ FK_Data_1
A one-byte fixup.
@ FK_Data_4
A four-byte fixup.
@ FK_Data_2
A two-byte fixup.
MCTargetStreamer * createARMObjectTargetMachOStreamer(MCStreamer &S)
std::unique_ptr< MCObjectTargetWriter > createARMMachObjectWriter(bool Is64Bit, uint32_t CPUType, uint32_t CPUSubtype)
Construct an ARM Mach-O object writer.
unsigned Log2_32(uint32_t Value)
Return the floor log base 2 of the specified value, -1 if the value is zero.
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)