public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v1 1/1] bfd: microblaze: Fix bug in TLSTPREL Relocation
@ 2023-09-27 12:49 Neal Frager
  2023-09-27 15:24 ` Nick Clifton
  0 siblings, 1 reply; 3+ messages in thread
From: Neal Frager @ 2023-09-27 12:49 UTC (permalink / raw)
  To: binutils
  Cc: ibai.erkiaga-elorza, nagaraju.mekala, mark.hatle,
	sadanand.mutyala, appa.rao.nali, vidhumouli.hunsigida,
	luca.ceresoli, Neal Frager

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>
---
 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:
-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1 1/1] bfd: microblaze: Fix bug in TLSTPREL Relocation
  2023-09-27 12:49 [PATCH v1 1/1] bfd: microblaze: Fix bug in TLSTPREL Relocation Neal Frager
@ 2023-09-27 15:24 ` Nick Clifton
  2023-09-29 15:36   ` Michael Eager
  0 siblings, 1 reply; 3+ messages in thread
From: Nick Clifton @ 2023-09-27 15:24 UTC (permalink / raw)
  To: Neal Frager, binutils
  Cc: ibai.erkiaga-elorza, nagaraju.mekala, mark.hatle,
	sadanand.mutyala, appa.rao.nali, vidhumouli.hunsigida,
	luca.ceresoli

Hi Neal,

> 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>
> ---
>   bfd/elf32-microblaze.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)

Patch approved, please apply.

Cheers
   Nick



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1 1/1] bfd: microblaze: Fix bug in TLSTPREL Relocation
  2023-09-27 15:24 ` Nick Clifton
@ 2023-09-29 15:36   ` Michael Eager
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Eager @ 2023-09-29 15:36 UTC (permalink / raw)
  To: Nick Clifton, Neal Frager, binutils
  Cc: ibai.erkiaga-elorza, nagaraju.mekala, mark.hatle,
	sadanand.mutyala, appa.rao.nali, vidhumouli.hunsigida,
	luca.ceresoli

On 9/27/23 08:24, Nick Clifton via Binutils wrote:
> Hi Neal,
> 
>> 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>
>> ---
>>   bfd/elf32-microblaze.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> Patch approved, please apply.
> 
> Cheers
>    Nick

Committed.

-- 
Michael Eager


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-09-29 15:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-27 12:49 [PATCH v1 1/1] bfd: microblaze: Fix bug in TLSTPREL Relocation Neal Frager
2023-09-27 15:24 ` Nick Clifton
2023-09-29 15:36   ` Michael Eager

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).