Fixes a problem with the RX port trying to perform linker relaxation when -no-keep...
authorNick Clifton <nickc@redhat.com>
Mon, 16 Mar 2015 11:14:07 +0000 (11:14 +0000)
committerNick Clifton <nickc@redhat.com>
Mon, 16 Mar 2015 11:14:07 +0000 (11:14 +0000)
* 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.

bfd/ChangeLog
bfd/elf32-rx.c

index 06f13b21f4c2e875a240378613df5b526f8c77f0..b24c72dc5d699c24f519ea61d1529123b36ad0d2 100644 (file)
@@ -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
index 5d35d2aad6e45dfae3da83e94c8ce656b9bf3c60..b8c632e2994c91605f48cd2bfd7e619f4e8703d3 100644 (file)
@@ -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
This page took 0.027047 seconds and 4 git commands to generate.