[binutils-gdb] Wrong operand for SADDR (rl78)

Nick Clifton nickc@sourceware.org
Mon Feb 1 16:45:37 GMT 2021


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

commit 34c10233cd204fe5ccafde590294fe20978cb7fa
Author: Egor Vishnyakov <lenvampir@yandex.ru>
Date:   Mon Feb 1 16:44:32 2021 +0000

    Wrong operand for SADDR (rl78)
    
            PR 27254
            * elf32-rl78.c (rl78_elf_relocate_section): Fix calculation of
            offset for the R_RL78_RH_SADDR relocation.

Diff:
---
 bfd/ChangeLog    | 6 ++++++
 bfd/elf32-rl78.c | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 1eebae0404d..3aaf9f81ce8 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2021-02-01  Egor Vishnyakov  <lenvampir@yandex.ru>
+
+	PR 27254
+	* elf32-rl78.c (rl78_elf_relocate_section): Fix calculation of
+	offset for the R_RL78_RH_SADDR relocation.
+
 2021-01-29  Alan Modra  <amodra@gmail.com>
 
 	PR 27271
diff --git a/bfd/elf32-rl78.c b/bfd/elf32-rl78.c
index a3c697550de..a88db133725 100644
--- a/bfd/elf32-rl78.c
+++ b/bfd/elf32-rl78.c
@@ -923,7 +923,7 @@ rl78_elf_relocate_section
 
 	case R_RL78_RH_SADDR:
 	  RANGE (0xffe20, 0xfff1f);
-	  OP (0) = relocation & 0xff;
+	  OP (0) = (relocation - 0x20) & 0xff;
 	  break;
 
 	  /* Complex reloc handling:  */


More information about the Binutils-cvs mailing list