31 unsigned Type,
unsigned Log2Size,
41 const MCFragment &Fragment,
unsigned RelocType,
131void ARMMachObjectWriter::recordARMScatteredHalfRelocation(
135 uint32_t FixupOffset =
Asm.getFragmentOffset(*Fragment) +
Fixup.getOffset();
137 if (FixupOffset & 0xff000000) {
138 Asm.getContext().reportError(
Fixup.getLoc(),
139 "can not encode offset '0x" +
140 utohexstr(FixupOffset) +
141 "' in resulting scattered relocation.");
151 if (!
A->getFragment()) {
152 Asm.getContext().reportError(
Fixup.getLoc(),
153 "symbol '" +
A->getName() +
154 "' can not be undefined in a subtraction expression");
161 FixedValue += SecAddr;
167 Asm.getContext().reportError(
Fixup.getLoc(),
168 "symbol '" +
B->getSymbol().getName() +
169 "' can not be undefined in a subtraction expression");
193 unsigned ThumbBit = 0;
194 unsigned MovtBit = 0;
195 switch (
Fixup.getTargetKind()) {
202 if (
Asm.isThumbFunc(
A))
203 FixedValue &= 0xfffffffe;
206 if (
Asm.isThumbFunc(
A))
207 FixedValue &= 0xfffffffe;
217 ? (FixedValue & 0xffff) : ((FixedValue & 0xffff0000) >> 16);
220 MRE.
r_word0 = ((OtherHalf << 0) |
226 MRE.r_word1 = Value2;
231 MRE.
r_word0 = ((FixupOffset << 0) |
241void ARMMachObjectWriter::recordARMScatteredRelocation(
244 unsigned Type,
unsigned Log2Size,
uint64_t &FixedValue) {
245 uint32_t FixupOffset =
Asm.getFragmentOffset(*Fragment) +
Fixup.getOffset();
247 if (FixupOffset & 0xff000000) {
248 Asm.getContext().reportError(
Fixup.getLoc(),
249 "can not encode offset '0x" +
250 utohexstr(FixupOffset) +
251 "' in resulting scattered relocation.");
260 if (!
A->getFragment()) {
261 Asm.getContext().reportError(
Fixup.getLoc(),
262 "symbol '" +
A->getName() +
263 "' can not be undefined in a subtraction expression");
269 FixedValue += SecAddr;
277 Asm.getContext().reportError(
Fixup.getLoc(),
278 "symbol '" +
B->getSymbol().getName() +
279 "' can not be undefined in a subtraction expression");
303 MRE.
r_word0 = ((FixupOffset << 0) |
321 int64_t
Value = (int64_t)FixedValue;
371 Asm.getContext().reportError(
Fixup.getLoc(),
"unsupported relocation type");
380 return recordARMScatteredHalfRelocation(Writer, Asm, Fragment,
Fixup,
382 return recordARMScatteredRelocation(Writer, Asm, Fragment,
Fixup,
Target,
383 RelocType, Log2Size, FixedValue);
389 A = &
Target.getSymA()->getSymbol();
401 return recordARMScatteredRelocation(Writer, Asm, Fragment,
Fixup,
Target,
402 RelocType, Log2Size, FixedValue);
405 uint32_t FixupOffset =
Asm.getFragmentOffset(*Fragment) +
Fixup.getOffset();
408 const MCSymbol *RelSymbol =
nullptr;
415 "not yet implemented");
418 if (
A->isVariable()) {
420 if (
A->getVariableValue()->evaluateAsAbsolute(
428 if (requiresExternRelocation(Writer, Asm, *Fragment, RelocType, *
A,
435 if (!
A->isUndefined())
436 FixedValue -=
Asm.getSymbolOffset(*
A);
454 (
Index << 0) | (IsPCRel << 24) | (Log2Size << 25) | (
Type << 28);
464 switch (
Fixup.getTargetKind()) {
468 Value = (FixedValue >> 16) & 0xffff;
472 Value = FixedValue & 0xffff;
477 MREPair.
r_word1 = ((0xffffff << 0) |
487std::unique_ptr<MCObjectTargetWriter>
490 return std::make_unique<ARMMachObjectWriter>(Is64Bit, CPUType, CPUSubtype);
static bool getARMFixupKindMachOInfo(unsigned Kind, unsigned &RelocType, unsigned &Log2Size)
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
ConstantRange Range(APInt(BitWidth, Low), APInt(BitWidth, High))
PowerPC TLS Dynamic Call Fixup
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
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
Instances of this class represent a uniqued identifier for a section in the current translation unit.
unsigned getOrdinal() const
Represent a reference to a symbol from inside an expression.
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.
MCFragment * getFragment(bool SetUsed=true) const
This represents an "assembler immediate".
bool doesSymbolRequireExternRelocation(const MCSymbol &S)
SectionAddrMap & getSectionAddressMap()
uint64_t getSectionAddress(const MCSection *Sec) const
void addRelocation(const MCSymbol *RelSymbol, const MCSection *Sec, MachO::any_relocation_info &MRE)
bool isFixupKindPCRel(const MCAssembler &Asm, unsigned Kind)
uint64_t getSymbolAddress(const MCSymbol &S, const MCAssembler &Asm) 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.
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.
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
@ 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.