diff options
author | DJ Delorie <dj@delorie.com> | 2013-06-11 19:16:07 +0000 |
---|---|---|
committer | DJ Delorie <dj@delorie.com> | 2013-06-11 19:16:07 +0000 |
commit | 74ffac1c695b3c22a35d35e6fb5c978241858060 (patch) | |
tree | e0bcaabe2ece79e17a179359dbcc42c4bc69610c /bfd/elf32-rl78.c | |
parent | 46eccd043382e0be9b87577acf0c190c091ef070 (diff) | |
download | binutils-redhat-74ffac1c695b3c22a35d35e6fb5c978241858060.tar.gz |
* elf32-rl78.c (rl78_elf_relocate_section): Fix OPsub math.
Diffstat (limited to 'bfd/elf32-rl78.c')
-rw-r--r-- | bfd/elf32-rl78.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/bfd/elf32-rl78.c b/bfd/elf32-rl78.c index fb31176da0..651a8bdce6 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; |