aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1996-01-16 20:53:04 +0000
committerIan Lance Taylor <ian@airs.com>1996-01-16 20:53:04 +0000
commitd49ddb857525c555f314c6ee4b0589002067d707 (patch)
treec066a37b5feb0eb3f222c31b9eb670b2dd86910d /bfd/elf.c
parenta411bea0231c469d2f43ccf74741b987fbbded35 (diff)
downloadgdb-d49ddb857525c555f314c6ee4b0589002067d707.zip
gdb-d49ddb857525c555f314c6ee4b0589002067d707.tar.gz
gdb-d49ddb857525c555f314c6ee4b0589002067d707.tar.bz2
* elf.c (assign_file_positions_for_segments): Don't increment file
offset for a segment which contains no loadable sections.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r--bfd/elf.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/bfd/elf.c b/bfd/elf.c
index 48762e1..e12a885 100644
--- 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;