[binutils-gdb] LoongArch: Fix a bug of getting relocation type
liu & zhensong
liuzhensong@sourceware.org
Fri Jan 26 08:53:13 GMT 2024
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=cd35c9fd1e67b2dd8acbda3dfa398e395b22f220
commit cd35c9fd1e67b2dd8acbda3dfa398e395b22f220
Author: mengqinggang <mengqinggang@loongson.cn>
Date: Fri Jan 26 11:16:49 2024 +0800
LoongArch: Fix a bug of getting relocation type
The old code works because R_LARCH_RELAX has no symbol index. It causes
'(rel + 1)->r_info == R_LARCH_RELAX' is 1 and ELFNN_R_TYPE (1) is 1.
Diff:
---
bfd/elfnn-loongarch.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c
index cf497762b94..1895699af06 100644
--- a/bfd/elfnn-loongarch.c
+++ b/bfd/elfnn-loongarch.c
@@ -4165,7 +4165,7 @@ loongarch_relax_tls_le (bfd *abfd, asection *sec,
static uint32_t insn_rj,insn_rd;
symval = symval - elf_hash_table (link_info)->tls_sec->vma;
/* Whether the symbol offset is in the interval (offset < 0x800). */
- if (ELFNN_R_TYPE ((rel + 1)->r_info == R_LARCH_RELAX) && (symval < 0x800))
+ if (ELFNN_R_TYPE ((rel + 1)->r_info) == R_LARCH_RELAX && (symval < 0x800))
{
switch (ELFNN_R_TYPE (rel->r_info))
{
More information about the Binutils-cvs
mailing list