Lines Matching refs:loc

31                      const uint8_t *loc) const override;
38 void relocateOne(uint8_t *loc, RelType type, uint64_t val) const override;
42 void relaxGot(uint8_t *loc, RelType type, uint64_t val) const override;
43 void relaxTlsGdToIe(uint8_t *loc, RelType type, uint64_t val) const override;
44 void relaxTlsGdToLe(uint8_t *loc, RelType type, uint64_t val) const override;
45 void relaxTlsIeToLe(uint8_t *loc, RelType type, uint64_t val) const override;
46 void relaxTlsLdToLe(uint8_t *loc, RelType type, uint64_t val) const override;
47 bool adjustPrologueForCrossSplitStack(uint8_t *loc, uint8_t *end,
77 const uint8_t *loc) const {
127 error(getErrorLocation(loc) + "unknown relocation (" + Twine(type) +
180 void X86_64::relaxTlsGdToLe(uint8_t *loc, RelType type, uint64_t val) const {
194 memcpy(loc - 4, inst, sizeof(inst));
198 write32le(loc + 8, val + 4);
205 if (memcmp(loc - 3, "\x48\x8d\x05", 3)) {
206 error(getErrorLocation(loc - 3) + "R_X86_64_GOTPC32_TLSDESC must be used "
211 loc[-2] = 0xc7;
212 loc[-1] = 0xc0;
213 write32le(loc, val + 4);
215 loc[4] = 0x66;
216 loc[5] = 0x90;
220 void X86_64::relaxTlsGdToIe(uint8_t *loc, RelType type, uint64_t val) const {
234 memcpy(loc - 4, inst, sizeof(inst));
238 write32le(loc + 8, val - 8);
245 if (memcmp(loc - 3, "\x48\x8d\x05", 3)) {
246 error(getErrorLocation(loc - 3) + "R_X86_64_GOTPC32_TLSDESC must be used "
251 loc[-2] = 0x8b;
252 write32le(loc, val);
254 loc[4] = 0x66;
255 loc[5] = 0x90;
261 void X86_64::relaxTlsIeToLe(uint8_t *loc, RelType type, uint64_t val) const {
262 uint8_t *inst = loc - 3;
263 uint8_t reg = loc[-1] >> 3;
264 uint8_t *regSlot = loc - 1;
293 error(getErrorLocation(loc - 3) +
299 write32le(loc, val + 4);
302 void X86_64::relaxTlsLdToLe(uint8_t *loc, RelType type, uint64_t val) const {
304 write64le(loc, val);
308 write32le(loc, val);
318 if (loc[4] == 0xe8) {
328 memcpy(loc - 3, inst, sizeof(inst));
332 if (loc[4] == 0xff && loc[5] == 0x15) {
341 loc[-3] = 0x66;
342 memcpy(loc - 2, inst, sizeof(inst));
346 error(getErrorLocation(loc - 3) +
350 void X86_64::relocateOne(uint8_t *loc, RelType type, uint64_t val) const {
353 checkIntUInt(loc, val, 8, type);
354 *loc = val;
357 checkInt(loc, val, 8, type);
358 *loc = val;
361 checkIntUInt(loc, val, 16, type);
362 write16le(loc, val);
365 checkInt(loc, val, 16, type);
366 write16le(loc, val);
369 checkUInt(loc, val, 32, type);
370 write32le(loc, val);
387 checkInt(loc, val, 32, type);
388 write32le(loc, val);
397 write64le(loc, val);
435 static void relaxGotNoPic(uint8_t *loc, uint64_t val, uint8_t op,
437 const uint8_t rex = loc[-3];
456 loc[-1] = 0xc0 | (modRm & 0x38) >> 3; // ModR/M byte.
460 loc[-2] = 0xf7;
473 loc[-3] = (rex & ~0x4) | (rex & 0x4) >> 2;
474 write32le(loc, val);
484 loc[-1] = 0xc0 | (modRm & 0x38) >> 3 | (op & 0x3c); // ModR/M byte.
493 loc[-2] = 0x81;
494 loc[-3] = (rex & ~0x4) | (rex & 0x4) >> 2;
495 write32le(loc, val);
498 void X86_64::relaxGot(uint8_t *loc, RelType type, uint64_t val) const {
499 const uint8_t op = loc[-2];
500 const uint8_t modRm = loc[-1];
504 loc[-2] = 0x8d;
505 write32le(loc, val);
513 relaxGotNoPic(loc, val + 4, op, modRm);
522 loc[-2] = 0x67; // addr32 prefix
523 loc[-1] = 0xe8; // call
524 write32le(loc, val);
531 loc[-2] = 0xe9; // jmp
532 loc[3] = 0x90; // nop
533 write32le(loc - 1, val + 1);
540 bool X86_64::adjustPrologueForCrossSplitStack(uint8_t *loc, uint8_t *end,
547 if (loc + 8 >= end)
552 if (memcmp(loc, "\x64\x48\x3b\x24\x25", 5) == 0) {
553 memcpy(loc, "\xf9\x0f\x1f\x84\x00\x00\x00\x00", 8);
561 if (memcmp(loc, "\x4c\x8d\x94\x24", 4) == 0 ||
562 memcmp(loc, "\x4c\x8d\x9c\x24", 4) == 0) {
565 write32le(loc + 4, read32le(loc + 4) - 0x4000);