public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
From: Michael Eager <eager@sourceware.org>
To: bfd-cvs@sourceware.org
Subject: [binutils-gdb] bfd: microblaze: Fix bug in TLSTPREL Relocation
Date: Fri, 29 Sep 2023 15:44:36 +0000 (GMT)	[thread overview]
Message-ID: <20230929154436.3529F3858C78@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=54fd15eef722f56383a5a3a978219e11d3d0be15

commit 54fd15eef722f56383a5a3a978219e11d3d0be15
Author: Neal Frager <neal.frager@amd.com>
Date:   Wed Sep 27 13:49:18 2023 +0100

    bfd: microblaze: Fix bug in TLSTPREL Relocation
    
    Fixed the problem related to the fixup/relocations TLSTPREL.
    When the fixup is applied the addend is not added at the correct offset
    of the instruction. The offset is hard coded considering its big endian
    and it fails for Little endian. This patch allows support for both
    big & little-endian compilers.
    
    This patch has been tested for years of AMD Xilinx Yocto
    releases as part of the following patch set:
    
    https://github.com/Xilinx/meta-xilinx/tree/master/meta-microblaze/recipes-devtools/binutils/binutils
    
    Signed-off-by: nagaraju <nagaraju.mekala@amd.com>
    Signed-off-by: Neal Frager <neal.frager@amd.com>

Diff:
---
 bfd/elf32-microblaze.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
index bbc70fdf4e3..a7e81c70fc8 100644
--- a/bfd/elf32-microblaze.c
+++ b/bfd/elf32-microblaze.c
@@ -1467,9 +1467,9 @@ microblaze_elf_relocate_section (bfd *output_bfd,
 	      relocation += addend;
 	      relocation -= dtprel_base(info);
 	      bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
-			  contents + offset + 2);
+			  contents + offset + endian);
 	      bfd_put_16 (input_bfd, relocation & 0xffff,
-			  contents + offset + 2 + INST_WORD_SIZE);
+			  contents + offset + endian + INST_WORD_SIZE);
 	      break;
 	    case (int) R_MICROBLAZE_TEXTREL_64:
 	    case (int) R_MICROBLAZE_TEXTREL_32_LO:

                 reply	other threads:[~2023-09-29 15:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20230929154436.3529F3858C78@sourceware.org \
    --to=eager@sourceware.org \
    --cc=bfd-cvs@sourceware.org \
    /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).