aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQBos07 <qubos@outlook.de>2025-05-09 13:49:44 +0000
committerAlan Modra <amodra@gmail.com>2025-05-23 08:57:50 +0930
commit6cd9586f7f502d9034751df1b88b1ae91a34a8b6 (patch)
treecdaf329f07a9b9e29db37fefbf720b51c41cec2b
parent689f3edfb8fb7fbe5432bfdba9f79347a6649dbf (diff)
downloadbinutils-6cd9586f7f502d9034751df1b88b1ae91a34a8b6.zip
binutils-6cd9586f7f502d9034751df1b88b1ae91a34a8b6.tar.gz
binutils-6cd9586f7f502d9034751df1b88b1ae91a34a8b6.tar.bz2
PR 3298 Fix SuperH relaxation overriding wrong intruction
when doing load store switching it wrongly adjusts the address of the R_SH_USES reloc and not the actual offset from that instruction. This is an issue if the pc-relative function call relaxation gets done in a later pass wich will result in overriding the wrong instruction.
-rw-r--r--bfd/elf32-sh.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c
index 39a837c..abb7f5e 100644
--- a/bfd/elf32-sh.c
+++ b/bfd/elf32-sh.c
@@ -1429,9 +1429,9 @@ sh_elf_swap_insns (bfd *abfd, asection *sec, void *relocs,
off = irel->r_offset + 4 + irel->r_addend;
if (off == addr)
- irel->r_offset += 2;
+ irel->r_addend += 2;
else if (off == addr + 2)
- irel->r_offset -= 2;
+ irel->r_addend -= 2;
}
if (irel->r_offset == addr)