aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2013-11-05 22:13:04 -0500
committerDJ Delorie <dj@redhat.com>2013-11-05 22:13:04 -0500
commit2bc56d66132a8d4a06520b0531b8708108197c9b (patch)
treeaabd6d9bc031af520e882af922a4241ae6cb74f9 /bfd
parenta5b5d5ae56990bfe06a77d4de82ed359669a2db2 (diff)
downloadfsf-binutils-gdb-2bc56d66132a8d4a06520b0531b8708108197c9b.zip
fsf-binutils-gdb-2bc56d66132a8d4a06520b0531b8708108197c9b.tar.gz
fsf-binutils-gdb-2bc56d66132a8d4a06520b0531b8708108197c9b.tar.bz2
* elf32-rl78.c (elf32_rl78_relax_delete_bytes): Make sure relocs
are loaded before trying to use them.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elf32-rl78.c8
2 files changed, 12 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 8065193..948afda 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2013-11-05 DJ Delorie <dj@redhat.com>
+
+ * elf32-rl78.c (elf32_rl78_relax_delete_bytes): Make sure relocs
+ are loaded before trying to use them.
+
2013-11-05 H.J. Lu <hongjiu.lu@intel.com>
Bernhard Rosenkränzer <bernhard.rosenkranzer@linaro.org>
diff --git a/bfd/elf32-rl78.c b/bfd/elf32-rl78.c
index 9060663..5bdef67 100644
--- a/bfd/elf32-rl78.c
+++ b/bfd/elf32-rl78.c
@@ -1481,6 +1481,12 @@ elf32_rl78_relax_delete_bytes (bfd *abfd, asection *sec, bfd_vma addr, int count
toaddr = alignment_rel->r_offset;
irel = elf_section_data (sec)->relocs;
+ if (irel == NULL)
+ {
+ _bfd_elf_link_read_relocs (sec->owner, sec, NULL, NULL, TRUE);
+ irel = elf_section_data (sec)->relocs;
+ }
+
irelend = irel + sec->reloc_count;
/* Actually delete the bytes. */
@@ -1496,7 +1502,7 @@ elf32_rl78_relax_delete_bytes (bfd *abfd, asection *sec, bfd_vma addr, int count
memset (contents + toaddr - count, 0x03, count);
/* Adjust all the relocs. */
- for (irel = elf_section_data (sec)->relocs; irel < irelend; irel++)
+ for (; irel && irel < irelend; irel++)
{
/* Get the new reloc address. */
if (irel->r_offset > addr