summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2008-09-30 01:16:21 +0000
committerAlan Modra <amodra@bigpond.net.au>2008-09-30 01:16:21 +0000
commitb0660c7421ac750fbe93b9e42e2de44fa3ea8936 (patch)
treeeba72e105f5e0f778874dcae9143f755a10bd15e
parent9b9557bb36707a6b78f3bf18b5e630f2d0d82094 (diff)
downloadgdb-b0660c7421ac750fbe93b9e42e2de44fa3ea8936.tar.gz
bfd/
PR 6789 * elf.c (assign_file_positions_for_load_sections): Call _bfd_elf_map_sections_to_segments, not elf_modify_segment_map. (get_program_header_size): Protect against NULL info. (_bfd_elf_map_sections_to_segments): Likewise. * elf32-spu.c (spu_elf_additional_program_headers): Likewise. ld/testsuite/ * ld-elf/extract-symbol-1sec.d: Correct section lma.
-rw-r--r--bfd/ChangeLog9
-rw-r--r--bfd/elf.c15
-rw-r--r--bfd/elf32-spu.c9
3 files changed, 26 insertions, 7 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index e9a2c3eeda2..57826421036 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,12 @@
+2008-09-30 Alan Modra <amodra@bigpond.net.au>
+
+ PR 6789
+ * elf.c (assign_file_positions_for_load_sections): Call
+ _bfd_elf_map_sections_to_segments, not elf_modify_segment_map.
+ (get_program_header_size): Protect against NULL info.
+ (_bfd_elf_map_sections_to_segments): Likewise.
+ * elf32-spu.c (spu_elf_additional_program_headers): Likewise.
+
2008-09-29 Nick Clifton <nickc@redhat.com>
* po/vi.po: Updated Vietnamese translation.
diff --git a/bfd/elf.c b/bfd/elf.c
index 7f9853e6540..7822c6e99d1 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -3386,7 +3386,7 @@ get_program_header_size (bfd *abfd, struct bfd_link_info *info)
++segs;
}
- if (info->relro)
+ if (info != NULL && info->relro)
{
/* We need a PT_GNU_RELRO segment. */
++segs;
@@ -3768,8 +3768,13 @@ _bfd_elf_map_sections_to_segments (bfd *abfd, struct bfd_link_info *info)
}
/* Allow interested parties a chance to override our decision. */
- if (last_hdr && info->callbacks->override_segment_assignment)
- new_segment = info->callbacks->override_segment_assignment (info, abfd, hdr, last_hdr, new_segment);
+ if (last_hdr != NULL
+ && info != NULL
+ && info->callbacks->override_segment_assignment != NULL)
+ new_segment
+ = info->callbacks->override_segment_assignment (info, abfd, hdr,
+ last_hdr,
+ new_segment);
if (! new_segment)
{
@@ -3944,7 +3949,7 @@ _bfd_elf_map_sections_to_segments (bfd *abfd, struct bfd_link_info *info)
pm = &m->next;
}
- if (info->relro)
+ if (info != NULL && info->relro)
{
for (m = mfirst; m != NULL; m = m->next)
{
@@ -4128,7 +4133,7 @@ assign_file_positions_for_load_sections (bfd *abfd,
unsigned int i, j;
if (link_info == NULL
- && !elf_modify_segment_map (abfd, link_info, FALSE))
+ && !_bfd_elf_map_sections_to_segments (abfd, link_info))
return FALSE;
alloc = 0;
diff --git a/bfd/elf32-spu.c b/bfd/elf32-spu.c
index 17ff079c0cc..00681b2b5b9 100644
--- a/bfd/elf32-spu.c
+++ b/bfd/elf32-spu.c
@@ -4245,10 +4245,15 @@ spu_elf_post_process_headers (bfd *abfd,
static int
spu_elf_additional_program_headers (bfd *abfd, struct bfd_link_info *info)
{
- struct spu_link_hash_table *htab = spu_hash_table (info);
- int extra = htab->num_overlays;
+ int extra = 0;
asection *sec;
+ if (info != NULL)
+ {
+ struct spu_link_hash_table *htab = spu_hash_table (info);
+ extra = htab->num_overlays;
+ }
+
if (extra)
++extra;