diff options
author | Lulu Cai <cailulu@loongson.cn> | 2023-11-26 14:25:26 +0800 |
---|---|---|
committer | liuzhensong <liuzhensong@loongson.cn> | 2023-12-25 11:46:22 +0800 |
commit | 3898e04b8e4be8744f876ba475b5b2a07ca61ee6 (patch) | |
tree | a9a27b9285a79b41d748a71a99b9ec90c3639f29 /include | |
parent | 4f248d61eb9d319b552e3e0b2db862928c2c1971 (diff) | |
download | binutils-3898e04b8e4be8744f876ba475b5b2a07ca61ee6.zip binutils-3898e04b8e4be8744f876ba475b5b2a07ca61ee6.tar.gz binutils-3898e04b8e4be8744f876ba475b5b2a07ca61ee6.tar.bz2 |
LoongArch: Add tls transition support.
Transitions between DESC->IE/LE and IE->LE are supported now.
1. For DESC -> LE:
pcalau12i $a0,%desc_pc_hi20(var) => lu12i.w $a0,%le_hi20(var)
addi.d $a0,$a0,%desc_pc_lo12(var) => ori $a0,$a0,%le_lo12(var)
ld.d $a1,$a0,%desc_ld(var) => NOP
jirl $ra,$a1,%desc_call(var) => NOP
add.d $a0,$a0,$tp
2. For DESC -> IE:
pcalau12i $a0,%desc_pc_hi20(var) => pcalau12i $a0,%ie_pc_hi20(var)
addi.d $a0,$a0,%desc_pc_lo12(var) => ld.d $a0,$a0,%ie_pc_lo12(var)
ld.d $a1,$a0,%desc_ld(var) => NOP
jirl $ra,$a1,%desc_call(var) => NOP
add.d $a0,$a0,$tp
3. For IE -> LE:
pcalau12i $a0,%ie_pc_hi20(var) => lu12i.w $a0,%le_hi20(var)
ld.d $a0,$a0,%ie_pc_lo12(var) => ori $a0,$a0,%le_lo12(var)
add.d $a0,$a0,$tp
4. When a tls variable is accessed using both DESC and IE, DESC transitions
to IE and uses the same GOT entry as IE.
Diffstat (limited to 'include')
-rw-r--r-- | include/opcode/loongarch.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/opcode/loongarch.h b/include/opcode/loongarch.h index da936f7..32ff4d8 100644 --- a/include/opcode/loongarch.h +++ b/include/opcode/loongarch.h @@ -42,6 +42,12 @@ extern "C" ((value) < (-(1 << ((bits) - 1) << align)) \ || (value) > ((((1 << ((bits) - 1)) - 1) << align))) + #define LARCH_LU12I_W 0x14000000 + #define LARCH_ORI 0x03800000 + #define LARCH_LD_D 0x28c00000 + #define LARCH_RD_A0 0x04 + #define LARCH_RD_RJ_A0 0x084 + typedef uint32_t insn_t; struct loongarch_opcode |