diff options
author | Alan Modra <amodra@gmail.com> | 2007-06-29 01:21:08 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2007-06-29 01:21:08 +0000 |
commit | 6a3cd2b4ed1653d84463fadb1bef8783dba92b1a (patch) | |
tree | 9b83fef0f3d17663d3b0bf1f0038075ac8c0a60f /bfd | |
parent | bf988460f1ac19b0e7add220132af27241bd9cef (diff) | |
download | gdb-6a3cd2b4ed1653d84463fadb1bef8783dba92b1a.zip gdb-6a3cd2b4ed1653d84463fadb1bef8783dba92b1a.tar.gz gdb-6a3cd2b4ed1653d84463fadb1bef8783dba92b1a.tar.bz2 |
* elf.c (assign_file_positions_for_load_sections): Use elf
section header sh_size rather than bfd section size, simplifying
.tbss handling.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 6 | ||||
-rw-r--r-- | bfd/elf.c | 32 |
2 files changed, 19 insertions, 19 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 3778220..a4e166d 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,11 @@ 2007-06-29 Alan Modra <amodra@bigpond.net.au> + * elf.c (assign_file_positions_for_load_sections): Use elf + section header sh_size rather than bfd section size, simplifying + .tbss handling. + +2007-06-29 Alan Modra <amodra@bigpond.net.au> + * elf.c (assign_file_positions_for_load_sections): Ensure bss segments meet gABI alignment requirements. Don't allocate file space for bss sections in a segment also containing file @@ -4578,8 +4578,8 @@ assign_file_positions_for_load_sections (bfd *abfd, if (i == 0) { this_hdr->sh_offset = sec->filepos = off; - off += sec->size; - p->p_filesz = sec->size; + off += this_hdr->sh_size; + p->p_filesz = this_hdr->sh_size; p->p_memsz = 0; p->p_align = 1; } @@ -4598,33 +4598,27 @@ assign_file_positions_for_load_sections (bfd *abfd, { this_hdr->sh_offset = sec->filepos = off; if (this_hdr->sh_type != SHT_NOBITS) - off += sec->size; + off += this_hdr->sh_size; } if (this_hdr->sh_type != SHT_NOBITS) { - p->p_filesz += sec->size; + p->p_filesz += this_hdr->sh_size; /* A load section without SHF_ALLOC is something like a note section in a PT_NOTE segment. These take file space but are not loaded into memory. */ if ((this_hdr->sh_flags & SHF_ALLOC) != 0) - p->p_memsz += sec->size; + p->p_memsz += this_hdr->sh_size; } - - /* .tbss is special. It doesn't contribute to p_memsz of - normal segments. */ - else if ((this_hdr->sh_flags & SHF_ALLOC) != 0 - && ((this_hdr->sh_flags & SHF_TLS) == 0 - || p->p_type == PT_TLS)) - p->p_memsz += sec->size; - - if (p->p_type == PT_TLS - && sec->size == 0 - && (sec->flags & SEC_HAS_CONTENTS) == 0) + else if ((this_hdr->sh_flags & SHF_ALLOC) != 0) { - struct bfd_link_order *o = sec->map_tail.link_order; - if (o != NULL) - p->p_memsz += o->offset + o->size; + if (p->p_type == PT_TLS) + p->p_memsz += this_hdr->sh_size; + + /* .tbss is special. It doesn't contribute to p_memsz of + normal segments. */ + else if ((this_hdr->sh_flags & SHF_TLS) == 0) + p->p_memsz += this_hdr->sh_size; } if (p->p_type == PT_GNU_RELRO) |