• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /freebsd-12-stable/contrib/llvm-project/lld/ELF/Arch/

Lines Matching refs:loc

201                      const uint8_t *loc) const override;
208 void relocateOne(uint8_t *loc, RelType type, uint64_t val) const override;
217 void relaxGot(uint8_t *loc, RelType type, uint64_t val) const override;
218 void relaxTlsGdToIe(uint8_t *loc, RelType type, uint64_t val) const override;
219 void relaxTlsGdToLe(uint8_t *loc, RelType type, uint64_t val) const override;
220 void relaxTlsLdToLe(uint8_t *loc, RelType type, uint64_t val) const override;
221 void relaxTlsIeToLe(uint8_t *loc, RelType type, uint64_t val) const override;
223 bool adjustPrologueForCrossSplitStack(uint8_t *loc, uint8_t *end,
287 static void writeFromHalf16(uint8_t *loc, uint32_t insn) {
288 write32(config->isLE ? loc : loc - 2, insn);
291 static uint32_t readFromHalf16(const uint8_t *loc) {
292 return read32(config->isLE ? loc : loc - 2);
368 void PPC64::relaxGot(uint8_t *loc, RelType type, uint64_t val) const {
372 relocateOne(loc, type, val);
377 uint32_t insn = readFromHalf16(loc);
380 writeFromHalf16(loc, (insn & 0x03ffffff) | 0x38000000);
381 relocateOne(loc, R_PPC64_TOC16_LO, val);
389 void PPC64::relaxTlsGdToLe(uint8_t *loc, RelType type, uint64_t val) const {
407 writeFromHalf16(loc, 0x60000000); // nop
411 writeFromHalf16(loc, 0x3c6d0000); // addis r3, r13
412 relocateOne(loc, R_PPC64_TPREL16_HA, val);
415 write32(loc, 0x60000000); // nop
416 write32(loc + 4, 0x38630000); // addi r3, r3
420 relocateOne(loc + 4 + (config->ekind == ELF64BEKind ? 2 : 0),
428 void PPC64::relaxTlsLdToLe(uint8_t *loc, RelType type, uint64_t val) const {
446 writeFromHalf16(loc, 0x60000000); // nop
449 writeFromHalf16(loc, 0x3c6d0000); // addis r3, r13, 0
452 write32(loc, 0x60000000); // nop
453 write32(loc + 4, 0x38631000); // addi r3, r3, 4096
461 relocateOne(loc, type, val);
493 void PPC64::relaxTlsIeToLe(uint8_t *loc, RelType type, uint64_t val) const {
516 write32(loc - offset, 0x60000000); // nop
520 uint32_t regNo = read32(loc - offset) & 0x03E00000; // bits 6-10
521 write32(loc - offset, 0x3C0D0000 | regNo); // addis RegNo, r13
522 relocateOne(loc, R_PPC64_TPREL16_HA, val);
526 uint32_t primaryOp = getPrimaryOpCode(read32(loc));
529 uint32_t secondaryOp = (read32(loc) & 0x000007FE) >> 1; // bits 21-30
533 write32(loc, ((dFormOp << 26) | (read32(loc) & 0x03FFFFFF)));
534 relocateOne(loc + offset, R_PPC64_TPREL16_LO, val);
544 const uint8_t *loc) const {
637 error(getErrorLocation(loc) + "unknown relocation (" + Twine(type) +
773 void PPC64::relocateOne(uint8_t *loc, RelType type, uint64_t val) const {
785 checkAlignment(loc, val, 4, type);
787 uint8_t aalk = loc[3];
788 write16(loc + 2, (aalk & 3) | (val & 0xfffc));
792 checkIntUInt(loc, val, 16, originalType);
793 write16(loc, val);
796 checkIntUInt(loc, val, 32, originalType);
797 write32(loc, val);
801 checkInt(loc, val, 16, originalType);
804 uint16_t mask = isDQFormInstruction(readFromHalf16(loc)) ? 0xf : 0x3;
805 checkAlignment(loc, lo(val), mask + 1, originalType);
806 write16(loc, (read16(loc) & mask) | lo(val));
812 writeFromHalf16(loc, 0x60000000);
814 write16(loc, ha(val));
819 write16(loc, hi(val));
823 write16(loc, higher(val));
827 write16(loc, highera(val));
831 write16(loc, highest(val));
835 write16(loc, highesta(val));
844 uint32_t insn = readFromHalf16(loc);
846 error(getErrorLocation(loc) +
849 writeFromHalf16(loc, (insn & 0xffe00000) | 0x00020000 | lo(val));
851 write16(loc, lo(val));
858 uint32_t insn = readFromHalf16(loc);
860 checkAlignment(loc, lo(val), mask + 1, originalType);
866 error(getErrorLocation(loc) +
870 writeFromHalf16(loc, insn | 0x00020000 | lo(val));
872 write16(loc, (read16(loc) & mask) | lo(val));
876 checkInt(loc, val, 16, originalType);
877 write16(loc, val);
880 checkInt(loc, val, 32, type);
881 write32(loc, val);
886 write64(loc, val);
890 checkInt(loc, val, 16, type);
891 checkAlignment(loc, val, 4, type);
892 write32(loc, (read32(loc) & ~mask) | (val & mask));
897 checkInt(loc, val, 26, type);
898 checkAlignment(loc, val, 4, type);
899 write32(loc, (read32(loc) & ~mask) | (val & mask));
903 write64(loc, val - dynamicThreadPointerOffset);
975 void PPC64::relaxTlsGdToIe(uint8_t *loc, RelType type, uint64_t val) const {
980 relocateOne(loc, R_PPC64_GOT_TPREL16_HA, val);
986 uint32_t ra = (readFromHalf16(loc) & (0x1f << 16));
987 writeFromHalf16(loc, 0xe8600000 | ra);
988 relocateOne(loc, R_PPC64_GOT_TPREL16_LO_DS, val);
992 write32(loc, 0x60000000); // bl __tls_get_addr(sym@tlsgd) --> nop
993 write32(loc + 4, 0x7c636A14); // nop --> add r3, r3, r13
1028 bool PPC64::adjustPrologueForCrossSplitStack(uint8_t *loc, uint8_t *end,
1032 loc += getPPC64GlobalEntryToLocalEntryOffset(stOther);
1038 if (loc + 12 >= end)
1042 if (read32(loc) != 0xe80d8fc0)
1049 int32_t firstInstr = read32(loc + 4);
1060 uint32_t secondInstr = read32(loc + 8);
1084 error(getErrorLocation(loc) + "split-stack prologue adjustment overflows");
1094 write32(loc + 4, 0x3D810000 | (uint16_t)hiImm);
1097 write32(loc + 8, secondInstr);
1100 write32(loc + 4, (0x39810000) | (uint16_t)loImm);
1101 write32(loc + 8, 0x60000000);