public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: mengqinggang <mengqinggang@loongson.cn>
To: binutils@sourceware.org
Cc: xuchenghua@loongson.cn, chenglulu@loongson.cn,
	liuzhensong@loongson.cn, cailulu@loongson.cn, xry111@xry111.site,
	i.swmail@xen0n.name, maskray@google.com, luweining@loongson.cn,
	wanglei@loongson.cn, hejinyang@loongson.cn,
	mengqinggang@loongson.cn
Subject: [PATCH] LoongArch: Fix a bug of getting relocation type
Date: Fri, 26 Jan 2024 11:39:32 +0800	[thread overview]
Message-ID: <20240126033932.3577932-1-mengqinggang@loongson.cn> (raw)

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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c
index b2caa5fc3e1..0cc6273726c 100644
--- a/bfd/elfnn-loongarch.c
+++ b/bfd/elfnn-loongarch.c
@@ -4166,7 +4166,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))
 	{
-- 
2.36.0


             reply	other threads:[~2024-01-26  3:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-26  3:39 mengqinggang [this message]
2024-01-26  9:01 ` mengqinggang
2024-01-26 10:55   ` Nick Clifton
2024-01-26 11:02     ` Xi Ruoyao
2024-01-26 11:41       ` Nick Clifton
2024-01-27 13:37       ` Lulu Cai
2024-01-28  4:14         ` lulu Tsai
2024-01-29 11:24           ` Nick Clifton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240126033932.3577932-1-mengqinggang@loongson.cn \
    --to=mengqinggang@loongson.cn \
    --cc=binutils@sourceware.org \
    --cc=cailulu@loongson.cn \
    --cc=chenglulu@loongson.cn \
    --cc=hejinyang@loongson.cn \
    --cc=i.swmail@xen0n.name \
    --cc=liuzhensong@loongson.cn \
    --cc=luweining@loongson.cn \
    --cc=maskray@google.com \
    --cc=wanglei@loongson.cn \
    --cc=xry111@xry111.site \
    --cc=xuchenghua@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).