PR 3609
authorNick Clifton <nickc@redhat.com>
Fri, 1 Dec 2006 12:28:18 +0000 (12:28 +0000)
committerNick Clifton <nickc@redhat.com>
Fri, 1 Dec 2006 12:28:18 +0000 (12:28 +0000)
* elf.c (rewrite_elf_program_header): Do not use the first_section pointer if it is null.

bfd/ChangeLog
bfd/elf.c

index d68e8765c4a0d27dc5cfca06d5e00b2009e1fd85..614deff0d252801ecd13a8632a0d85546cdc20d4 100644 (file)
@@ -1,3 +1,9 @@
+2006-12-01  Nick Clifton  <nickc@redhat.com>
+
+       PR 3609
+       * elf.c (rewrite_elf_program_header): Do not use the first_section
+       pointer if it is null.
+
 2006-11-29  Paul Brook  <paul@codesourcery.com>
 
        * elf32-arm.c (elf32_arm_to_thumb_export_stub): Assert that output
index e4f4a95ffabd0b724d602ec00f57a32a804f528b..3126fe6e21891e80022b8ef7dca1d9381545e0d9 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -5427,10 +5427,11 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd)
       map->p_type        = segment->p_type;
       map->p_flags       = segment->p_flags;
       map->p_flags_valid = 1;
+
       /* If the first section in the input segment is removed, there is
         no need to preserve segment physical address in the corresponding
         output segment.  */
-      if (first_section->output_section != NULL)
+      if (first_section != NULL && first_section->output_section != NULL)
        {
          map->p_paddr = segment->p_paddr;
          map->p_paddr_valid = 1;