GNU Binutils with patches for OS216
修订版 | 2bc56d66132a8d4a06520b0531b8708108197c9b (tree) |
---|---|
时间 | 2013-11-06 12:13:04 |
作者 | DJ Delorie <dj@redh...> |
Commiter | DJ Delorie |
* elf32-rl78.c (elf32_rl78_relax_delete_bytes): Make sure relocs
are loaded before trying to use them.
@@ -1,3 +1,8 @@ | ||
1 | +2013-11-05 DJ Delorie <dj@redhat.com> | |
2 | + | |
3 | + * elf32-rl78.c (elf32_rl78_relax_delete_bytes): Make sure relocs | |
4 | + are loaded before trying to use them. | |
5 | + | |
1 | 6 | 2013-11-05 H.J. Lu <hongjiu.lu@intel.com> |
2 | 7 | Bernhard Rosenkränzer <bernhard.rosenkranzer@linaro.org> |
3 | 8 |
@@ -1481,6 +1481,12 @@ elf32_rl78_relax_delete_bytes (bfd *abfd, asection *sec, bfd_vma addr, int count | ||
1481 | 1481 | toaddr = alignment_rel->r_offset; |
1482 | 1482 | |
1483 | 1483 | irel = elf_section_data (sec)->relocs; |
1484 | + if (irel == NULL) | |
1485 | + { | |
1486 | + _bfd_elf_link_read_relocs (sec->owner, sec, NULL, NULL, TRUE); | |
1487 | + irel = elf_section_data (sec)->relocs; | |
1488 | + } | |
1489 | + | |
1484 | 1490 | irelend = irel + sec->reloc_count; |
1485 | 1491 | |
1486 | 1492 | /* Actually delete the bytes. */ |
@@ -1496,7 +1502,7 @@ elf32_rl78_relax_delete_bytes (bfd *abfd, asection *sec, bfd_vma addr, int count | ||
1496 | 1502 | memset (contents + toaddr - count, 0x03, count); |
1497 | 1503 | |
1498 | 1504 | /* Adjust all the relocs. */ |
1499 | - for (irel = elf_section_data (sec)->relocs; irel < irelend; irel++) | |
1505 | + for (; irel && irel < irelend; irel++) | |
1500 | 1506 | { |
1501 | 1507 | /* Get the new reloc address. */ |
1502 | 1508 | if (irel->r_offset > addr |