Lines Matching refs:loc
43 const uint8_t *loc) const override;
44 void relocate(uint8_t *loc, const Relocation &rel,
264 const uint8_t *loc) const { in getRelExpr()
329 error(getErrorLocation(loc) + "unknown relocation (" + Twine(type) + in getRelExpr()
335 void RISCV::relocate(uint8_t *loc, const Relocation &rel, uint64_t val) const { in relocate() argument
340 write32le(loc, val); in relocate()
343 write64le(loc, val); in relocate()
347 checkInt(loc, val, 9, rel); in relocate()
348 checkAlignment(loc, val, 2, rel); in relocate()
349 uint16_t insn = read16le(loc) & 0xE383; in relocate()
357 write16le(loc, insn); in relocate()
362 checkInt(loc, val, 12, rel); in relocate()
363 checkAlignment(loc, val, 2, rel); in relocate()
364 uint16_t insn = read16le(loc) & 0xE003; in relocate()
375 write16le(loc, insn); in relocate()
381 checkInt(loc, imm, 6, rel); in relocate()
383 write16le(loc, (read16le(loc) & 0x0F83) | 0x4000); in relocate()
387 write16le(loc, (read16le(loc) & 0xEF83) | imm17 | imm16_12); in relocate()
393 checkInt(loc, val, 21, rel); in relocate()
394 checkAlignment(loc, val, 2, rel); in relocate()
396 uint32_t insn = read32le(loc) & 0xFFF; in relocate()
403 write32le(loc, insn); in relocate()
408 checkInt(loc, val, 13, rel); in relocate()
409 checkAlignment(loc, val, 2, rel); in relocate()
411 uint32_t insn = read32le(loc) & 0x1FFF07F; in relocate()
418 write32le(loc, insn); in relocate()
426 checkInt(loc, hi, 20, rel); in relocate()
428 relocateNoSym(loc, R_RISCV_PCREL_HI20, val); in relocate()
429 relocateNoSym(loc + 4, R_RISCV_PCREL_LO12_I, val); in relocate()
442 checkInt(loc, SignExtend64(hi, bits) >> 12, 20, rel); in relocate()
443 write32le(loc, (read32le(loc) & 0xFFF) | (hi & 0xFFFFF000)); in relocate()
454 write32le(loc, setLO12_I(read32le(loc), lo & 0xfff)); in relocate()
463 write32le(loc, setLO12_S(read32le(loc), lo)); in relocate()
471 checkInt(loc, displace, 12, rel); in relocate()
472 uint32_t insn = (read32le(loc) & ~(31 << 15)) | (X_GP << 15); in relocate()
477 write32le(loc, insn); in relocate()
482 *loc += val; in relocate()
485 write16le(loc, read16le(loc) + val); in relocate()
488 write32le(loc, read32le(loc) + val); in relocate()
491 write64le(loc, read64le(loc) + val); in relocate()
494 *loc = (*loc & 0xc0) | (((*loc & 0x3f) - val) & 0x3f); in relocate()
497 *loc -= val; in relocate()
500 write16le(loc, read16le(loc) - val); in relocate()
503 write32le(loc, read32le(loc) - val); in relocate()
506 write64le(loc, read64le(loc) - val); in relocate()
509 *loc = (*loc & 0xc0) | (val & 0x3f); in relocate()
512 *loc = val; in relocate()
515 write16le(loc, val); in relocate()
521 checkInt(loc, val, 32, rel); in relocate()
522 write32le(loc, val); in relocate()
526 write32le(loc, val - dtpOffset); in relocate()
529 write64le(loc, val - dtpOffset); in relocate()
537 write64le(loc + 8, val); in relocate()
539 write32le(loc + 4, val); in relocate()
550 static void tlsdescToIe(uint8_t *loc, const Relocation &rel, uint64_t val) { in tlsdescToIe() argument
554 write32le(loc, 0x00000013); // nop in tlsdescToIe()
557 write32le(loc, utype(AUIPC, X_A0, hi20(val))); // auipc a0,<hi20> in tlsdescToIe()
561 write32le(loc, itype(LD, X_A0, X_A0, lo12(val))); // ld a0,<lo12>(a0) in tlsdescToIe()
563 write32le(loc, itype(LW, X_A0, X_A0, lo12(val))); // lw a0,<lo12>(a0) in tlsdescToIe()
570 static void tlsdescToLe(uint8_t *loc, const Relocation &rel, uint64_t val) { in tlsdescToLe() argument
574 write32le(loc, 0x00000013); // nop in tlsdescToLe()
578 write32le(loc, 0x00000013); // nop in tlsdescToLe()
580 write32le(loc, utype(LUI, X_A0, hi20(val))); // lui a0,<hi20> in tlsdescToLe()
584 write32le(loc, itype(ADDI, X_A0, 0, val)); // addi a0,zero,<lo12> in tlsdescToLe()
586 write32le(loc, itype(ADDI, X_A0, X_A0, lo12(val))); // addi a0,a0,<lo12> in tlsdescToLe()
604 uint8_t *loc = buf + rel.offset; in relocateAlloc() local
630 tlsdescToIe(loc, rel, val); in relocateAlloc()
653 tlsdescToLe(loc, rel, val); in relocateAlloc()
655 tlsdescToIe(loc, rel, val); in relocateAlloc()
663 if (overwriteULEB128(loc, val) >= 0x80) in relocateAlloc()
677 relocate(loc, rel, val); in relocateAlloc()
735 static void relaxCall(const InputSection &sec, size_t i, uint64_t loc, in relaxCall() argument
743 const int64_t displace = dest - loc; in relaxCall()
762 static void relaxTlsLe(const InputSection &sec, size_t i, uint64_t loc, in relaxTlsLe() argument
790 static void relaxHi20Lo12(const InputSection &sec, size_t i, uint64_t loc, in relaxHi20Lo12() argument
826 const uint64_t loc = secAddr + r.offset - delta; in relax() local
830 const uint64_t nextLoc = loc + r.addend; in relax()
833 remove = nextLoc - ((loc + align - 1) & -align); in relax()
836 errorOrWarn(getErrorLocation((const uint8_t*)loc) + in relax()
847 relaxCall(sec, i, loc, r, remove); in relax()
854 relaxTlsLe(sec, i, loc, r, remove); in relax()
860 relaxHi20Lo12(sec, i, loc, r, remove); in relax()