aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2008-09-29 14:12:02 +0000
committerAlan Modra <amodra@gmail.com>2008-09-29 14:12:02 +0000
commitceae84aacf0d5459a74fd5496cd2c0d6708e052a (patch)
tree58aa23fa1daf3894218aa395c3f815b3776d4b4c /bfd/elf.c
parentb8a4873487ea15d1873dfaf0cb1a724a3b5fec95 (diff)
downloadgdb-ceae84aacf0d5459a74fd5496cd2c0d6708e052a.zip
gdb-ceae84aacf0d5459a74fd5496cd2c0d6708e052a.tar.gz
gdb-ceae84aacf0d5459a74fd5496cd2c0d6708e052a.tar.bz2
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.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r--bfd/elf.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/bfd/elf.c b/bfd/elf.c
index e8c6c23..763750b 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -3380,7 +3380,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;
@@ -3762,8 +3762,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)
{
@@ -3938,7 +3943,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)
{
@@ -4122,7 +4127,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;