* elf.c (assign_file_positions_for_segments): Fix case where extra
program headers were allocated.
This commit is contained in:
parent
27fb8f2933
commit
44ef8897da
|
@ -1,5 +1,8 @@
|
||||||
Wed Nov 29 12:42:36 1995 Ian Lance Taylor <ian@cygnus.com>
|
Wed Nov 29 12:42:36 1995 Ian Lance Taylor <ian@cygnus.com>
|
||||||
|
|
||||||
|
* elf.c (assign_file_positions_for_segments): Fix case where extra
|
||||||
|
program headers were allocated.
|
||||||
|
|
||||||
* elf.c (_bfd_elf_print_private_bfd_data): New function.
|
* elf.c (_bfd_elf_print_private_bfd_data): New function.
|
||||||
* elf-bfd.h (_bfd_elf_print_private_bfd_data): Declare.
|
* elf-bfd.h (_bfd_elf_print_private_bfd_data): Declare.
|
||||||
* elfxx-target.h (bfd_elfNN_bfd_print_private_bfd_data): Define to
|
* elfxx-target.h (bfd_elfNN_bfd_print_private_bfd_data): Define to
|
||||||
|
|
13
bfd/elf.c
13
bfd/elf.c
|
@ -1835,13 +1835,15 @@ assign_file_positions_for_segments (abfd)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
asection **secpp;
|
asection **secpp;
|
||||||
boolean adjusted;
|
|
||||||
|
|
||||||
p->p_type = m->p_type;
|
p->p_type = m->p_type;
|
||||||
|
|
||||||
if (m->p_flags_valid)
|
if (m->p_flags_valid)
|
||||||
p->p_flags = m->p_flags;
|
p->p_flags = m->p_flags;
|
||||||
|
|
||||||
|
if (p->p_type == PT_LOAD && m->count > 0)
|
||||||
|
off += (m->sections[0]->vma - off) % bed->maxpagesize;
|
||||||
|
|
||||||
if (m->count == 0)
|
if (m->count == 0)
|
||||||
p->p_vaddr = 0;
|
p->p_vaddr = 0;
|
||||||
else
|
else
|
||||||
|
@ -1864,7 +1866,6 @@ assign_file_positions_for_segments (abfd)
|
||||||
p->p_filesz = 0;
|
p->p_filesz = 0;
|
||||||
p->p_memsz = 0;
|
p->p_memsz = 0;
|
||||||
|
|
||||||
adjusted = false;
|
|
||||||
if (p->p_type == PT_LOAD)
|
if (p->p_type == PT_LOAD)
|
||||||
{
|
{
|
||||||
p->p_offset = off;
|
p->p_offset = off;
|
||||||
|
@ -1890,7 +1891,6 @@ assign_file_positions_for_segments (abfd)
|
||||||
p->p_memsz = off;
|
p->p_memsz = off;
|
||||||
p->p_vaddr -= off;
|
p->p_vaddr -= off;
|
||||||
p->p_paddr -= off;
|
p->p_paddr -= off;
|
||||||
adjusted = true;
|
|
||||||
}
|
}
|
||||||
if (mi->p_type == PT_PHDR)
|
if (mi->p_type == PT_PHDR)
|
||||||
pi_phdr = pi;
|
pi_phdr = pi;
|
||||||
|
@ -1927,14 +1927,11 @@ assign_file_positions_for_segments (abfd)
|
||||||
adjust = (sec->vma - off) % bed->maxpagesize;
|
adjust = (sec->vma - off) % bed->maxpagesize;
|
||||||
if (adjust != 0)
|
if (adjust != 0)
|
||||||
{
|
{
|
||||||
if (i == 0 && ! adjusted)
|
if (i == 0)
|
||||||
p->p_offset += adjust;
|
abort ();
|
||||||
else
|
|
||||||
{
|
|
||||||
p->p_memsz += adjust;
|
p->p_memsz += adjust;
|
||||||
if ((flags & SEC_LOAD) != 0)
|
if ((flags & SEC_LOAD) != 0)
|
||||||
p->p_filesz += adjust;
|
p->p_filesz += adjust;
|
||||||
}
|
|
||||||
off += adjust;
|
off += adjust;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue