48 const MCFragment &Fragment,
unsigned RelocType,
139void ARMMachObjectWriter::
149 if (FixupOffset & 0xff000000) {
150 Asm.getContext().reportError(
Fixup.getLoc(),
151 "can not encode offset '0x" +
152 utohexstr(FixupOffset) +
153 "' in resulting scattered relocation.");
163 if (!
A->getFragment()) {
164 Asm.getContext().reportError(
Fixup.getLoc(),
165 "symbol '" +
A->getName() +
166 "' can not be undefined in a subtraction expression");
173 FixedValue += SecAddr;
179 Asm.getContext().reportError(
Fixup.getLoc(),
180 "symbol '" +
B->getSymbol().getName() +
181 "' can not be undefined in a subtraction expression");
205 unsigned ThumbBit = 0;
206 unsigned MovtBit = 0;
207 switch (
Fixup.getTargetKind()) {
214 if (
Asm.isThumbFunc(
A))
215 FixedValue &= 0xfffffffe;
218 if (
Asm.isThumbFunc(
A))
219 FixedValue &= 0xfffffffe;
229 ? (FixedValue & 0xffff) : ((FixedValue & 0xffff0000) >> 16);
232 MRE.
r_word0 = ((OtherHalf << 0) |
238 MRE.r_word1 = Value2;
243 MRE.
r_word0 = ((FixupOffset << 0) |
253void ARMMachObjectWriter::RecordARMScatteredRelocation(
MachObjectWriter *Writer,
264 if (FixupOffset & 0xff000000) {
265 Asm.getContext().reportError(
Fixup.getLoc(),
266 "can not encode offset '0x" +
267 utohexstr(FixupOffset) +
268 "' in resulting scattered relocation.");
277 if (!
A->getFragment()) {
278 Asm.getContext().reportError(
Fixup.getLoc(),
279 "symbol '" +
A->getName() +
280 "' can not be undefined in a subtraction expression");
286 FixedValue += SecAddr;
294 Asm.getContext().reportError(
Fixup.getLoc(),
295 "symbol '" +
B->getSymbol().getName() +
296 "' can not be undefined in a subtraction expression");
320 MRE.
r_word0 = ((FixupOffset << 0) |
338 int64_t
Value = (int64_t)FixedValue;
389 Asm.getContext().reportError(
Fixup.getLoc(),
"unsupported relocation type");
398 return RecordARMScatteredHalfRelocation(Writer, Asm, Layout, Fragment,
400 return RecordARMScatteredRelocation(Writer, Asm, Layout, Fragment,
Fixup,
401 Target, RelocType, Log2Size,
408 A = &
Target.getSymA()->getSymbol();
420 return RecordARMScatteredRelocation(Writer, Asm, Layout, Fragment,
Fixup,
421 Target, RelocType, Log2Size,
428 const MCSymbol *RelSymbol =
nullptr;
435 "not yet implemented");
438 if (
A->isVariable()) {
440 if (
A->getVariableValue()->evaluateAsAbsolute(
448 if (requiresExternRelocation(Writer, Asm, *Fragment, RelocType, *
A,
455 if (!
A->isUndefined())
474 (
Index << 0) | (IsPCRel << 24) | (Log2Size << 25) | (
Type << 28);
484 switch (
Fixup.getTargetKind()) {
488 Value = (FixedValue >> 16) & 0xffff;
492 Value = FixedValue & 0xffff;
497 MREPair.
r_word1 = ((0xffffff << 0) |
507std::unique_ptr<MCObjectTargetWriter>
510 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")
PowerPC TLS Dynamic Call Fixup
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Encapsulates the layout of an assembly file at a particular point in time.
bool getSymbolOffset(const MCSymbol &S, uint64_t &Val) const
Get the offset of the given symbol, as computed in the current layout.
uint64_t getFragmentOffset(const MCFragment *F) const
Get the offset of the given fragment inside its containing section.
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 MCAsmLayout &Layout, 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)
uint64_t getSymbolAddress(const MCSymbol &S, const MCAsmLayout &Layout) const
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)
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.