aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2013-06-11 19:16:07 +0000
committerDJ Delorie <dj@redhat.com>2013-06-11 19:16:07 +0000
commit34064ff3cd2e23a935087584e5877ec4f1498e85 (patch)
tree3c52d970961b6a2d6a41f612edad3c059e69b4bc
parent030031eed5425623865069a6083de8210c3769df (diff)
downloadgdb-34064ff3cd2e23a935087584e5877ec4f1498e85.zip
gdb-34064ff3cd2e23a935087584e5877ec4f1498e85.tar.gz
gdb-34064ff3cd2e23a935087584e5877ec4f1498e85.tar.bz2
* elf32-rl78.c (rl78_elf_relocate_section): Fix OPsub math.
-rw-r--r--bfd/ChangeLog4
-rw-r--r--bfd/elf32-rl78.c11
2 files changed, 11 insertions, 4 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 192c3ee6..01f050d 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,7 @@
+2013-06-11 DJ Delorie <dj@redhat.com>
+
+ * elf32-rl78.c (rl78_elf_relocate_section): Fix OPsub math.
+
2013-06-11 Will Newton <will.newton@linaro.org>
* elf64-aarch64.c (elf_aarch64_get_local_sym_hash): Use
diff --git a/bfd/elf32-rl78.c b/bfd/elf32-rl78.c
index fb31176..651a8bd 100644
--- a/bfd/elf32-rl78.c
+++ b/bfd/elf32-rl78.c
@@ -810,10 +810,13 @@ rl78_elf_relocate_section
{
int32_t tmp1, tmp2;
- RL78_STACK_POP (tmp2);
- RL78_STACK_POP (tmp1);
- tmp2 -= tmp1;
- RL78_STACK_PUSH (tmp2);
+ /* For the expression "A - B", the assembler pushes A,
+ then B, then OPSUB. So the first op we pop is B, not
+ A. */
+ RL78_STACK_POP (tmp2); /* B */
+ RL78_STACK_POP (tmp1); /* A */
+ tmp1 -= tmp2; /* A - B */
+ RL78_STACK_PUSH (tmp1);
}
break;