({ \
bfd_vma __lo = (relocation & (bfd_vma)0xfff); \
relocation = (relocation & ~(bfd_vma)0xfff) \
- - (pc & ~(bfd_vma)0xfff); \
+ - ((pc) & ~(bfd_vma)0xfff); \
if (__lo > 0x7ff) \
relocation += (0x1000 - 0x100000000); \
if (relocation & 0x80000000) \
}
break;
- case R_LARCH_PCALA64_LO20:
case R_LARCH_PCALA64_HI12:
+ pc -= 4;
+ /* Fall through. */
+ case R_LARCH_PCALA64_LO20:
if (h && h->plt.offset != MINUS_ONE)
relocation = sec_addr (plt) + h->plt.offset;
else
relocation += rel->r_addend;
- RELOCATE_CALC_PC64_HI32 (relocation, pc);
+ RELOCATE_CALC_PC64_HI32 (relocation, pc - 8);
break;
relocation = got_off + sec_addr (got);
}
- if (r_type == R_LARCH_GOT64_PC_HI12
- || r_type == R_LARCH_GOT64_PC_LO20)
- RELOCATE_CALC_PC64_HI32 (relocation, pc);
+ if (r_type == R_LARCH_GOT64_PC_HI12)
+ RELOCATE_CALC_PC64_HI32 (relocation, pc - 12);
+ else if (r_type == R_LARCH_GOT64_PC_LO20)
+ RELOCATE_CALC_PC64_HI32 (relocation, pc - 8);
break;
/* Use both TLS_GD and TLS_DESC. */
if ((tls_type & GOT_TLS_GD) && (tls_type & GOT_TLS_GDESC))
relocation += 2 * GOT_ENTRY_SIZE;
- }
- if (r_type == R_LARCH_TLS_DESC64_PC_LO20
- || r_type == R_LARCH_TLS_DESC64_PC_HI12)
- RELOCATE_CALC_PC64_HI32 (relocation, pc);
+ if (r_type == R_LARCH_TLS_DESC64_PC_LO20)
+ RELOCATE_CALC_PC64_HI32 (relocation, pc - 8);
+ else if (r_type == R_LARCH_TLS_DESC64_PC_HI12)
+ RELOCATE_CALC_PC64_HI32 (relocation, pc - 12);
break;
+ }
case R_LARCH_TLS_DESC_LD:
case R_LARCH_TLS_DESC_CALL:
else if (GOT_TLS_GD_ANY_P (tls_type) && (tls_type & GOT_TLS_IE))
relocation += 2 * GOT_ENTRY_SIZE;
- if (r_type == R_LARCH_TLS_IE64_PC_LO20
- || r_type == R_LARCH_TLS_IE64_PC_HI12)
- RELOCATE_CALC_PC64_HI32 (relocation, pc);
+ if (r_type == R_LARCH_TLS_IE64_PC_LO20)
+ RELOCATE_CALC_PC64_HI32 (relocation, pc - 8);
+ else if (r_type == R_LARCH_TLS_IE64_PC_HI12)
+ RELOCATE_CALC_PC64_HI32 (relocation, pc - 12);
break;
--- /dev/null
+#ld: -Ttext=0x180000ff8 -Tdata=0x1000000000
+#objdump: -d
+
+.*:[ ]+file format .*
+
+
+Disassembly of section .text:
+
+0000000180000ff8 <_start>:
+[ ]+180000ff8:[ ]+1b000004[ ]+pcalau12i[ ]+\$a0,[ ]+-524288
+[ ]+180000ffc:[ ]+02c0000c[ ]+li.d[ ]+\$t0,[ ]+0
+[ ]+180001000:[ ]+160001ec[ ]+lu32i.d[ ]+\$t0,[ ]+15
+[ ]+180001004:[ ]+0300018c[ ]+lu52i.d[ ]+\$t0,[ ]+\$t0,[ ]+0
+[ ]+180001008:[ ]+0010b084[ ]+add.d[ ]+\$a0,[ ]+\$a0,[ ]+\$t0
+[ ]+18000100c:[ ]+4c000020[ ]+ret