diff options
author | Nick Clifton <nickc@redhat.com> | 2015-03-16 11:14:07 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2015-03-16 11:14:07 +0000 |
commit | 9c761a554184c2ded303c4929a7023b972b2fb9f (patch) | |
tree | 33d2b793b291b5f777f0d8dfbe85875b45470f3e /bfd | |
parent | ba14f9419d59571057d9675673bbf8b6032aa5fe (diff) | |
download | gdb-9c761a554184c2ded303c4929a7023b972b2fb9f.zip gdb-9c761a554184c2ded303c4929a7023b972b2fb9f.tar.gz gdb-9c761a554184c2ded303c4929a7023b972b2fb9f.tar.bz2 |
Fixes a problem with the RX port trying to perform linker relaxation when -no-keep-memory has been enabled.
* elf32-rx.c (elf32_rx_relax_delete_bytes): If the relocs are not
stored in the elf_section_data structure then load them as
necessary.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 6 | ||||
-rw-r--r-- | bfd/elf32-rx.c | 14 |
2 files changed, 19 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 06f13b2..b24c72d 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2015-03-16 Nick Clifton <nickc@redhat.com> + + * elf32-rx.c (elf32_rx_relax_delete_bytes): If the relocs are not + stored in the elf_section_data structure then load them as + necessary. + 2015-03-14 Andreas Krebbel <krebbel@linux.vnet.ibm.com> * elf-s390-common.c (elf_s390_elf_sort_relocs_p): Don't sort diff --git a/bfd/elf32-rx.c b/bfd/elf32-rx.c index 5d35d2a..b8c632e 100644 --- a/bfd/elf32-rx.c +++ b/bfd/elf32-rx.c @@ -1561,6 +1561,18 @@ elf32_rx_relax_delete_bytes (bfd *abfd, asection *sec, bfd_vma addr, int count, irel = elf_section_data (sec)->relocs; irelend = irel + sec->reloc_count; + if (irel == NULL && sec->reloc_count > 0) + { + /* If the relocs have not been kept in the section data + structure (because -no-keep-memory was used) then + reread them now. */ + irel = (_bfd_elf_link_read_relocs + (abfd, sec, NULL, (Elf_Internal_Rela *) NULL, FALSE)); + if (irel == NULL) + /* FIXME: Return FALSE instead ? */ + irelend = irel; + } + /* Actually delete the bytes. */ memmove (contents + addr, contents + addr + count, (size_t) (toaddr - addr - count)); @@ -1574,7 +1586,7 @@ elf32_rx_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 < irelend; irel++) { /* Get the new reloc address. */ if (irel->r_offset > addr |