aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2011-02-15 04:07:43 +0000
committerAlan Modra <amodra@gmail.com>2011-02-15 04:07:43 +0000
commit28be611cf8f68185d47271a242db07f87c7f17af (patch)
tree35991363e0cb8f2a4a3cee2ce74c88031159a812 /bfd
parentad9bb468ae3cb706c4fa5517387a50fa7f22d044 (diff)
downloadgdb-28be611cf8f68185d47271a242db07f87c7f17af.zip
gdb-28be611cf8f68185d47271a242db07f87c7f17af.tar.gz
gdb-28be611cf8f68185d47271a242db07f87c7f17af.tar.bz2
* elf64-ppc.c (ppc64_elf_edit_toc): Reinstate second read of
toc relocs. Fuss over free(NULL).
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elf64-ppc.c9
2 files changed, 13 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 2f54729..4c73dee 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2011-02-15 Alan Modra <amodra@gmail.com>
+
+ * elf64-ppc.c (ppc64_elf_edit_toc): Reinstate second read of
+ toc relocs. Fuss over free(NULL).
+
2011-02-14 Mike Frysinger <vapier@gentoo.org>
* elflink.c (bfd_elf_size_dynamic_sections): Add
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 25d0d2e..856c68a 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -8424,6 +8424,12 @@ ppc64_elf_edit_toc (struct bfd_link_info *info)
bfd_size_type sz;
/* Remove unused toc relocs, and adjust those we keep. */
+ if (toc_relocs == NULL)
+ toc_relocs = _bfd_elf_link_read_relocs (ibfd, toc, NULL, NULL,
+ info->keep_memory);
+ if (toc_relocs == NULL)
+ goto error_ret;
+
wrel = toc_relocs;
for (rel = toc_relocs; rel < toc_relocs + toc->reloc_count; ++rel)
if ((skip[rel->r_offset >> 3]
@@ -8445,7 +8451,8 @@ ppc64_elf_edit_toc (struct bfd_link_info *info)
rel_hdr->sh_size = toc->reloc_count * sz;
}
}
- else if (elf_section_data (toc)->relocs != toc_relocs)
+ else if (toc_relocs != NULL
+ && elf_section_data (toc)->relocs != toc_relocs)
free (toc_relocs);
if (local_syms != NULL