diff options
author | Xi Ruoyao <xry111@xry111.site> | 2024-12-25 12:41:43 +0800 |
---|---|---|
committer | cailulu <cailulu@loongson.cn> | 2024-12-27 17:52:29 +0800 |
commit | bd94e7cd84c19da4a37dbdbc2d5587db6383f28c (patch) | |
tree | bd95e91fa2af12e704cf5a79194fd5a4a3c3d7b9 /include | |
parent | e65a355022d0dc6b5707310876a72b5693ec0aa5 (diff) | |
download | binutils-bd94e7cd84c19da4a37dbdbc2d5587db6383f28c.zip binutils-bd94e7cd84c19da4a37dbdbc2d5587db6383f28c.tar.gz binutils-bd94e7cd84c19da4a37dbdbc2d5587db6383f28c.tar.bz2 |
LoongArch: Fix resolution of undefined weak hidden/protected symbols
An undefined weak hidden/protect symbol should be resolved to runtime
address 0, but we were actually resolving it to link-time address 0. So
in PIE or DSO the runtime address would be incorrect.
Fix the issue by rewriting pcalau12i to lu12i.w, and pcaddi to addi.w.
The latter does not always work because the immediate field of addi.w is
narrower, report an error in the case the addend is too large.
Signed-off-by: Xi Ruoyao <xry111@xry111.site>
Diffstat (limited to 'include')
-rw-r--r-- | include/opcode/loongarch.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/opcode/loongarch.h b/include/opcode/loongarch.h index 493fe9b..3579969 100644 --- a/include/opcode/loongarch.h +++ b/include/opcode/loongarch.h @@ -36,6 +36,7 @@ extern "C" #define LARCH_MK_ADDI_D 0xffc00000 #define LARCH_OP_ADDI_D 0x02c00000 + #define LARCH_OP_ADDI_W 0x02800000 #define LARCH_MK_PCADDI 0xfe000000 #define LARCH_OP_PCADDI 0x18000000 #define LARCH_MK_B 0xfc000000 @@ -44,6 +45,7 @@ extern "C" #define LARCH_OP_BL 0x54000000 #define LARCH_MK_ORI 0xffc00000 #define LARCH_OP_ORI 0x03800000 + #define LARCH_OP_OR 0x00150000 #define LARCH_MK_LU12I_W 0xfe000000 #define LARCH_OP_LU12I_W 0x14000000 #define LARCH_MK_LD_D 0xffc00000 |