Lines Matching +full:fixed +full:- +full:layout

1 //===-- AArch64MachObjectWriter.cpp - ARM Mach Object Writer --------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
68 if (Sym->getKind() == MCSymbolRefExpr::VK_GOT)
73 if (Sym->getKind() == MCSymbolRefExpr::VK_GOT)
83 switch (Sym->getKind()) {
98 // This encompasses the relocation for the whole 21-bit value.
99 switch (Sym->getKind()) {
151 unsigned IsPCRel = Writer->isFixupKindPCRel(Asm, Fixup.getKind());
179 "conditional branch requires assembler-local"
181 Target.getSymA()->getSymbol().getName() +
186 // 14-bit branch relocations should only target internal labels, and so
215 } else if (Target.getSymB()) { // A - B + constant
216 const MCSymbol *A = &Target.getSymA()->getSymbol();
217 const MCSymbol *A_Base = Writer->getAtom(*A);
219 const MCSymbol *B = &Target.getSymB()->getSymbol();
220 const MCSymbol *B_Base = Writer->getAtom(*B);
222 // Check for "_foo@got - .", which comes through here as:
224 // ... _foo@got - Ltmp0
225 if (Target.getSymA()->getKind() == MCSymbolRefExpr::VK_GOT &&
226 Target.getSymB()->getKind() == MCSymbolRefExpr::VK_None &&
229 // SymB is the PC, so use a PC-rel pointer-to-GOT relocation.
235 Writer->addRelocation(A_Base, Fragment->getParent(), MRE);
237 } else if (Target.getSymA()->getKind() != MCSymbolRefExpr::VK_None ||
238 Target.getSymB()->getKind() != MCSymbolRefExpr::VK_None) {
248 "unsupported pc-relative relocation of "
254 // a base address (a local symbol with no preceding non-local symbol),
262 "unsupported relocation of local symbol '" + A->getName() +
263 "'. Must have non-local symbol earlier in section.");
269 "unsupported relocation of local symbol '" + B->getName() +
270 "'. Must have non-local symbol earlier in section.");
280 Value += (!A->getFragment() ? 0 : Writer->getSymbolAddress(*A, Asm)) -
281 (!A_Base || !A_Base->getFragment()
283 : Writer->getSymbolAddress(*A_Base, Asm));
284 Value -= (!B->getFragment() ? 0 : Writer->getSymbolAddress(*B, Asm)) -
285 (!B_Base || !B_Base->getFragment()
287 : Writer->getSymbolAddress(*B_Base, Asm));
294 Writer->addRelocation(A_Base, Fragment->getParent(), MRE);
299 const MCSymbol *Symbol = &Target.getSymA()->getSymbol();
301 static_cast<const MCSectionMachO &>(*Fragment->getParent());
305 if (Symbol->isTemporary() && (Value || !CanUseLocalRelocation)) {
308 if (!Symbol->isInSection()) {
311 "unsupported relocation of local symbol '" + Symbol->getName() +
312 "'. Must have non-local symbol earlier in section.");
315 const MCSection &Sec = Symbol->getSection();
317 Symbol->setUsedInReloc();
320 const MCSymbol *Base = Writer->getAtom(*Symbol);
324 assert(!Symbol->isVariable() || Base);
329 // have already been fixed up.
330 if (Symbol->isInSection()) {
336 // sections, and for pointer-sized relocations (.quad), we allow section
343 Value += Asm.getSymbolOffset(*Symbol) - Asm.getSymbolOffset(*Base);
344 } else if (Symbol->isInSection()) {
348 "unsupported relocation of local symbol '" + Symbol->getName() +
349 "'. Must have non-local symbol earlier in section.");
352 // Adjust the relocation to be section-relative.
353 // The index is the section ordinal (1-based).
354 const MCSection &Sec = Symbol->getSection();
356 Value += Writer->getSymbolAddress(*Symbol, Asm);
359 Value -= Writer->getFragmentAddress(Asm, Fragment) + Fixup.getOffset() +
384 Writer->addRelocation(RelSymbol, Fragment->getParent(), MRE);
405 Writer->addRelocation(RelSymbol, Fragment->getParent(), MRE);