Lines Matching refs:loc
31 const uint8_t *loc) const override;
38 void relocate(uint8_t *loc, const Relocation &rel,
40 void applyJumpInstrMod(uint8_t *loc, JumpModType type,
44 const uint8_t *loc) const override;
45 void relaxGot(uint8_t *loc, const Relocation &rel,
47 void relaxTlsGdToIe(uint8_t *loc, const Relocation &rel,
49 void relaxTlsGdToLe(uint8_t *loc, const Relocation &rel,
51 void relaxTlsIeToLe(uint8_t *loc, const Relocation &rel,
53 void relaxTlsLdToLe(uint8_t *loc, const Relocation &rel,
55 bool adjustPrologueForCrossSplitStack(uint8_t *loc, uint8_t *end,
312 const uint8_t *loc) const { in getRelExpr()
362 error(getErrorLocation(loc) + "unknown relocation (" + Twine(type) + in getRelExpr()
415 void X86_64::relaxTlsGdToLe(uint8_t *loc, const Relocation &rel, in relaxTlsGdToLe() argument
430 memcpy(loc - 4, inst, sizeof(inst)); in relaxTlsGdToLe()
434 write32le(loc + 8, val + 4); in relaxTlsGdToLe()
441 if (memcmp(loc - 3, "\x48\x8d\x05", 3)) { in relaxTlsGdToLe()
442 error(getErrorLocation(loc - 3) + "R_X86_64_GOTPC32_TLSDESC must be used " in relaxTlsGdToLe()
447 loc[-2] = 0xc7; in relaxTlsGdToLe()
448 loc[-1] = 0xc0; in relaxTlsGdToLe()
449 write32le(loc, val + 4); in relaxTlsGdToLe()
451 loc[4] = 0x66; in relaxTlsGdToLe()
452 loc[5] = 0x90; in relaxTlsGdToLe()
456 void X86_64::relaxTlsGdToIe(uint8_t *loc, const Relocation &rel, in relaxTlsGdToIe() argument
471 memcpy(loc - 4, inst, sizeof(inst)); in relaxTlsGdToIe()
475 write32le(loc + 8, val - 8); in relaxTlsGdToIe()
482 if (memcmp(loc - 3, "\x48\x8d\x05", 3)) { in relaxTlsGdToIe()
483 error(getErrorLocation(loc - 3) + "R_X86_64_GOTPC32_TLSDESC must be used " in relaxTlsGdToIe()
488 loc[-2] = 0x8b; in relaxTlsGdToIe()
489 write32le(loc, val); in relaxTlsGdToIe()
491 loc[4] = 0x66; in relaxTlsGdToIe()
492 loc[5] = 0x90; in relaxTlsGdToIe()
498 void X86_64::relaxTlsIeToLe(uint8_t *loc, const Relocation &, in relaxTlsIeToLe() argument
500 uint8_t *inst = loc - 3; in relaxTlsIeToLe()
501 uint8_t reg = loc[-1] >> 3; in relaxTlsIeToLe()
502 uint8_t *regSlot = loc - 1; in relaxTlsIeToLe()
531 error(getErrorLocation(loc - 3) + in relaxTlsIeToLe()
537 write32le(loc, val + 4); in relaxTlsIeToLe()
540 void X86_64::relaxTlsLdToLe(uint8_t *loc, const Relocation &rel, in relaxTlsLdToLe() argument
543 write64le(loc, val); in relaxTlsLdToLe()
547 write32le(loc, val); in relaxTlsLdToLe()
557 if (loc[4] == 0xe8) { in relaxTlsLdToLe()
567 memcpy(loc - 3, inst, sizeof(inst)); in relaxTlsLdToLe()
571 if (loc[4] == 0xff && loc[5] == 0x15) { in relaxTlsLdToLe()
580 loc[-3] = 0x66; in relaxTlsLdToLe()
581 memcpy(loc - 2, inst, sizeof(inst)); in relaxTlsLdToLe()
585 error(getErrorLocation(loc - 3) + in relaxTlsLdToLe()
593 void X86_64::applyJumpInstrMod(uint8_t *loc, JumpModType type, in applyJumpInstrMod() argument
598 *loc = 0xe9; in applyJumpInstrMod()
600 *loc = 0xeb; in applyJumpInstrMod()
604 loc[-1] = 0x0f; in applyJumpInstrMod()
605 *loc = 0x84; in applyJumpInstrMod()
607 *loc = 0x74; in applyJumpInstrMod()
611 loc[-1] = 0x0f; in applyJumpInstrMod()
612 *loc = 0x85; in applyJumpInstrMod()
614 *loc = 0x75; in applyJumpInstrMod()
618 loc[-1] = 0x0f; in applyJumpInstrMod()
619 *loc = 0x8f; in applyJumpInstrMod()
621 *loc = 0x7f; in applyJumpInstrMod()
625 loc[-1] = 0x0f; in applyJumpInstrMod()
626 *loc = 0x8d; in applyJumpInstrMod()
628 *loc = 0x7d; in applyJumpInstrMod()
632 loc[-1] = 0x0f; in applyJumpInstrMod()
633 *loc = 0x82; in applyJumpInstrMod()
635 *loc = 0x72; in applyJumpInstrMod()
639 loc[-1] = 0x0f; in applyJumpInstrMod()
640 *loc = 0x86; in applyJumpInstrMod()
642 *loc = 0x76; in applyJumpInstrMod()
646 loc[-1] = 0x0f; in applyJumpInstrMod()
647 *loc = 0x8c; in applyJumpInstrMod()
649 *loc = 0x7c; in applyJumpInstrMod()
653 loc[-1] = 0x0f; in applyJumpInstrMod()
654 *loc = 0x8e; in applyJumpInstrMod()
656 *loc = 0x7e; in applyJumpInstrMod()
660 loc[-1] = 0x0f; in applyJumpInstrMod()
661 *loc = 0x87; in applyJumpInstrMod()
663 *loc = 0x77; in applyJumpInstrMod()
667 loc[-1] = 0x0f; in applyJumpInstrMod()
668 *loc = 0x83; in applyJumpInstrMod()
670 *loc = 0x73; in applyJumpInstrMod()
677 void X86_64::relocate(uint8_t *loc, const Relocation &rel, uint64_t val) const { in relocate() argument
680 checkIntUInt(loc, val, 8, rel); in relocate()
681 *loc = val; in relocate()
684 checkInt(loc, val, 8, rel); in relocate()
685 *loc = val; in relocate()
688 checkIntUInt(loc, val, 16, rel); in relocate()
689 write16le(loc, val); in relocate()
692 checkInt(loc, val, 16, rel); in relocate()
693 write16le(loc, val); in relocate()
696 checkUInt(loc, val, 32, rel); in relocate()
697 write32le(loc, val); in relocate()
714 checkInt(loc, val, 32, rel); in relocate()
715 write32le(loc, val); in relocate()
724 write64le(loc, val); in relocate()
732 const uint8_t *loc) const { in adjustGotPcExpr()
740 const uint8_t op = loc[-2]; in adjustGotPcExpr()
741 const uint8_t modRm = loc[-1]; in adjustGotPcExpr()
768 static void relaxGotNoPic(uint8_t *loc, uint64_t val, uint8_t op, in relaxGotNoPic() argument
770 const uint8_t rex = loc[-3]; in relaxGotNoPic()
789 loc[-1] = 0xc0 | (modRm & 0x38) >> 3; // ModR/M byte. in relaxGotNoPic()
793 loc[-2] = 0xf7; in relaxGotNoPic()
806 loc[-3] = (rex & ~0x4) | (rex & 0x4) >> 2; in relaxGotNoPic()
807 write32le(loc, val); in relaxGotNoPic()
817 loc[-1] = 0xc0 | (modRm & 0x38) >> 3 | (op & 0x3c); // ModR/M byte. in relaxGotNoPic()
826 loc[-2] = 0x81; in relaxGotNoPic()
827 loc[-3] = (rex & ~0x4) | (rex & 0x4) >> 2; in relaxGotNoPic()
828 write32le(loc, val); in relaxGotNoPic()
831 void X86_64::relaxGot(uint8_t *loc, const Relocation &, uint64_t val) const { in relaxGot() argument
832 const uint8_t op = loc[-2]; in relaxGot()
833 const uint8_t modRm = loc[-1]; in relaxGot()
837 loc[-2] = 0x8d; in relaxGot()
838 write32le(loc, val); in relaxGot()
846 relaxGotNoPic(loc, val + 4, op, modRm); in relaxGot()
855 loc[-2] = 0x67; // addr32 prefix in relaxGot()
856 loc[-1] = 0xe8; // call in relaxGot()
857 write32le(loc, val); in relaxGot()
864 loc[-2] = 0xe9; // jmp in relaxGot()
865 loc[3] = 0x90; // nop in relaxGot()
866 write32le(loc - 1, val + 1); in relaxGot()
873 bool X86_64::adjustPrologueForCrossSplitStack(uint8_t *loc, uint8_t *end, in adjustPrologueForCrossSplitStack() argument
880 if (loc + 8 >= end) in adjustPrologueForCrossSplitStack()
885 if (memcmp(loc, "\x64\x48\x3b\x24\x25", 5) == 0) { in adjustPrologueForCrossSplitStack()
886 memcpy(loc, "\xf9\x0f\x1f\x84\x00\x00\x00\x00", 8); in adjustPrologueForCrossSplitStack()
894 if (memcmp(loc, "\x4c\x8d\x94\x24", 4) == 0 || in adjustPrologueForCrossSplitStack()
895 memcmp(loc, "\x4c\x8d\x9c\x24", 4) == 0) { in adjustPrologueForCrossSplitStack()
898 write32le(loc + 4, read32le(loc + 4) - 0x4000); in adjustPrologueForCrossSplitStack()