Fix the bss outside of PT_LOAD problem. (for non-paged executables,

the wrong variable (voff) was being substracted instead of the end
of the previous section.  therefore the alignment calculations were
all wrong for .bss (which for sparc is aligned 2**8)).
This commit is contained in:
matt 1999-07-30 00:39:11 +00:00
parent 76dcbfad36
commit 944fb04a2e
1 changed files with 8 additions and 4 deletions

12
gnu/dist/bfd/elf.c vendored
View File

@ -2611,7 +2611,9 @@ assign_file_positions_for_segments (abfd)
if ((abfd->flags & D_PAGED) != 0)
adjust = (sec->vma - voff) % bed->maxpagesize;
else
adjust = (sec->vma - voff) % align;
{
adjust = (sec->vma - (p->p_paddr + p->p_memsz)) % align;
}
}
else
adjust = 0;
@ -2620,11 +2622,13 @@ assign_file_positions_for_segments (abfd)
{
if (i == 0)
abort ();
p->p_memsz += adjust;
off += adjust;
voff += adjust;
p->p_memsz += adjust;
if ((flags & SEC_LOAD) != 0)
p->p_filesz += adjust;
{
off += adjust;
p->p_filesz += adjust;
}
}
sec->filepos = off;