[all-commits] [llvm/llvm-project] 1fe702: [lld][LoongArch] Relax TLS LE/GD/LD (#123600)

Zhaoxin Yang via All-commits all-commits at lists.llvm.org
Mon Mar 10 23:31:04 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1fe702fdecf79121346fe5374b418bc1dbf9362c
      https://github.com/llvm/llvm-project/commit/1fe702fdecf79121346fe5374b418bc1dbf9362c
  Author: Zhaoxin Yang <yangzhaoxin at loongson.cn>
  Date:   2025-03-11 (Tue, 11 Mar 2025)

  Changed paths:
    M lld/ELF/Arch/LoongArch.cpp
    M lld/test/ELF/loongarch-relax-emit-relocs.s
    A lld/test/ELF/loongarch-relax-tls-le.s
    M lld/test/ELF/loongarch-tls-gd.s
    M lld/test/ELF/loongarch-tls-ld.s
    M lld/test/ELF/loongarch-tls-le.s

  Log Message:
  -----------
  [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.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list