relocation += rel->r_addend;
RELOCATE_CALC_PC32_HI20 (relocation, pc);
-
break;
case R_LARCH_TLS_LE_HI20_R:
+ relocation += rel->r_addend;
relocation -= elf_hash_table (info)->tls_sec->vma;
-
RELOCATE_TLS_TP32_HI20 (relocation);
-
break;
case R_LARCH_PCALA_LO12:
case R_LARCH_TLS_LE64_HI12:
BFD_ASSERT (resolved_local && elf_hash_table (info)->tls_sec);
+ relocation += rel->r_addend;
relocation -= elf_hash_table (info)->tls_sec->vma;
break;
/* Init ilp32/lp64 registers alias. */
r_abi_names = loongarch_r_alias;
for (i = 0; i < ARRAY_SIZE (loongarch_r_alias); i++)
- str_hash_insert (r_htab, loongarch_r_alias[i], (void *) (i + 1),
- 0);
+ str_hash_insert (r_htab, loongarch_r_alias[i], (void *) (i + 1), 0);
+
+ for (i = 0; i < ARRAY_SIZE (loongarch_r_alias_1); i++)
+ str_hash_insert (r_htab, loongarch_r_alias_1[i], (void *) (i + 1), 0);
+
for (i = 0; i < ARRAY_SIZE (loongarch_r_alias_deprecated); i++)
str_hash_insert (r_deprecated_htab, loongarch_r_alias_deprecated[i],
(void *) (i + 1), 0);
}
run_list_test "align"
+ run_list_test "reg-s9"
}
--- /dev/null
+# No warning or error expected.
--- /dev/null
+# Add support for $s9 register
+addi.d $t0, $s9, 0
extern const char *const loongarch_r_normal_name[32];
extern const char *const loongarch_r_alias[32];
+ extern const char *const loongarch_r_alias_1[32];
extern const char *const loongarch_r_alias_deprecated[32];
extern const char *const loongarch_f_normal_name[32];
extern const char *const loongarch_f_alias[32];
run_dump_test "local-ifunc-reloc"
run_dump_test "anno-sym"
run_dump_test "pcala64"
+ run_dump_test "tls-le"
}
if [istarget "loongarch32-*-*"] {
--- /dev/null
+#ld: --no-relax
+#objdump: -d
+
+.*:[ ]+file format .*
+
+
+Disassembly of section .text:
+
+[ ]*00000001200000e8 <_start>:
+[ ]+1200000e8:[ ]+14000004[ ]+lu12i.w[ ]+\$a0, 0
+[ ]+1200000ec:[ ]+03802085[ ]+ori[ ]+\$a1, \$a0, 0x8
+[ ]+1200000f0:[ ]+14000004[ ]+lu12i.w[ ]+\$a0, 0
+[ ]+1200000f4:[ ]+02c02085[ ]+addi.d[ ]+\$a1, \$a0, 8
+[ ]+1200000f8:[ ]+4c000020[ ]+ret
--- /dev/null
+# Support for TLS LE symbols with addend
+ .text
+ .globl a
+ .section .tdata,"awT",@progbits
+ .align 2
+ .type a, @object
+ .size a, 4
+a:
+ .word 123
+
+ .text
+ .global _start
+_start:
+ lu12i.w $r4,%le_hi20(a + 0x8)
+ ori $r5,$r4,%le_lo12(a + 0x8)
+ lu12i.w $r4,%le_hi20_r(a + 0x8)
+ addi.d $r5,$r4,%le_lo12_r(a + 0x8)
+ jr $ra
"$s1", "$s2", "$s3", "$s4", "$s5", "$s6", "$s7", "$s8",
};
+/* Add support for $s9. */
+const char *const loongarch_r_alias_1[32] =
+{
+ "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "$s9", "",
+ "", "", "", "", "", "", "", "",
+};
+
const char *const loongarch_r_alias_deprecated[32] =
{
"", "", "", "", "$v0", "$v1", "", "", "", "", "", "", "", "", "", "",