diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2007-11-08 13:57:44 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@codesourcery.com> | 2007-11-08 13:57:44 +0000 |
commit | 4d2c0abd8e0a1756a94fbbcc9268e2730c6c922b (patch) | |
tree | 178fbfa9cf1a67de7bd5800cf6c934a84ba18a9c /bfd/elf-vxworks.c | |
parent | 7a2b07ff7e6a3f34e8022a1a72c8a8e812c1da7b (diff) | |
download | gdb-4d2c0abd8e0a1756a94fbbcc9268e2730c6c922b.zip gdb-4d2c0abd8e0a1756a94fbbcc9268e2730c6c922b.tar.gz gdb-4d2c0abd8e0a1756a94fbbcc9268e2730c6c922b.tar.bz2 |
* elf-vxworks.h (elf_vxworks_add_dynamic_entries): Declare.
(elf_vxworks_finish_dynamic_entry): Declare.
* elf-vxworks.c: Include elf/vxworks.h.
(elf_vxworks_add_dynamic_entries): New.
(elf_vxworks_finish_dynamic_entry): New.
* Makefile.am (elf-vxworks.lo): Add dependency.
* Makefile.in (elf-vxworks.lo): Add dependency.
* elf32-i386.c (elf_i386_size_dynamic_sections,
elf_i386_finish_dynamic_sections): Call
elf_vxworks_add_dynamic_entries and
elf_vxworks_finish_dynamic_entry.
* elf32-ppc.c (ppc_elf_size_dynamic_sections,
ppc_elf_finish_dynamic_sections): Likewise.
* elfxx-sparc.c (_bfd_sparc_elf_size_dynamic_sections,
sparc_finish_dyn): Likewise.
* elf32-sh.c (sh_elf_size_dynamic_sections,
sh_elf_finish_dynamic_sections): Likewise.
* elfxx-mips.c (_bfd_mips_elf_size_dynamic_sections,
_bfd_mips_elf_finish_dynamic_sections): Likewise.
* elf32-arm.c (elf32_arm_size_dynamic_sections,
elf32_arm_finish_dynamic_sections): Likewise.
Diffstat (limited to 'bfd/elf-vxworks.c')
-rw-r--r-- | bfd/elf-vxworks.c | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/bfd/elf-vxworks.c b/bfd/elf-vxworks.c index 98d2dfc..074430c 100644 --- a/bfd/elf-vxworks.c +++ b/bfd/elf-vxworks.c @@ -25,6 +25,7 @@ #include "libbfd.h" #include "elf-bfd.h" #include "elf-vxworks.h" +#include "elf/vxworks.h" /* Return true if symbol NAME, as defined by ABFD, is one of the special __GOTT_BASE__ or __GOTT_INDEX__ symbols. */ @@ -225,3 +226,69 @@ elf_vxworks_final_write_processing (bfd *abfd, if (sec) d->this_hdr.sh_info = elf_section_data (sec)->this_idx; } + +/* Add the dynamic entries required by VxWorks. These point to the + tls sections. */ + +bfd_boolean +elf_vxworks_add_dynamic_entries (bfd *output_bfd, struct bfd_link_info *info) +{ + if (bfd_get_section_by_name (output_bfd, ".tls_data")) + { + if (!_bfd_elf_add_dynamic_entry (info, DT_VX_WRS_TLS_DATA_START, 0) + || !_bfd_elf_add_dynamic_entry (info, DT_VX_WRS_TLS_DATA_SIZE, 0) + || !_bfd_elf_add_dynamic_entry (info, DT_VX_WRS_TLS_DATA_ALIGN, 0)) + return FALSE; + } + if (bfd_get_section_by_name (output_bfd, ".tls_vars")) + { + if (!_bfd_elf_add_dynamic_entry (info, DT_VX_WRS_TLS_VARS_START, 0) + || !_bfd_elf_add_dynamic_entry (info, DT_VX_WRS_TLS_VARS_SIZE, 0)) + return FALSE; + } + return TRUE; +} + +/* If *DYN is one of the VxWorks-specific dynamic entries, then fill + in the value now and return TRUE. Otherwise return FALSE. */ + +bfd_boolean +elf_vxworks_finish_dynamic_entry (bfd *output_bfd, Elf_Internal_Dyn *dyn) +{ + asection *sec; + + switch (dyn->d_tag) + { + default: + return FALSE; + + case DT_VX_WRS_TLS_DATA_START: + sec = bfd_get_section_by_name (output_bfd, ".tls_data"); + dyn->d_un.d_ptr = sec->vma; + break; + + case DT_VX_WRS_TLS_DATA_SIZE: + sec = bfd_get_section_by_name (output_bfd, ".tls_data"); + dyn->d_un.d_val = sec->size; + break; + + case DT_VX_WRS_TLS_DATA_ALIGN: + sec = bfd_get_section_by_name (output_bfd, ".tls_data"); + dyn->d_un.d_val + = (bfd_size_type)1 << bfd_get_section_alignment (abfd, sec); + break; + + case DT_VX_WRS_TLS_VARS_START: + sec = bfd_get_section_by_name (output_bfd, ".tls_vars"); + dyn->d_un.d_ptr = sec->vma; + break; + + case DT_VX_WRS_TLS_VARS_SIZE: + sec = bfd_get_section_by_name (output_bfd, ".tls_vars"); + dyn->d_un.d_val = sec->size; + break; + } + return TRUE; +} + + |