objcopy/strip ELF program header p_vaddr confusion
[deliverable/binutils-gdb.git] / bfd / elf.c
index ce7878c18ff2a80a1a5f389650936ec278a5cfe5..3ded683efe45035b58c0f1bce95c4da03f030c37 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -6259,7 +6259,7 @@ copy_elf_program_header (bfd *ibfd, bfd *obfd)
            phdr_included = TRUE;
        }
 
-      lowest_section = first_section;
+      lowest_section = NULL;
       if (section_count != 0)
        {
          unsigned int isec = 0;
@@ -6276,7 +6276,8 @@ copy_elf_program_header (bfd *ibfd, bfd *obfd)
                    {
                      bfd_vma seg_off;
 
-                     if (section->lma < lowest_section->lma)
+                     if (lowest_section == NULL
+                         || section->lma < lowest_section->lma)
                        lowest_section = section;
 
                      /* Section lmas are set up from PT_LOAD header
This page took 0.025155 seconds and 4 git commands to generate.