[all-commits] [llvm/llvm-project] e6b28b: [lld][LoongArch] Implement TLSDESC GD/LD to IE/LE.
Zhaoxin Yang via All-commits
all-commits at lists.llvm.org
Wed Jun 25 23:47:54 PDT 2025
Branch: refs/heads/users/ylzsx/r-tlsdesc-to-iele-norelax
Home: https://github.com/llvm/llvm-project
Commit: e6b28b6dcb2010a7ae4997c8d59d55c0bf5b2756
https://github.com/llvm/llvm-project/commit/e6b28b6dcb2010a7ae4997c8d59d55c0bf5b2756
Author: yangzhaoxin <yangzhaoxin at loongson.cn>
Date: 2025-06-24 (Tue, 24 Jun 2025)
Changed paths:
M lld/ELF/Arch/LoongArch.cpp
M lld/ELF/InputSection.cpp
M lld/ELF/Relocations.cpp
M lld/ELF/Relocations.h
Log Message:
-----------
[lld][LoongArch] Implement TLSDESC GD/LD to IE/LE.
Support TLSDESC to initial-exec or local-exec optimizations. Introduce a new hook
RE_LOONGARCH_RELAX_TLS_GD_TO_IE_PAGE_PC and use existing R_RELAX_TLS_GD_TO_IE_ABS
to support TLSDESC => IE, while use existing R_RELAX_TLS_GD_TO_LE to support
TLSDESC => LE.
In normal or medium code model, there are two forms of code sequences:
* pcalau12i $a0, %desc_pc_hi20(sym_desc)
* addi.d $a0, $a0, %desc_pc_lo12(sym_desc)
* ld.d $ra, $a0, %desc_ld(sym_desc)
* jirl $ra, $ra, %desc_call(sym_desc)
------
* pcaddi $a0, %desc_pcrel_20(sym_desc)
* ld.d $ra, $a0, %desc_ld(sym_desc)
* jirl $ra, $ra, %desc_call(sym_desc)
The code sequence obtained is as follows:
* pcalau12i $a0, %ie_pc_hi20(sym_ie)
* ld.[wd] $a0, $a0, %ie_pc_lo12(sym_ie)
Simplicity, whether tlsdescToIe or tlsdescToLe, we always tend to convert the preceding
instructions to NOPs, due to both forms of code sequence (corresponding to relocation
combinations: R_LARCH_TLS_DESC_PC_HI20+R_LARCH_TLS_DESC_PC_LO12 and R_LARCH_TLS_DESC_PCREL20_S2)
have same process.
FIXME: When relaxation enables, redundant NOPs can be removed. It will
be implemented in a future patch.
Note: All forms of TLSDESC code sequences should not appear interleaved in the normal,
medium or extreme code model, which compilers do not generate and lld is unsupported.
This is thanks to the guard in PostRASchedulerList.cpp in llvm.
```
Calls are not scheduling boundaries before register allocation, but
post-ra we don't gain anything by scheduling across calls since we
don't need to worry about register pressure.
```
Commit: b789e959c1804a61d1d643a6497114af1fe15345
https://github.com/llvm/llvm-project/commit/b789e959c1804a61d1d643a6497114af1fe15345
Author: yangzhaoxin <yangzhaoxin at loongson.cn>
Date: 2025-06-24 (Tue, 24 Jun 2025)
Changed paths:
M lld/test/ELF/loongarch-relax-tlsdesc.s
M lld/test/ELF/loongarch-tlsdesc-pcrel20-s2.s
M lld/test/ELF/loongarch-tlsdesc.s
Log Message:
-----------
Modify loongarch-tlsdesc.s and loongarch-tlsdesc-pcrel20-s2.s
Add loongarch-relax-tlsdesc.s
Commit: 36e42bfbd00dccb2f6ad9369f9aad4cff6798ba2
https://github.com/llvm/llvm-project/commit/36e42bfbd00dccb2f6ad9369f9aad4cff6798ba2
Author: yangzhaoxin <yangzhaoxin at loongson.cn>
Date: 2025-06-24 (Tue, 24 Jun 2025)
Changed paths:
M lld/ELF/Relocations.cpp
M lld/ELF/Symbols.h
Log Message:
-----------
Delete the wrong flag NEEDS_TLSGD_TO_IE in the extreme code model.
Commit: f74ad7ac35129cf1bdcc432b56b16c36c64466df
https://github.com/llvm/llvm-project/commit/f74ad7ac35129cf1bdcc432b56b16c36c64466df
Author: yangzhaoxin <yangzhaoxin at loongson.cn>
Date: 2025-06-24 (Tue, 24 Jun 2025)
Changed paths:
M lld/ELF/Relocations.cpp
M lld/ELF/Symbols.h
Log Message:
-----------
Revert "Delete the wrong flag NEEDS_TLSGD_TO_IE in the extreme code model."
This reverts commit baee006a50c14536f2e60ad4300458458ee67d6c.
Commit: 243ec8f4a71af9eaf9f83188eb0acd1866b93a70
https://github.com/llvm/llvm-project/commit/243ec8f4a71af9eaf9f83188eb0acd1866b93a70
Author: yangzhaoxin <yangzhaoxin at loongson.cn>
Date: 2025-06-26 (Thu, 26 Jun 2025)
Changed paths:
M lld/ELF/Arch/LoongArch.cpp
Log Message:
-----------
[NFC] Fix code format
Compare: https://github.com/llvm/llvm-project/compare/85165b332fca...243ec8f4a71a
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