diff options
author | Richard Sandiford <rdsandiford@googlemail.com> | 2006-03-02 08:57:00 +0000 |
---|---|---|
committer | Richard Sandiford <rdsandiford@googlemail.com> | 2006-03-02 08:57:00 +0000 |
commit | 711de32caaff12a33dfcc10c0421388c7550bac0 (patch) | |
tree | 4356412f348c7c16a25aff55d8b5af2c9d50011f /bfd | |
parent | 83503a060f6c6afe5b411f0056a8c826b6bb3f5a (diff) | |
download | fsf-binutils-gdb-711de32caaff12a33dfcc10c0421388c7550bac0.zip fsf-binutils-gdb-711de32caaff12a33dfcc10c0421388c7550bac0.tar.gz fsf-binutils-gdb-711de32caaff12a33dfcc10c0421388c7550bac0.tar.bz2 |
bfd/
* elf32-i386.c (elf_i386_create_dynamic_sections): Use
elf_vxworks_create_dynamic_sections.
(elf_i386_size_dynamic_sections): Remove VxWorks GOT and PLT
symbol handling.
* elf32-ppc.c (ppc_elf_create_dynamic_sections): Use
elf_vxworks_create_dynamic_sections.
(ppc_elf_size_dynamic_sections): Remove VxWorks GOT and PLT
symbol handling.
* elf-vxworks.c (elf_vxworks_create_dynamic_sections): New function.
* elf-vxworks.h (elf_vxworks_create_dynamic_sections): Declare.
ld/testsuite/
* ld-i386/ld-i386/vxworks1-lib.nd: New test.
* ld-i386/i386.exp: Run it.
* ld-powerpc/ld-powerpc/vxworks1-lib.nd: New test.
* ld-powerpc/powerc.exp: Run it.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 13 | ||||
-rw-r--r-- | bfd/elf-vxworks.c | 51 | ||||
-rw-r--r-- | bfd/elf-vxworks.h | 2 | ||||
-rw-r--r-- | bfd/elf32-i386.c | 32 | ||||
-rw-r--r-- | bfd/elf32-ppc.c | 31 |
5 files changed, 72 insertions, 57 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 53c3ed3..0136341 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,18 @@ 2006-03-02 Richard Sandiford <richard@codesourcery.com> + * elf32-i386.c (elf_i386_create_dynamic_sections): Use + elf_vxworks_create_dynamic_sections. + (elf_i386_size_dynamic_sections): Remove VxWorks GOT and PLT + symbol handling. + * elf32-ppc.c (ppc_elf_create_dynamic_sections): Use + elf_vxworks_create_dynamic_sections. + (ppc_elf_size_dynamic_sections): Remove VxWorks GOT and PLT + symbol handling. + * elf-vxworks.c (elf_vxworks_create_dynamic_sections): New function. + * elf-vxworks.h (elf_vxworks_create_dynamic_sections): Declare. + +2006-03-02 Richard Sandiford <richard@codesourcery.com> + * elf32-i386.c (elf_i386_vxworks_link_output_symbol_hook): Delete. (elf_backend_link_output_symbol_hook): Use elf_vxworks_link_output_symbol_hook instead. diff --git a/bfd/elf-vxworks.c b/bfd/elf-vxworks.c index 0dca07c..90e620a 100644 --- a/bfd/elf-vxworks.c +++ b/bfd/elf-vxworks.c @@ -55,6 +55,57 @@ elf_vxworks_add_symbol_hook (bfd *abfd ATTRIBUTE_UNUSED, return TRUE; } +/* Perform VxWorks-specific handling of the create_dynamic_sections hook. + When creating an executable, set *SRELPLT2_OUT to the .rel(a).plt.unloaded + section. */ + +bfd_boolean +elf_vxworks_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info, + asection **srelplt2_out) +{ + struct elf_link_hash_table *htab; + const struct elf_backend_data *bed; + asection *s; + + htab = elf_hash_table (info); + bed = get_elf_backend_data (dynobj); + + if (!info->shared) + { + s = bfd_make_section_with_flags (dynobj, + bed->default_use_rela_p + ? ".rela.plt.unloaded" + : ".rel.plt.unloaded", + SEC_HAS_CONTENTS | SEC_IN_MEMORY + | SEC_READONLY | SEC_LINKER_CREATED); + if (s == NULL + || !bfd_set_section_alignment (dynobj, s, bed->s->log_file_align)) + return FALSE; + + *srelplt2_out = s; + } + + /* Mark the GOT and PLT symbols as having relocations; they might + not, but we won't know for sure until we build the GOT in + finish_dynamic_symbol. Also make sure that the GOT symbol + is entered into the dynamic symbol table; the loader uses it + to initialize __GOTT_BASE__[__GOTT_INDEX__]. */ + if (htab->hgot) + { + htab->hgot->indx = -2; + htab->hgot->other &= ~ELF_ST_VISIBILITY (-1); + htab->hgot->forced_local = 0; + if (!bfd_elf_link_record_dynamic_symbol (info, htab->hgot)) + return FALSE; + } + if (htab->hplt) + { + htab->hplt->indx = -2; + htab->hplt->type = STT_FUNC; + } + + return TRUE; +} /* Tweak magic VxWorks symbols as they are written to the output file. */ bfd_boolean diff --git a/bfd/elf-vxworks.h b/bfd/elf-vxworks.h index 76db15e..c8ea009 100644 --- a/bfd/elf-vxworks.h +++ b/bfd/elf-vxworks.h @@ -31,3 +31,5 @@ bfd_boolean elf_vxworks_emit_relocs (bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *, struct elf_link_hash_entry **); void elf_vxworks_final_write_processing (bfd *, bfd_boolean); +bfd_boolean elf_vxworks_create_dynamic_sections + (bfd *, struct bfd_link_info *, asection **); diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 6b51f38..c14fc3b 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -782,9 +782,6 @@ static bfd_boolean elf_i386_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info) { struct elf_i386_link_hash_table *htab; - asection * s; - int flags; - const struct elf_backend_data *bed = get_elf_backend_data (dynobj); htab = elf_i386_hash_table (info); if (!htab->sgot && !create_got_section (dynobj, info)) @@ -803,17 +800,9 @@ elf_i386_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info) || (!info->shared && !htab->srelbss)) abort (); - if (htab->is_vxworks && !info->shared) - { - s = bfd_make_section (dynobj, ".rel.plt.unloaded"); - flags = (SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_READONLY - | SEC_LINKER_CREATED); - if (s == NULL - || ! bfd_set_section_flags (dynobj, s, flags) - || ! bfd_set_section_alignment (dynobj, s, bed->s->log_file_align)) - return FALSE; - htab->srelplt2 = s; - } + if (htab->is_vxworks + && !elf_vxworks_create_dynamic_sections (dynobj, info, &htab->srelplt2)) + return FALSE; return TRUE; } @@ -2000,21 +1989,6 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, else htab->tls_ldm_got.offset = -1; - if (htab->is_vxworks) - { - /* Mark the GOT and PLT symbols as having relocations; they might - not, but we won't know for sure until we build the GOT in - finish_dynamic_symbol. */ - if (htab->elf.hgot) - htab->elf.hgot->indx = -2; - if (htab->elf.hplt) - { - htab->elf.hplt->indx = -2; - if (htab->splt->flags & SEC_CODE) - htab->elf.hplt->type = STT_FUNC; - } - } - /* Allocate global sym .plt and .got entries, and space for global sym dynamic relocs. */ elf_link_hash_traverse (&htab->elf, allocate_dynrelocs, (PTR) info); diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index 353f288..68cead2 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -2548,19 +2548,9 @@ ppc_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) return FALSE; } - /* Create the section for VxWorks static plt relocations. */ - if (htab->is_vxworks && !info->shared) - { - s = bfd_make_section (abfd, ".rela.plt.unloaded"); - flags = (SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_READONLY - | SEC_LINKER_CREATED); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags) - || ! bfd_set_section_alignment (abfd, s, - get_elf_backend_data (abfd)->s->log_file_align)) - return FALSE; - htab->srelplt2 = s; - } + if (htab->is_vxworks + && !elf_vxworks_create_dynamic_sections (abfd, info, &htab->srelplt2)) + return FALSE; htab->relplt = bfd_get_section_by_name (abfd, ".rela.plt"); htab->plt = s = bfd_get_section_by_name (abfd, ".plt"); @@ -4764,21 +4754,6 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, else htab->tlsld_got.offset = (bfd_vma) -1; - if (htab->is_vxworks) - { - /* Mark the GOT and PLT symbols as having relocations; they might - not, but we won't know for sure until we build the GOT in - finish_dynamic_symbol. */ - if (htab->elf.hgot) - htab->elf.hgot->indx = -2; - if (htab->elf.hplt) - { - htab->elf.hplt->indx = -2; - if (htab->plt->flags & SEC_CODE) - htab->elf.hplt->type = STT_FUNC; - } - } - /* Allocate space for global sym dynamic relocs. */ elf_link_hash_traverse (elf_hash_table (info), allocate_dynrelocs, info); |