summaryrefslogtreecommitdiff
path: root/bfd/elf32-sh.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2008-03-25 18:56:02 +0000
committerNathan Sidwell <nathan@codesourcery.com>2008-03-25 18:56:02 +0000
commita0189b07392e2a682f9456da2e6516d7f61f6ff7 (patch)
tree305dd6f6b7fe5ac04f885f21138bd86ba24cf81a /bfd/elf32-sh.c
parent21f99adcc9d59e5b7fd7d515fcd35467e4e67fc7 (diff)
downloadbinutils-redhat-a0189b07392e2a682f9456da2e6516d7f61f6ff7.tar.gz
bfd/
* elf32-arm.c (elf32_arm_final_link_relocate): Skip dynamic relocs in vxworks tls_vars sections. (allocate_dynrelocs, elf32_arm_size_dynamic_sections): Likewise. * elf32-i386.c (allocate_dynrelocs, elf_i386_size_dynamic_sections, elf_i386_relocate_section): Likewise. * elf32-ppc.c (allocate_dynrelocs, ppc_elf_size_dynamic_sections, ppc_elf_relocate_section): Likewise. * elf32-sh.c (allocate_dynrelocs, sh_elf_size_dynamic_sections, sh_elf_relocate_section): Likewise. * elfxx-sparc.c (allocate_dynrelocs, _bfd_sparc_elf_size_dynamic_sections, _bfd_sparc_elf_relocate_section): Likewise. ld/testsuite/ * ld-vxworks/tls-3.s: New. * ld-vxworks/tls-3.d: New.
Diffstat (limited to 'bfd/elf32-sh.c')
-rw-r--r--bfd/elf32-sh.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c
index 1c7b2905eb..26c69bce31 100644
--- a/bfd/elf32-sh.c
+++ b/bfd/elf32-sh.c
@@ -2817,6 +2817,19 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
}
}
+ if (htab->vxworks_p)
+ {
+ struct elf_sh_dyn_relocs **pp;
+
+ for (pp = &eh->dyn_relocs; (p = *pp) != NULL; )
+ {
+ if (strcmp (p->sec->output_section->name, ".tls_vars") == 0)
+ *pp = p->next;
+ else
+ pp = &p->next;
+ }
+ }
+
/* Also discard relocs on undefined weak syms with non-default
visibility. */
if (eh->dyn_relocs != NULL
@@ -2977,6 +2990,13 @@ sh_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
linker script /DISCARD/, so we'll be discarding
the relocs too. */
}
+ else if (htab->vxworks_p
+ && strcmp (p->sec->output_section->name,
+ ".tls_vars") == 0)
+ {
+ /* Relocations in vxworks .tls_vars sections are
+ handled specially by the loader. */
+ }
else if (p->count != 0)
{
srel = elf_section_data (p->sec)->sreloc;
@@ -3166,6 +3186,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
asection *splt;
asection *sreloc;
asection *srelgot;
+ bfd_boolean is_vxworks_tls;
BFD_ASSERT (is_sh_elf (input_bfd));
@@ -3180,6 +3201,11 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
splt = htab->splt;
sreloc = NULL;
srelgot = NULL;
+ /* We have to handle relocations in vxworks .tls_vars sections
+ specially, because the dynamic loader is 'weird'. */
+ is_vxworks_tls = (htab->vxworks_p && info->shared
+ && !strcmp (input_section->output_section->name,
+ ".tls_vars"));
rel = relocs;
relend = relocs + input_section->reloc_count;
@@ -3586,6 +3612,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|| h->root.type != bfd_link_hash_undefweak)
&& r_symndx != 0
&& (input_section->flags & SEC_ALLOC) != 0
+ && !is_vxworks_tls
&& (r_type == R_SH_DIR32
|| !SYMBOL_CALLS_LOCAL (info, h)))
{