diff options
author | Zhaoxin Yang <yangzhaoxin@loongson.cn> | 2025-03-11 14:30:41 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-11 14:30:41 +0800 |
commit | 1fe702fdecf79121346fe5374b418bc1dbf9362c (patch) | |
tree | 6c8a63e3f38928e31da27f1d5ddd0c346301e238 /clang/lib/CodeGen/ModuleBuilder.cpp | |
parent | 75f76d482cc24162d5e3fdae0f0acd4c8f9cec6b (diff) | |
download | llvm-1fe702fdecf79121346fe5374b418bc1dbf9362c.zip llvm-1fe702fdecf79121346fe5374b418bc1dbf9362c.tar.gz llvm-1fe702fdecf79121346fe5374b418bc1dbf9362c.tar.bz2 |
[lld][LoongArch] Relax TLS LE/GD/LD (#123600)
In local-exec form, the code sequence is converted as follows:
```
From:
lu12i.w $rd, %le_hi20_r(sym)
R_LARCH_TLS_LE_HI20_R, R_LARCH_RELAX
add.w/d $rd, $rd, $tp, %le_add_r(sym)
R_LARCH_TLS_LE_ADD_R, R_LARCH_RELAX
addi/ld/st.w/d $rd, $rd, %le_lo12_r(sym)
R_LARCH_TLS_LE_LO12_R, R_LARCH_RELAX
To:
addi/ld/st.w/d $rd, $tp, %le_lo12_r(sym)
R_LARCH_TLS_LE_LO12_R
```
In global-dynamic or local-dynamic, the code sequence is converted as
follows:
```
From:
pcalau12i $a0, %ld_pc_hi20(sym) | %gd_pc_hi20(sym)
R_LARCH_TLS_GD_PC_HI20 | R_LARCH_TLS_LD_PC_HI20, R_LARCH_RELAX
addi.w/d $a0, $a0, %got_pc_lo12(sym) | %got_pc_lo12(sym)
R_LARCH_GOT_PC_LO12, R_LARCH_RELAX
To:
pcaddi $a0, %got_pc_lo12(sym) | %got_pc_lo12(sym)
R_LARCH_TLS_GD_PCREL20_S2 | R_LARCH_TLS_LD_PCREL20_S2
```
Note: For initial-exec form, since it involves the conversion from IE to
LE, we will implement it in a future patch.
Diffstat (limited to 'clang/lib/CodeGen/ModuleBuilder.cpp')
0 files changed, 0 insertions, 0 deletions