aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2002-07-30 14:28:55 +0000
committerJakub Jelinek <jakub@redhat.com>2002-07-30 14:28:55 +0000
commit704afa601f9abdd212d000ff61b1c6a32e085a0b (patch)
tree7bd1dd4a4ba0fdc51bd2c21594e2e97a733fcee3 /bfd/elf.c
parent5f8a3188304fc1456111158ae5e51889b3142801 (diff)
downloadgdb-704afa601f9abdd212d000ff61b1c6a32e085a0b.zip
gdb-704afa601f9abdd212d000ff61b1c6a32e085a0b.tar.gz
gdb-704afa601f9abdd212d000ff61b1c6a32e085a0b.tar.bz2
* elf.c (elf_fake_sections): Fix up .tbss sh_size and sh_type.
* ldlang.c (lang_add_section): Don't turn .tbss into normal sections for relocatable link. (lang_size_sections_1): Don't make .tbss zero size for relocatable link.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r--bfd/elf.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/bfd/elf.c b/bfd/elf.c
index 79190e6..1582496 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -2443,7 +2443,20 @@ elf_fake_sections (abfd, asect, failedptrarg)
if ((asect->flags & SEC_GROUP) == 0 && elf_group_name (asect) != NULL)
this_hdr->sh_flags |= SHF_GROUP;
if ((asect->flags & SEC_THREAD_LOCAL) != 0)
- this_hdr->sh_flags |= SHF_TLS;
+ {
+ this_hdr->sh_flags |= SHF_TLS;
+ if (asect->_raw_size == 0 && (asect->flags & SEC_HAS_CONTENTS) == 0)
+ {
+ struct bfd_link_order *o;
+
+ this_hdr->sh_size = 0;
+ for (o = asect->link_order_head; o != NULL; o = o->next)
+ if (this_hdr->sh_size < o->offset + o->size)
+ this_hdr->sh_size = o->offset + o->size;
+ if (this_hdr->sh_size)
+ this_hdr->sh_type = SHT_NOBITS;
+ }
+ }
/* Check for processor-specific section types. */
if (bed->elf_backend_fake_sections