aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1996-07-24 16:05:32 +0000
committerIan Lance Taylor <ian@airs.com>1996-07-24 16:05:32 +0000
commit64f808f92bcb3cd2e8083c4b97d09de0b83be2d6 (patch)
treed8f037b58b657104c4112e30618776fe21448533 /bfd
parent687c3cc863866767c4ad108a05a0f2c55e8bd953 (diff)
downloadgdb-64f808f92bcb3cd2e8083c4b97d09de0b83be2d6.zip
gdb-64f808f92bcb3cd2e8083c4b97d09de0b83be2d6.tar.gz
gdb-64f808f92bcb3cd2e8083c4b97d09de0b83be2d6.tar.bz2
* elf.c (assign_file_positions_for_segments): Track the virtual
memory position separately from the file position, and use it to compute the alignment adjustment. PR 10039.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elf.c8
2 files changed, 12 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index ddd2c29..cfa7b40 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+Wed Jul 24 12:02:53 1996 Ian Lance Taylor <ian@cygnus.com>
+
+ * elf.c (assign_file_positions_for_segments): Track the virtual
+ memory position separately from the file position, and use it to
+ compute the alignment adjustment.
+
start-sanitize-d10v
Tue Jul 23 10:43:31 1996 Martin M. Hunt <hunt@pizza.cygnus.com>
diff --git a/bfd/elf.c b/bfd/elf.c
index 32d9e7a..8981800 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -1897,7 +1897,7 @@ assign_file_positions_for_segments (abfd)
struct elf_segment_map *m;
unsigned int alloc;
Elf_Internal_Phdr *phdrs;
- file_ptr off;
+ file_ptr off, voff;
bfd_vma filehdr_vaddr, filehdr_paddr;
bfd_vma phdrs_vaddr, phdrs_paddr;
Elf_Internal_Phdr *p;
@@ -2068,6 +2068,7 @@ assign_file_positions_for_segments (abfd)
}
}
+ voff = off;
for (i = 0, secpp = m->sections; i < m->count; i++, secpp++)
{
asection *sec;
@@ -2085,13 +2086,14 @@ assign_file_positions_for_segments (abfd)
the page size. */
if ((flags & SEC_ALLOC) != 0)
{
- adjust = (sec->vma - off) % bed->maxpagesize;
+ adjust = (sec->vma - voff) % bed->maxpagesize;
if (adjust != 0)
{
if (i == 0)
abort ();
p->p_memsz += adjust;
off += adjust;
+ voff += adjust;
if ((flags & SEC_LOAD) != 0)
p->p_filesz += adjust;
}
@@ -2101,6 +2103,8 @@ assign_file_positions_for_segments (abfd)
if ((flags & SEC_LOAD) != 0)
off += sec->_raw_size;
+ if ((flags & SEC_ALLOC) != 0)
+ voff += sec->_raw_size;
}
p->p_memsz += sec->_raw_size;