diff options
author | Alan Modra <amodra@gmail.com> | 2005-11-03 02:53:38 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2005-11-03 02:53:38 +0000 |
commit | 3a800eb947748a8cad1b13ed485b5dce1b4cfc4b (patch) | |
tree | f4c51f4e56ccd75ae0a21bb8a866196fbfa42deb /bfd/elf.c | |
parent | 6ed89c00083351e911fc11f817b1fdb7d21b7a7b (diff) | |
download | gdb-3a800eb947748a8cad1b13ed485b5dce1b4cfc4b.zip gdb-3a800eb947748a8cad1b13ed485b5dce1b4cfc4b.tar.gz gdb-3a800eb947748a8cad1b13ed485b5dce1b4cfc4b.tar.bz2 |
* elf.c (elf_fake_sections): When calculating tbss size, just use
the last link_order.
(assign_file_positions_for_segments): Likewise.
* elflink.c (bfd_elf_final_link): Likewise.
(elf_reloc_link_order): Correct comment.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r-- | bfd/elf.c | 25 |
1 files changed, 11 insertions, 14 deletions
@@ -2764,16 +2764,18 @@ elf_fake_sections (bfd *abfd, asection *asect, void *failedptrarg) if ((asect->flags & SEC_THREAD_LOCAL) != 0) { this_hdr->sh_flags |= SHF_TLS; - if (asect->size == 0 && (asect->flags & SEC_HAS_CONTENTS) == 0) + if (asect->size == 0 + && (asect->flags & SEC_HAS_CONTENTS) == 0) { - struct bfd_link_order *o; + struct bfd_link_order *o = asect->map_tail.link_order; this_hdr->sh_size = 0; - for (o = asect->map_head.link_order; o != NULL; o = o->next) - if (this_hdr->sh_size < o->offset + o->size) + if (o != NULL) + { this_hdr->sh_size = o->offset + o->size; - if (this_hdr->sh_size) - this_hdr->sh_type = SHT_NOBITS; + if (this_hdr->sh_size != 0) + this_hdr->sh_type = SHT_NOBITS; + } } } @@ -4396,14 +4398,9 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info) && sec->size == 0 && (sec->flags & SEC_HAS_CONTENTS) == 0) { - struct bfd_link_order *o; - bfd_vma tbss_size = 0; - - for (o = sec->map_head.link_order; o != NULL; o = o->next) - if (tbss_size < o->offset + o->size) - tbss_size = o->offset + o->size; - - p->p_memsz += tbss_size; + struct bfd_link_order *o = sec->map_tail.link_order; + if (o != NULL) + p->p_memsz += o->offset + o->size; } if (align > p->p_align |