[lld] [lld][LoongArch] Fix relaxation for R_LARCH_GOT_PC_{HI20, LO12} (PR #151264)
Zhaoxin Yang via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 29 20:11:23 PDT 2025
================
@@ -57,6 +74,11 @@ _start:
la.pcrel $a0, sym
la.got $a0, sym
+ pcalau12i $a0, %got_pc_hi20(sym+4)
+ .reloc .-4, R_LARCH_RELAX, 0
+ ld $a0, $a0, %got_pc_lo12(sym+4)
+ .reloc .-4, R_LARCH_RELAX, 0
+
----------------
ylzsx wrote:
I will modify it to `la.global $a0, sym+4`.
The reason for modifying this file is to verify that even with relaxation enabled, such a transformation will not occur. This seems to be similar to the first case in https://maskray.me/blog/2021-08-08-toolchain-testing#i-dont-know-an-existing-test-can-be-enhanced.
https://github.com/llvm/llvm-project/pull/151264
More information about the llvm-commits
mailing list