diff options
Diffstat (limited to 'bfd/elf32-i386.c')
-rw-r--r-- | bfd/elf32-i386.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index f8ad1d1..01e50a4 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -2358,6 +2358,24 @@ elf_i386_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) if (eh->dyn_relocs == NULL) return TRUE; + /* Since pc_count for TLS symbol can only have size relocations and + we always resolve size relocation against non-zero TLS symbol, we + clear pc_count for non-zero TLS symbol. */ + if (h->type == STT_TLS && h->size != 0) + { + struct elf_dyn_relocs **pp; + + for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) + { + p->count -= p->pc_count; + p->pc_count = 0; + if (p->count == 0) + *pp = p->next; + else + pp = &p->next; + } + } + /* In the shared -Bsymbolic case, discard space allocated for dynamic pc-relative relocs against symbols which turn out to be defined in regular objects. For the normal shared case, discard @@ -3691,6 +3709,12 @@ elf_i386_relocate_section (bfd *output_bfd, case R_386_SIZE32: /* Set to symbol size. */ relocation = st_size; + if (h && h->type == STT_TLS && st_size != 0) + { + /* Resolve size relocation against non-zero TLS symbol. */ + unresolved_reloc = FALSE; + break; + } /* Fall through. */ case R_386_32: |