Lines Matching refs:loc

175                      const uint8_t *loc) const override;
183 void relocate(uint8_t *loc, const Relocation &rel,
193 const uint8_t *loc) const override;
194 void relaxGot(uint8_t *loc, const Relocation &rel, uint64_t val) const;
197 bool adjustPrologueForCrossSplitStack(uint8_t *loc, uint8_t *end,
201 void relaxTlsGdToIe(uint8_t *loc, const Relocation &rel, uint64_t val) const;
202 void relaxTlsGdToLe(uint8_t *loc, const Relocation &rel, uint64_t val) const;
203 void relaxTlsLdToLe(uint8_t *loc, const Relocation &rel, uint64_t val) const;
204 void relaxTlsIeToLe(uint8_t *loc, const Relocation &rel, uint64_t val) const;
247 void elf::writePrefixedInstruction(uint8_t *loc, uint64_t insn) { in writePrefixedInstruction() argument
249 write64(loc, insn); in writePrefixedInstruction()
568 static void writeFromHalf16(uint8_t *loc, uint32_t insn) { in writeFromHalf16() argument
569 write32(config->isLE ? loc : loc - 2, insn); in writeFromHalf16()
572 static uint32_t readFromHalf16(const uint8_t *loc) { in readFromHalf16() argument
573 return read32(config->isLE ? loc : loc - 2); in readFromHalf16()
576 static uint64_t readPrefixedInstruction(const uint8_t *loc) { in readPrefixedInstruction() argument
577 uint64_t fullInstr = read64(loc); in readPrefixedInstruction()
652 void PPC64::relaxGot(uint8_t *loc, const Relocation &rel, uint64_t val) const { in relaxGot() argument
656 relocate(loc, rel, val); in relaxGot()
661 uint32_t insn = readFromHalf16(loc); in relaxGot()
664 writeFromHalf16(loc, (insn & 0x03ffffff) | 0x38000000); in relaxGot()
665 relocateNoSym(loc, R_PPC64_TOC16_LO, val); in relaxGot()
671 uint64_t insn = readPrefixedInstruction(loc); in relaxGot()
678 writePrefixedInstruction(loc, insn); in relaxGot()
679 relocate(loc, rel, val); in relaxGot()
686 uint64_t insn = readPrefixedInstruction(loc); in relaxGot()
687 uint32_t accessInsn = read32(loc + rel.addend); in relaxGot()
705 writePrefixedInstruction(loc, pcRelInsn | in relaxGot()
708 write32(loc + rel.addend, NOP); // nop accessInsn. in relaxGot()
716 void PPC64::relaxTlsGdToLe(uint8_t *loc, const Relocation &rel, in relaxTlsGdToLe() argument
735 writeFromHalf16(loc, NOP); in relaxTlsGdToLe()
739 writeFromHalf16(loc, 0x3c6d0000); // addis r3, r13 in relaxTlsGdToLe()
740 relocateNoSym(loc, R_PPC64_TPREL16_HA, val); in relaxTlsGdToLe()
745 writePrefixedInstruction(loc, 0x06000000386d0000); in relaxTlsGdToLe()
746 relocateNoSym(loc, R_PPC64_TPREL34, val); in relaxTlsGdToLe()
758 const uintptr_t locAsInt = reinterpret_cast<uintptr_t>(loc); in relaxTlsGdToLe()
760 write32(loc, NOP); // nop in relaxTlsGdToLe()
761 write32(loc + 4, 0x38630000); // addi r3, r3 in relaxTlsGdToLe()
765 relocateNoSym(loc + 4 + (config->ekind == ELF64BEKind ? 2 : 0), in relaxTlsGdToLe()
768 write32(loc - 1, NOP); in relaxTlsGdToLe()
779 void PPC64::relaxTlsLdToLe(uint8_t *loc, const Relocation &rel, in relaxTlsLdToLe() argument
798 writeFromHalf16(loc, NOP); in relaxTlsLdToLe()
801 writeFromHalf16(loc, 0x3c6d0000); // addis r3, r13, 0 in relaxTlsLdToLe()
806 writePrefixedInstruction(loc, 0x06000000386d1000); in relaxTlsLdToLe()
819 const uintptr_t locAsInt = reinterpret_cast<uintptr_t>(loc); in relaxTlsLdToLe()
821 write32(loc, NOP); in relaxTlsLdToLe()
822 write32(loc + 4, 0x38631000); // addi r3, r3, 4096 in relaxTlsLdToLe()
824 write32(loc - 1, NOP); in relaxTlsLdToLe()
837 relocate(loc, rel, val); in relaxTlsLdToLe()
891 void PPC64::relaxTlsIeToLe(uint8_t *loc, const Relocation &rel, in relaxTlsIeToLe() argument
915 write32(loc - offset, NOP); in relaxTlsIeToLe()
919 uint32_t regNo = read32(loc - offset) & 0x03E00000; // bits 6-10 in relaxTlsIeToLe()
920 write32(loc - offset, 0x3C0D0000 | regNo); // addis RegNo, r13 in relaxTlsIeToLe()
921 relocateNoSym(loc, R_PPC64_TPREL16_HA, val); in relaxTlsIeToLe()
925 const uint64_t pldRT = readPrefixedInstruction(loc) & 0x0000000003e00000; in relaxTlsIeToLe()
927 writePrefixedInstruction(loc, 0x06000000380d0000 | pldRT); in relaxTlsIeToLe()
928 relocateNoSym(loc, R_PPC64_TPREL34, val); in relaxTlsIeToLe()
932 const uintptr_t locAsInt = reinterpret_cast<uintptr_t>(loc); in relaxTlsIeToLe()
934 uint32_t primaryOp = getPrimaryOpCode(read32(loc)); in relaxTlsIeToLe()
937 uint32_t secondaryOp = (read32(loc) & 0x000007FE) >> 1; // bits 21-30 in relaxTlsIeToLe()
947 write32(loc, dFormOp | (read32(loc) & 0x03ff0000)); in relaxTlsIeToLe()
948 relocateNoSym(loc + offset, finalReloc, val); in relaxTlsIeToLe()
953 uint32_t tlsInstr = read32(loc - 1); in relaxTlsIeToLe()
966 write32(loc - 1, NOP); in relaxTlsIeToLe()
969 write32(loc - 1, 0x7C000378 | (rt << 16) | (ra << 21) | (ra << 11)); in relaxTlsIeToLe()
978 write32(loc - 1, (dFormOp | (tlsInstr & 0x03ff0000))); in relaxTlsIeToLe()
993 const uint8_t *loc) const { in getRelExpr()
1100 error(getErrorLocation(loc) + "unknown relocation (" + Twine(type) + in getRelExpr()
1259 void PPC64::relocate(uint8_t *loc, const Relocation &rel, uint64_t val) const { in relocate() argument
1268 checkAlignment(loc, val, 4, rel); in relocate()
1270 uint8_t aalk = loc[3]; in relocate()
1271 write16(loc + 2, (aalk & 3) | (val & 0xfffc)); in relocate()
1275 checkIntUInt(loc, val, 16, rel); in relocate()
1276 write16(loc, val); in relocate()
1279 checkIntUInt(loc, val, 32, rel); in relocate()
1280 write32(loc, val); in relocate()
1284 checkInt(loc, val, 16, rel); in relocate()
1287 uint16_t mask = isDQFormInstruction(readFromHalf16(loc)) ? 0xf : 0x3; in relocate()
1288 checkAlignment(loc, lo(val), mask + 1, rel); in relocate()
1289 write16(loc, (read16(loc) & mask) | lo(val)); in relocate()
1295 writeFromHalf16(loc, NOP); in relocate()
1297 checkInt(loc, val + 0x8000, 32, rel); in relocate()
1298 write16(loc, ha(val)); in relocate()
1304 checkInt(loc, val, 32, rel); in relocate()
1305 write16(loc, hi(val)); in relocate()
1308 write16(loc, hi(val)); in relocate()
1312 write16(loc, higher(val)); in relocate()
1316 write16(loc, highera(val)); in relocate()
1320 write16(loc, highest(val)); in relocate()
1324 write16(loc, highesta(val)); in relocate()
1333 uint32_t insn = readFromHalf16(loc); in relocate()
1335 error(getErrorLocation(loc) + in relocate()
1338 writeFromHalf16(loc, (insn & 0xffe00000) | 0x00020000 | lo(val)); in relocate()
1340 write16(loc, lo(val)); in relocate()
1347 uint32_t insn = readFromHalf16(loc); in relocate()
1349 checkAlignment(loc, lo(val), mask + 1, rel); in relocate()
1355 error(getErrorLocation(loc) + in relocate()
1359 writeFromHalf16(loc, insn | 0x00020000 | lo(val)); in relocate()
1361 write16(loc, (read16(loc) & mask) | lo(val)); in relocate()
1365 checkInt(loc, val, 16, rel); in relocate()
1366 write16(loc, val); in relocate()
1369 checkInt(loc, val, 32, rel); in relocate()
1370 write32(loc, val); in relocate()
1375 write64(loc, val); in relocate()
1379 checkInt(loc, val, 16, rel); in relocate()
1380 checkAlignment(loc, val, 4, rel); in relocate()
1381 write32(loc, (read32(loc) & ~mask) | (val & mask)); in relocate()
1387 checkInt(loc, val, 26, rel); in relocate()
1388 checkAlignment(loc, val, 4, rel); in relocate()
1389 write32(loc, (read32(loc) & ~mask) | (val & mask)); in relocate()
1393 write64(loc, val - dynamicThreadPointerOffset); in relocate()
1410 checkInt(loc, val, 34, rel); in relocate()
1412 uint64_t instr = readPrefixedInstruction(loc) & ~fullMask; in relocate()
1413 writePrefixedInstruction(loc, instr | ((val & si0Mask) << 16) | in relocate()
1484 const uint8_t *loc) const { in adjustGotPcExpr()
1489 if ((readPrefixedInstruction(loc) & 0xfc000000) == 0xe4000000) in adjustGotPcExpr()
1512 void PPC64::relaxTlsGdToIe(uint8_t *loc, const Relocation &rel, in relaxTlsGdToIe() argument
1518 relocateNoSym(loc, R_PPC64_GOT_TPREL16_HA, val); in relaxTlsGdToIe()
1524 uint32_t ra = (readFromHalf16(loc) & (0x1f << 16)); in relaxTlsGdToIe()
1525 writeFromHalf16(loc, 0xe8600000 | ra); in relaxTlsGdToIe()
1526 relocateNoSym(loc, R_PPC64_GOT_TPREL16_LO_DS, val); in relaxTlsGdToIe()
1532 writePrefixedInstruction(loc, 0x04100000e4600000); in relaxTlsGdToIe()
1533 relocateNoSym(loc, R_PPC64_GOT_TPREL_PCREL34, val); in relaxTlsGdToIe()
1546 const uintptr_t locAsInt = reinterpret_cast<uintptr_t>(loc); in relaxTlsGdToIe()
1548 write32(loc, NOP); // bl __tls_get_addr(sym@tlsgd) --> nop in relaxTlsGdToIe()
1549 write32(loc + 4, 0x7c636A14); // nop --> add r3, r3, r13 in relaxTlsGdToIe()
1552 write32(loc - 1, 0x7c636a14); in relaxTlsGdToIe()
1571 uint8_t *loc = buf + rel.offset; in relocateAlloc() local
1587 relaxGot(loc, rel, val); in relocateAlloc()
1597 !tryRelaxPPC64TocIndirection(rel, loc)) in relocateAlloc()
1598 relocate(loc, rel, val); in relocateAlloc()
1604 if (read32(loc) == 0x60000000) // nop in relocateAlloc()
1614 read32(loc + 4) != 0x60000000) && in relocateAlloc()
1617 errorOrWarn(getErrorLocation(loc) + "call to " + in relocateAlloc()
1622 write32(loc + 4, 0xe8410018); // ld %r2, 24(%r1) in relocateAlloc()
1624 relocate(loc, rel, val); in relocateAlloc()
1628 relaxTlsGdToIe(loc, rel, val); in relocateAlloc()
1631 relaxTlsGdToLe(loc, rel, val); in relocateAlloc()
1634 relaxTlsLdToLe(loc, rel, val); in relocateAlloc()
1637 relaxTlsIeToLe(loc, rel, val); in relocateAlloc()
1640 relocate(loc, rel, val); in relocateAlloc()
1674 bool PPC64::adjustPrologueForCrossSplitStack(uint8_t *loc, uint8_t *end, in adjustPrologueForCrossSplitStack() argument
1678 loc += getPPC64GlobalEntryToLocalEntryOffset(stOther); in adjustPrologueForCrossSplitStack()
1684 if (loc + 12 >= end) in adjustPrologueForCrossSplitStack()
1688 if (read32(loc) != 0xe80d8fc0) in adjustPrologueForCrossSplitStack()
1695 int32_t firstInstr = read32(loc + 4); in adjustPrologueForCrossSplitStack()
1706 uint32_t secondInstr = read32(loc + 8); in adjustPrologueForCrossSplitStack()
1730 error(getErrorLocation(loc) + "split-stack prologue adjustment overflows"); in adjustPrologueForCrossSplitStack()
1740 write32(loc + 4, 0x3D810000 | (uint16_t)hiImm); in adjustPrologueForCrossSplitStack()
1743 write32(loc + 8, secondInstr); in adjustPrologueForCrossSplitStack()
1746 write32(loc + 4, (0x39810000) | (uint16_t)loImm); in adjustPrologueForCrossSplitStack()
1747 write32(loc + 8, NOP); in adjustPrologueForCrossSplitStack()