* elf.c (assign_file_positions_for_segments): Don't increment file
authorIan Lance Taylor <ian@airs.com>
Tue, 16 Jan 1996 20:53:04 +0000 (20:53 +0000)
committerIan Lance Taylor <ian@airs.com>
Tue, 16 Jan 1996 20:53:04 +0000 (20:53 +0000)
offset for a segment which contains no loadable sections.

bfd/ChangeLog
bfd/elf.c

index 50efd81a4fe91583e7c5de1825f7342667994ff3..13a889a3a3cc81fa828bb032dadf78a7557359e0 100644 (file)
@@ -1,3 +1,8 @@
+Tue Jan 16 15:10:49 1996  Ian Lance Taylor  <ian@cygnus.com>
+
+       * elf.c (assign_file_positions_for_segments): Don't increment file
+       offset for a segment which contains no loadable sections.
+
 Mon Jan 15 17:46:27 1996  Michael Meissner  <meissner@tiktok.cygnus.com>
 
        * reloc.c: Add new PowerPC relocations.
index 48762e16edd2b634810cfc958489264e01597087..e12a885c5ee8cbffddd9ad0f7984f1669fa66c54 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -1911,7 +1911,9 @@ assign_file_positions_for_segments (abfd)
       else
        p->p_flags = 0;
 
-      if (p->p_type == PT_LOAD && m->count > 0)
+      if (p->p_type == PT_LOAD
+         && m->count > 0
+         && (m->sections[0]->flags & SEC_LOAD) != 0)
        off += (m->sections[0]->vma - off) % bed->maxpagesize;
 
       if (m->count == 0)
@@ -2019,15 +2021,18 @@ assign_file_positions_for_segments (abfd)
 
              /* The section VMA must equal the file position modulo
                  the page size.  */
-             adjust = (sec->vma - off) % bed->maxpagesize;
-             if (adjust != 0)
+             if ((flags & SEC_LOAD) != 0)
                {
-                 if (i == 0)
-                   abort ();
-                 p->p_memsz += adjust;
-                 if ((flags & SEC_LOAD) != 0)
-                   p->p_filesz += adjust;
-                 off += adjust;
+                 adjust = (sec->vma - off) % bed->maxpagesize;
+                 if (adjust != 0)
+                   {
+                     if (i == 0)
+                       abort ();
+                     p->p_memsz += adjust;
+                     if ((flags & SEC_LOAD) != 0)
+                       p->p_filesz += adjust;
+                     off += adjust;
+                   }
                }
 
              sec->filepos = off;