diff options
author | DJ Delorie <dj@delorie.com> | 2013-04-02 23:29:50 +0000 |
---|---|---|
committer | DJ Delorie <dj@delorie.com> | 2013-04-02 23:29:50 +0000 |
commit | b6b649f54f275277209a2c0a12dc38c9a40d8c19 (patch) | |
tree | 930f4096e4b8f25b1db685cd63b0a9b7afbbaf51 /bfd/elf32-rl78.c | |
parent | 4ec5620d6d3262cc0fd1f1c706b85e6da46a9703 (diff) | |
download | binutils-redhat-b6b649f54f275277209a2c0a12dc38c9a40d8c19.tar.gz |
* elf32-rl78.c (GET_RELOC): Assert that there are relocs to get.
(rl78_elf_relax_section): Only fetch the next reloc if there is
one expected.
Diffstat (limited to 'bfd/elf32-rl78.c')
-rw-r--r-- | bfd/elf32-rl78.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/bfd/elf32-rl78.c b/bfd/elf32-rl78.c index 2130311059..11d1ecc745 100644 --- a/bfd/elf32-rl78.c +++ b/bfd/elf32-rl78.c @@ -2193,6 +2193,7 @@ rl78_elf_relax_section + srel->r_offset; #define GET_RELOC \ + BFD_ASSERT (nrelocs > 0); \ symval = OFFSET_FOR_RELOC (srel, &srel, &scale); \ pcrel = symval - pc + srel->r_addend; \ nrelocs --; @@ -2233,7 +2234,13 @@ rl78_elf_relax_section if (irel->r_addend & RL78_RELAXA_BRA) { - GET_RELOC; + /* SKIP opcodes that skip non-branches will have a relax tag + but no corresponding symbol to relax against; we just + skip those. */ + if (irel->r_addend & RL78_RELAXA_RNUM) + { + GET_RELOC; + } switch (insn[0]) { @@ -2302,6 +2309,9 @@ rl78_elf_relax_section /* For SKIP/BR, we change the BR opcode and delete the SKIP. That way, we don't have to find and change the relocation for the BR. */ + /* Note that, for the case where we're skipping some + other insn, we have no "other" reloc but that's safe + here anyway. */ switch (insn[1]) { case 0xc8: /* SKC */ |