aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-ppc.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
commit3348747a874d2c53964a3038be83070542f75c2e (patch)
tree0c980418f104acc1dc304b811a2a8bf91d835cfb /bfd/elf32-ppc.c
parent0a65a3a7402d9b8523844366c638a0354f48dfa4 (diff)
downloadgdb-3348747a874d2c53964a3038be83070542f75c2e.zip
gdb-3348747a874d2c53964a3038be83070542f75c2e.tar.gz
gdb-3348747a874d2c53964a3038be83070542f75c2e.tar.bz2
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-ppc.c')
-rw-r--r--bfd/elf32-ppc.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index c7f419a..db380d2 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -4811,6 +4811,19 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
}
}
+ if (htab->is_vxworks)
+ {
+ struct ppc_elf_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;
+ }
+ }
+
/* Discard relocs on undefined symbols that must be local. */
if (eh->dyn_relocs != NULL
&& h->root.type == bfd_link_hash_undefined
@@ -4962,6 +4975,13 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
linker script /DISCARD/, so we'll be discarding
the relocs too. */
}
+ else if (htab->is_vxworks
+ && 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)
{
elf_section_data (p->sec)->sreloc->size
@@ -5800,6 +5820,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
bfd_vma *local_got_offsets;
bfd_boolean ret = TRUE;
bfd_vma d_offset = (bfd_big_endian (output_bfd) ? 2 : 0);
+ bfd_boolean is_vxworks_tls;
#ifdef DEBUG
_bfd_error_handler ("ppc_elf_relocate_section called for %B section %A, "
@@ -5819,6 +5840,11 @@ ppc_elf_relocate_section (bfd *output_bfd,
local_got_offsets = elf_local_got_offsets (input_bfd);
symtab_hdr = &elf_symtab_hdr (input_bfd);
sym_hashes = elf_sym_hashes (input_bfd);
+ /* We have to handle relocations in vxworks .tls_vars sections
+ specially, because the dynamic loader is 'weird'. */
+ is_vxworks_tls = (htab->is_vxworks && info->shared
+ && !strcmp (input_section->output_section->name,
+ ".tls_vars"));
rel = relocs;
relend = relocs + input_section->reloc_count;
for (; rel < relend; rel++)
@@ -6461,7 +6487,8 @@ ppc_elf_relocate_section (bfd *output_bfd,
/* fall through */
dodyn:
- if ((input_section->flags & SEC_ALLOC) == 0)
+ if ((input_section->flags & SEC_ALLOC) == 0
+ || is_vxworks_tls)
break;
if ((info->shared