diff options
author | Alan Modra <amodra@gmail.com> | 2005-05-19 06:51:01 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2005-05-19 06:51:01 +0000 |
commit | a49e53ed184b89cc31ae70d7db62e485ad6044d1 (patch) | |
tree | 3e25ddb700eee02643b859c7a7068968f7650570 | |
parent | 4600db4835639751fda271513fa57e375e334e5e (diff) | |
download | gdb-a49e53ed184b89cc31ae70d7db62e485ad6044d1.zip gdb-a49e53ed184b89cc31ae70d7db62e485ad6044d1.tar.gz gdb-a49e53ed184b89cc31ae70d7db62e485ad6044d1.tar.bz2 |
* elf.c (assign_file_positions_for_segments): Use maximum of
maxpagesize and section alignment when adjusting initial
segment offset and section offsets.
-rw-r--r-- | bfd/ChangeLog | 6 | ||||
-rw-r--r-- | bfd/elf.c | 24 |
2 files changed, 17 insertions, 13 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 637d162..7998a65 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2005-05-19 Alan Modra <amodra@bigpond.net.au> + + * elf.c (assign_file_positions_for_segments): Use maximum of + maxpagesize and section alignment when adjusting initial + segment offset and section offsets. + 2005-05-18 Zack Weinberg <zack@codesourcery.com> * elf32-arm.c: Make all #ifndef OLD_ARM_ABI blocks @@ -4151,22 +4151,20 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info) { bfd_size_type align; bfd_vma adjust; + unsigned int align_power = 0; - if ((abfd->flags & D_PAGED) != 0) - align = bed->maxpagesize; - else + for (i = 0, secpp = m->sections; i < m->count; i++, secpp++) { - unsigned int align_power = 0; - for (i = 0, secpp = m->sections; i < m->count; i++, secpp++) - { - unsigned int secalign; + unsigned int secalign; - secalign = bfd_get_section_alignment (abfd, *secpp); - if (secalign > align_power) - align_power = secalign; - } - align = (bfd_size_type) 1 << align_power; + secalign = bfd_get_section_alignment (abfd, *secpp); + if (secalign > align_power) + align_power = secalign; } + align = (bfd_size_type) 1 << align_power; + + if ((abfd->flags & D_PAGED) != 0 && bed->maxpagesize > align) + align = bed->maxpagesize; adjust = vma_page_aligned_bias (m->sections[0]->vma, off, align); off += adjust; @@ -4352,7 +4350,7 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info) /* The section VMA must equal the file position modulo the page size. */ bfd_size_type page = align; - if ((abfd->flags & D_PAGED) != 0) + if ((abfd->flags & D_PAGED) != 0 && bed->maxpagesize > page) page = bed->maxpagesize; adjust = vma_page_aligned_bias (sec->vma, p->p_vaddr + p->p_memsz, |