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) {
140 Asm.getContext().reportError(
Fixup.getLoc(),
141 "can not encode offset '0x" +
142 utohexstr(FixupOffset) +
143 "' in resulting scattered relocation.");
153 if (!
A->getFragment()) {
154 Asm.getContext().reportError(
Fixup.getLoc(),
155 "symbol '" +
A->getName() +
156 "' can not be undefined in a subtraction expression");
163 FixedValue += SecAddr;
169 Asm.getContext().reportError(
Fixup.getLoc(),
170 "symbol '" +
B->getSymbol().getName() +
171 "' can not be undefined in a subtraction expression");
195 unsigned ThumbBit = 0;
196 unsigned MovtBit = 0;
197 switch (
Fixup.getTargetKind()) {
204 if (
Asm.isThumbFunc(
A))
205 FixedValue &= 0xfffffffe;
208 if (
Asm.isThumbFunc(
A))
209 FixedValue &= 0xfffffffe;
219 ? (FixedValue & 0xffff) : ((FixedValue & 0xffff0000) >> 16);
222 MRE.
r_word0 = ((OtherHalf << 0) |
228 MRE.r_word1 = Value2;
233 MRE.
r_word0 = ((FixupOffset << 0) |
243void ARMMachObjectWriter::recordARMScatteredRelocation(
246 unsigned Type,
unsigned Log2Size,
uint64_t &FixedValue) {
247 uint32_t FixupOffset =
Asm.getFragmentOffset(*Fragment) +
Fixup.getOffset();
249 if (FixupOffset & 0xff000000) {
250 Asm.getContext().reportError(
Fixup.getLoc(),
251 "can not encode offset '0x" +
252 utohexstr(FixupOffset) +
253 "' in resulting scattered relocation.");
262 if (!
A->getFragment()) {
263 Asm.getContext().reportError(
Fixup.getLoc(),
264 "symbol '" +
A->getName() +
265 "' can not be undefined in a subtraction expression");
271 FixedValue += SecAddr;
279 Asm.getContext().reportError(
Fixup.getLoc(),
280 "symbol '" +
B->getSymbol().getName() +
281 "' can not be undefined in a subtraction expression");
305 MRE.
r_word0 = ((FixupOffset << 0) |
323 int64_t
Value = (int64_t)FixedValue;
373 Asm.getContext().reportError(
Fixup.getLoc(),
"unsupported relocation type");
382 return recordARMScatteredHalfRelocation(Writer, Asm, Fragment,
Fixup,
384 return recordARMScatteredRelocation(Writer, Asm, Fragment,
Fixup,
Target,
385 RelocType, Log2Size, FixedValue);
391 A = &
Target.getSymA()->getSymbol();
403 return recordARMScatteredRelocation(Writer, Asm, Fragment,
Fixup,
Target,
404 RelocType, Log2Size, FixedValue);
407 uint32_t FixupOffset =
Asm.getFragmentOffset(*Fragment) +
Fixup.getOffset();
410 const MCSymbol *RelSymbol =
nullptr;
417 "not yet implemented");
420 if (
A->isVariable()) {
422 if (
A->getVariableValue()->evaluateAsAbsolute(
430 if (requiresExternRelocation(Writer, Asm, *Fragment, RelocType, *
A,
437 if (!
A->isUndefined())
438 FixedValue -=
Asm.getSymbolOffset(*
A);
456 (
Index << 0) | (IsPCRel << 24) | (Log2Size << 25) | (
Type << 28);
466 switch (
Fixup.getTargetKind()) {
470 Value = (FixedValue >> 16) & 0xffff;
474 Value = FixedValue & 0xffff;
479 MREPair.
r_word1 = ((0xffffff << 0) |
489std::unique_ptr<MCObjectTargetWriter>
492 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.