48 const MCFragment &Fragment,
unsigned RelocType,
139 void 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) |
253 void 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) |
329 bool ARMMachObjectWriter::requiresExternRelocation(
MachObjectWriter *Writer,
338 int64_t
Value = (int64_t)FixedValue;
349 if (!
S.isTemporary())
389 Asm.getContext().reportError(
Fixup.getLoc(),
390 "unsupported relocation on symbol");
399 return RecordARMScatteredHalfRelocation(Writer,
Asm, Layout, Fragment,
400 Fixup,
Target, FixedValue);
401 return RecordARMScatteredRelocation(Writer,
Asm, Layout, Fragment, Fixup,
402 Target, RelocType, Log2Size,
409 A = &
Target.getSymA()->getSymbol();
421 return RecordARMScatteredRelocation(Writer,
Asm, Layout, Fragment, Fixup,
422 Target, RelocType, Log2Size,
429 const MCSymbol *RelSymbol =
nullptr;
431 if (
Target.isAbsolute()) {
434 "not yet implemented");
437 if (
A->isVariable()) {
439 if (
A->getVariableValue()->evaluateAsAbsolute(
447 if (requiresExternRelocation(Writer,
Asm, *Fragment, RelocType, *A,
454 if (!
A->isUndefined())
473 (
Index << 0) | (IsPCRel << 24) | (Log2Size << 25) | (
Type << 28);
483 switch (
Fixup.getTargetKind()) {
487 Value = (FixedValue >> 16) & 0xffff;
491 Value = FixedValue & 0xffff;
496 MREPair.
r_word1 = ((0xffffff << 0) |
506 std::unique_ptr<MCObjectTargetWriter>
509 return std::make_unique<ARMMachObjectWriter>(Is64Bit,
CPUType, CPUSubtype);