Lines Matching refs:loc
28 const uint8_t *loc) const override;
37 void relocate(uint8_t *loc, const Relocation &rel,
73 const uint8_t *loc) const { in getRelExpr()
132 return (loc[-1] & 0xc7) == 0x5 ? R_GOT : R_GOTPLT; in getRelExpr()
148 error(getErrorLocation(loc) + "unknown relocation (" + Twine(type) + in getRelExpr()
283 void X86::relocate(uint8_t *loc, const Relocation &rel, uint64_t val) const { in relocate() argument
289 checkIntUInt(loc, val, 8, rel); in relocate()
290 *loc = val; in relocate()
293 checkInt(loc, val, 8, rel); in relocate()
294 *loc = val; in relocate()
297 checkIntUInt(loc, val, 16, rel); in relocate()
298 write16le(loc, val); in relocate()
311 checkInt(loc, val, 17, rel); in relocate()
312 write16le(loc, val); in relocate()
335 checkInt(loc, val, 32, rel); in relocate()
336 write32le(loc, val); in relocate()
340 write32le(loc + 4, val); in relocate()
347 static void relaxTlsGdToLe(uint8_t *loc, const Relocation &rel, uint64_t val) { in relaxTlsGdToLe() argument
360 uint8_t *w = loc[-2] == 0x04 ? loc - 3 : loc - 2; in relaxTlsGdToLe()
367 if (memcmp(loc - 2, "\x8d\x83", 2)) { in relaxTlsGdToLe()
368 error(getErrorLocation(loc - 2) + in relaxTlsGdToLe()
372 loc[-1] = 0x05; in relaxTlsGdToLe()
373 write32le(loc, val); in relaxTlsGdToLe()
377 loc[0] = 0x66; in relaxTlsGdToLe()
378 loc[1] = 0x90; in relaxTlsGdToLe()
382 static void relaxTlsGdToIe(uint8_t *loc, const Relocation &rel, uint64_t val) { in relaxTlsGdToIe() argument
394 uint8_t *w = loc[-2] == 0x04 ? loc - 3 : loc - 2; in relaxTlsGdToIe()
399 if (memcmp(loc - 2, "\x8d\x83", 2)) { in relaxTlsGdToIe()
400 error(getErrorLocation(loc - 2) + in relaxTlsGdToIe()
404 loc[-2] = 0x8b; in relaxTlsGdToIe()
405 write32le(loc, val); in relaxTlsGdToIe()
409 loc[0] = 0x66; in relaxTlsGdToIe()
410 loc[1] = 0x90; in relaxTlsGdToIe()
416 static void relaxTlsIeToLe(uint8_t *loc, const Relocation &rel, uint64_t val) { in relaxTlsIeToLe() argument
421 uint8_t reg = (loc[-1] >> 3) & 7; in relaxTlsIeToLe()
424 if (loc[-1] == 0xa1) { in relaxTlsIeToLe()
428 loc[-1] = 0xb8; in relaxTlsIeToLe()
429 } else if (loc[-2] == 0x8b) { in relaxTlsIeToLe()
431 loc[-2] = 0xc7; in relaxTlsIeToLe()
432 loc[-1] = 0xc0 | reg; in relaxTlsIeToLe()
435 loc[-2] = 0x81; in relaxTlsIeToLe()
436 loc[-1] = 0xc0 | reg; in relaxTlsIeToLe()
440 if (loc[-2] == 0x8b) { in relaxTlsIeToLe()
442 loc[-2] = 0xc7; in relaxTlsIeToLe()
443 loc[-1] = 0xc0 | reg; in relaxTlsIeToLe()
446 loc[-2] = 0x8d; in relaxTlsIeToLe()
447 loc[-1] = 0x80 | (reg << 3) | reg; in relaxTlsIeToLe()
450 write32le(loc, val); in relaxTlsIeToLe()
453 static void relaxTlsLdToLe(uint8_t *loc, const Relocation &rel, uint64_t val) { in relaxTlsLdToLe() argument
455 write32le(loc, val); in relaxTlsLdToLe()
459 if (loc[4] == 0xe8) { in relaxTlsLdToLe()
469 memcpy(loc - 2, inst, sizeof(inst)); in relaxTlsLdToLe()
481 memcpy(loc - 2, inst, sizeof(inst)); in relaxTlsLdToLe()
489 uint8_t *loc = buf + rel.offset; in relocateAlloc() local
496 relaxTlsGdToIe(loc, rel, val); in relocateAlloc()
500 relaxTlsGdToLe(loc, rel, val); in relocateAlloc()
503 relaxTlsLdToLe(loc, rel, val); in relocateAlloc()
506 relaxTlsIeToLe(loc, rel, val); in relocateAlloc()
509 relocate(loc, rel, val); in relocateAlloc()