]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
LoongArch: Fix a bug of getting relocation type
authormengqinggang <mengqinggang@loongson.cn>
Fri, 26 Jan 2024 03:16:49 +0000 (11:16 +0800)
committerliuzhensong <liuzhensong@loongson.cn>
Fri, 26 Jan 2024 08:49:53 +0000 (16:49 +0800)
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.

bfd/elfnn-loongarch.c

index cf497762b9473e76f343fb5c2af45278150d9b2b..1895699af06837f1ba1852bd245c98cda26ba60d 100644 (file)
@@ -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))
        {