Lines Matching defs:rel
40 void relocate(uint8_t *loc, const Relocation &rel,
55 void relaxTlsGdToLe(uint8_t *loc, const Relocation &rel, uint64_t val) const;
56 void relaxTlsGdToIe(uint8_t *loc, const Relocation &rel, uint64_t val) const;
57 void relaxTlsLdToLe(uint8_t *loc, const Relocation &rel, uint64_t val) const;
58 void relaxTlsIeToLe(uint8_t *loc, const Relocation &rel, uint64_t val) const;
337 for (Relocation &rel : sec->relocs()) {
338 if (rel.expr != R_RELAX_GOT_PC && rel.expr != R_RELAX_GOT_PC_NOPIC)
340 assert(rel.addend == -4);
342 Relocation rel1 = rel;
343 rel1.addend = rel.expr == R_RELAX_GOT_PC_NOPIC ? 0 : -4;
346 sec->outSecOff + rel.offset);
349 if (rel.sym->auxIdx == 0) {
350 rel.sym->allocateAux(ctx);
351 addGotEntry(ctx, *rel.sym);
354 rel.expr = R_GOT_PC;
436 // An x86 entry is the address of the ifunc resolver function (for -z rel).
475 void X86_64::relaxTlsGdToLe(uint8_t *loc, const Relocation &rel,
477 if (rel.type == R_X86_64_TLSGD) {
495 } else if (rel.type == R_X86_64_GOTPC32_TLSDESC ||
496 rel.type == R_X86_64_CODE_4_GOTPC32_TLSDESC) {
500 Err(ctx) << getErrorLoc(ctx, (rel.type == R_X86_64_GOTPC32_TLSDESC)
507 if (rel.type == R_X86_64_GOTPC32_TLSDESC) {
518 assert(rel.type == R_X86_64_TLSDESC_CALL);
524 void X86_64::relaxTlsGdToIe(uint8_t *loc, const Relocation &rel,
526 if (rel.type == R_X86_64_TLSGD) {
544 } else if (rel.type == R_X86_64_GOTPC32_TLSDESC ||
545 rel.type == R_X86_64_CODE_4_GOTPC32_TLSDESC) {
549 Err(ctx) << getErrorLoc(ctx, (rel.type == R_X86_64_GOTPC32_TLSDESC)
560 assert(rel.type == R_X86_64_TLSDESC_CALL);
569 void X86_64::relaxTlsIeToLe(uint8_t *loc, const Relocation &rel,
575 if (rel.type == R_X86_64_GOTTPOFF) {
607 } else if (rel.type == R_X86_64_CODE_4_GOTTPOFF) {
628 } else if (rel.type == R_X86_64_CODE_6_GOTTPOFF) {
672 void X86_64::relaxTlsLdToLe(uint8_t *loc, const Relocation &rel,
855 static void relaxGot(uint8_t *loc, const Relocation &rel, uint64_t val);
857 void X86_64::relocate(uint8_t *loc, const Relocation &rel, uint64_t val) const {
858 switch (rel.type) {
860 checkIntUInt(ctx, loc, val, 8, rel);
864 checkInt(ctx, loc, val, 8, rel);
868 checkIntUInt(ctx, loc, val, 16, rel);
872 checkInt(ctx, loc, val, 16, rel);
876 checkUInt(ctx, loc, val, 32, rel);
887 checkInt(ctx, loc, val, 32, rel);
904 if (rel.expr != R_GOT_PC) {
905 relaxGot(loc, rel, val);
907 checkInt(ctx, loc, val, 32, rel);
915 if (rel.expr == R_RELAX_TLS_GD_TO_LE) {
916 relaxTlsGdToLe(loc, rel, val);
917 } else if (rel.expr == R_RELAX_TLS_GD_TO_IE) {
918 relaxTlsGdToIe(loc, rel, val);
920 checkInt(ctx, loc, val, 32, rel);
925 if (rel.expr == R_RELAX_TLS_LD_TO_LE) {
926 relaxTlsLdToLe(loc, rel, val);
928 checkInt(ctx, loc, val, 32, rel);
935 if (rel.expr == R_RELAX_TLS_IE_TO_LE) {
936 relaxTlsIeToLe(loc, rel, val);
938 checkInt(ctx, loc, val, 32, rel);
943 checkInt(ctx, loc, val, 32, rel);
1070 static void relaxGot(uint8_t *loc, const Relocation &rel, uint64_t val) {
1086 assert(!rel.sym->file->ctx.arg.isPic);
1088 rel.type == R_X86_64_CODE_4_GOTPCRELX);
1152 for (const Relocation &rel : sec.relocs()) {
1153 if (rel.expr == R_NONE) // See deleteFallThruJmpInsn
1155 uint8_t *loc = buf + rel.offset;
1156 const uint64_t val = sec.getRelocTargetVA(ctx, rel, secAddr + rel.offset);
1157 relocate(loc, rel, val);