diff options
author | Richard Sandiford <rdsandiford@googlemail.com> | 2006-03-22 09:28:15 +0000 |
---|---|---|
committer | Richard Sandiford <rdsandiford@googlemail.com> | 2006-03-22 09:28:15 +0000 |
commit | 0a44bf6950b3b1a1a79e46c36be2487c2499fd58 (patch) | |
tree | fd77387be93bd59c5df8d12c0fca9da2b0c7a124 /ld | |
parent | 11010f5a82bae6b40067c04c33184c70c0c99e10 (diff) | |
download | gdb-0a44bf6950b3b1a1a79e46c36be2487c2499fd58.zip gdb-0a44bf6950b3b1a1a79e46c36be2487c2499fd58.tar.gz gdb-0a44bf6950b3b1a1a79e46c36be2487c2499fd58.tar.bz2 |
Richard Sandiford <richard@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
Phil Edwards <phil@codesourcery.com>
Zack Weinberg <zack@codesourcery.com>
Mark Mitchell <mark@codesourcery.com>
Nathan Sidwell <nathan@codesourcery.com>
bfd/
* bfd-in2.h: Regenerate.
* config.bfd (mips*-*-vxworks*, mips*el-*-vxworks*): New stanzas.
* configure.in (bfd_elf32_bigmips_vxworks_vec): New stanza.
(bfd_elf32_littlemips_vxworks_vec): Likewise.
(bfd_elf32_bigmips_vec): Add elf-vxworks.lo.
(bfd_elf32_littlemips_vec): Likewise.
(bfd_elf32_nbigmips_vec): Likewise.
(bfd_elf32_nlittlemips_vec): Likewise.
(bfd_elf32_ntradbigmips_vec): Likewise.
(bfd_elf32_ntradlittlemips_vec): Likewise.
(bfd_elf32_tradbigmips_vec): Likewise.
(bfd_elf32_tradlittlemips_vec): Likewise.
(bfd_elf64_bigmips_vec): Likewise.
(bfd_elf64_littlemips_vec): Likewise.
(bfd_elf64_tradbigmips_vec): Likewise.
(bfd_elf64_tradlittlemips_vec): Likewise.
* elf32-mips.c: Include elf-vxworks.h.
(mips_info_to_howto_rel): Use elf_backend_mips_rtype_to_howto
instead of calling mips_elf32_rtype_to_howto directly.
(mips_vxworks_copy_howto_rela): New reloc howto.
(mips_vxworks_jump_slot_howto_rela): Likewise.
(mips_vxworks_bfd_reloc_type_lookup): New function.
(mips_vxworks_rtype_to_howto): Likewise.
(mips_vxworks_final_write_processing): Likewise.
(TARGET_LITTLE_SYM, TARGET_LITTLE_NAME): Override for VxWorks.
(TARGET_BIG_SYM, TARGET_BIG_NAME, elf_bed, ELF_MAXPAGESIZE): Likewise.
(elf_backend_want_got_plt): Likewise.
(elf_backend_want_plt_sym): Likewise.
(elf_backend_got_symbol_offset): Likewise.
(elf_backend_want_dynbss): Likewise.
(elf_backend_may_use_rel_p): Likewise.
(elf_backend_may_use_rela_p): Likewise.
(elf_backend_default_use_rela_p): Likewise.
(elf_backend_got_header_size: Likewise.
(elf_backend_plt_readonly): Likewise.
(bfd_elf32_bfd_reloc_type_lookup): Likewise.
(elf_backend_mips_rtype_to_howto): Likewise.
(elf_backend_adjust_dynamic_symbol): Likewise.
(elf_backend_finish_dynamic_symbol): Likewise.
(bfd_elf32_bfd_link_hash_table_create): Likewise.
(elf_backend_add_symbol_hook): Likewise.
(elf_backend_link_output_symbol_hook): Likewise.
(elf_backend_emit_relocs): Likewise.
(elf_backend_final_write_processing: Likewise.
(elf_backend_additional_program_headers): Likewise.
(elf_backend_modify_segment_map): Likewise.
(elf_backend_symbol_processing): Likewise.
* elfxx-mips.c: Include elf-vxworks.h.
(mips_elf_link_hash_entry): Add is_relocation_target and
is_branch_target fields.
(mips_elf_link_hash_table): Add is_vxworks, srelbss, sdynbss, srelplt,
srelplt2, sgotplt, splt, plt_header_size and plt_entry_size fields.
(MIPS_ELF_RELA_SIZE, MIPS_ELF_REL_DYN_NAME): New macros.
(MIPS_RESERVED_GOTNO): Take a mips_elf_link_hash_table argument.
Return 3 for VxWorks.
(ELF_MIPS_GP_OFFSET): Change the argument from a bfd to a
mips_elf_link_hash_table. Return 0 for VxWorks.
(MIPS_ELF_GOT_MAX_SIZE): Change the argument from a bfd to a
mips_elf_link_hash_table. Update the call to ELF_MIPS_GP_OFFSET.
(mips_vxworks_exec_plt0_entry): New variable.
(mips_vxworks_exec_plt_entry): Likewise.
(mips_vxworks_shared_plt0_entry): Likewise.
(mips_vxworks_shared_plt_entry): Likewise.
(mips_elf_link_hash_newfunc): Initialize the new hash_entry fields.
(mips_elf_rel_dyn_section): Change the bfd argument to a
mips_elf_link_hash_table. Use MIPS_ELF_REL_DYN_NAME to get
the name of the section.
(mips_elf_initialize_tls_slots): Update the call to
mips_elf_rel_dyn_section.
(mips_elf_gotplt_index): New function.
(mips_elf_local_got_index): Add an input_section argument.
Update the call to mips_elf_create_local_got_entry.
(mips_elf_got_page): Likewise.
(mips_elf_got16_entry): Likewise.
(mips_elf_create_local_got_entry): Add bfd_link_info and input_section
arguments. Create dynamic relocations for each entry on VxWorks.
(mips_elf_merge_gots): Update the use of MIPS_ELF_GOT_MAX_SIZE.
(mips_elf_multi_got): Update the uses of MIPS_ELF_GOT_MAX_SIZE
and MIPS_RESERVED_GOTNO.
(mips_elf_create_got_section): Update the uses of
MIPS_ELF_GOT_MAX_SIZE. Create .got.plt on VxWorks.
(is_gott_symbol): New function.
(mips_elf_calculate_relocation): Use a dynobj local variable.
Update the calls to mips_elf_local_got_index, mips_elf_got16_entry and
mips_elf_got_page_entry. Set G to the .got.plt entry when calculating
VxWorks R_MIPS_CALL* relocations. Calculate and use G for all GOT
relocations on VxWorks. Add dynamic relocations for references
to the VxWorks __GOTT_BASE__ and __GOTT_INDEX__ symbols. Don't
create dynamic relocations for R_MIPS_32, R_MIPS_REL32 or R_MIPS_64
in VxWorks executables.
(mips_elf_allocate_dynamic_relocations): Add a bfd_link_info argument.
Use MIPS_ELF_RELA_SIZE to calculate the size of a VxWorks entry.
Don't allocate a null entry on VxWorks.
(mips_elf_create_dynamic_relocation): Update the call to
mips_elf_rel_dyn_section. Use absolute rather than relative
relocations for VxWorks, and make them RELA rather than REL.
(_bfd_mips_elf_create_dynamic_sections): Don't make .dynamic
read-only on VxWorks. Update the call to mips_elf_rel_dyn_section.
Create the .plt, .rela.plt, .dynbss and .rela.bss sections on
VxWorks. Likewise create the _PROCEDURE_LINKAGE_TABLE symbol.
Call elf_vxworks_create_dynamic_sections for VxWorks and
initialize the plt_header_size and plt_entry_size fields.
(_bfd_mips_elf_check_relocs): Don't allow GOT relocations to be
used in VxWorks executables. Don't allocate dynamic relocations
for R_MIPS_32, R_MIPS_REL32 or R_MIPS_64 in VxWorks executables.
Set is_relocation_target for each symbol referenced by a relocation.
Allocate .rela.dyn entries for relocations against the special
VxWorks __GOTT_BASE__ and __GOTT_INDEX__ symbols. Create GOT
entries for all VxWorks R_MIPS_GOT16 relocations. Don't allocate
a global GOT entry for symbols mentioned in VxWorks R_MIPS_CALL*,
R_MIPS_32, R_MIPS_REL32 or R_MIPS_64 relocations. Update the calls
to mips_elf_rel_dyn_section and mips_elf_allocate_dynamic_relocations.
Set is_branch_target for symbols mentioned in R_MIPS_PC16 or R_MIPS_26
relocations. Don't set no_fn_stub on VxWorks.
(_bfd_mips_elf_adjust_dynamic_symbol): Update the call to
mips_elf_allocate_dynamic_relocations.
(_bfd_mips_vxworks_adjust_dynamic_symbol): New function.
(_bfd_mips_elf_always_size_sections): Do not allocate GOT page
entries for VxWorks, and do not create multiple GOTs.
(_bfd_mips_elf_size_dynamic_sections): Use MIPS_ELF_REL_DYN_NAME.
Handle .got specially for VxWorks. Update the uses of
MIPS_RESERVED_GOTNO and mips_elf_allocate_dynamic_relocations.
Check for sgotplt and splt. Allocate the .rel(a).dyn contents last,
once its final size is known. Set DF_TEXTREL for VxWorks. Add
DT_RELA, DT_RELASZ, DT_RELAENT, DT_PLTREL, DT_PLTRELSZ and DT_JMPREL
tags on VxWorks. Do not add the MIPS-specific tags for VxWorks.
(_bfd_mips_vxworks_finish_dynamic_symbol): New function.
(mips_vxworks_finish_exec_plt): Likewise.
(mips_vxworks_finish_shared_plt): Likewise.
(_bfd_mips_elf_finish_dynamic_sections): Remove an unncessary call
to mips_elf_rel_dyn_section. Use a VxWorks-specific value of
DT_PLTGOT. Handle DT_RELA, DT_RELASZ, DT_RELAENT, DT_PLTREL,
DT_PLTRELSZ and DT_JMPREL. Update the uses of MIPS_RESERVED_GOTNO
and mips_elf_rel_dyn_section. Use a different GOT header for
VxWorks. Don't sort .rela.dyn on VxWorks. Finish the PLT on VxWorks.
(_bfd_mips_elf_link_hash_table_create): Initialize the new
mips_elf_link_hash_table fields.
(_bfd_mips_vxworks_link_hash_table_create): New function.
(_bfd_mips_elf_final_link): Set the GP value to _GLOBAL_OFFSET_TABLE_
on VxWorks. Update the call to ELF_MIPS_GP_OFFSET.
* elfxx-mips.h (_bfd_mips_vxworks_adjust_dynamic_symbol): Declare.
(_bfd_mips_vxworks_finish_dynamic_symbol): Likewise.
(_bfd_mips_vxworks_link_hash_table_create): Likewise.
* libbfd.h: Regenerate.
* Makefile.am (elfxx-mips.lo): Depend on elf-vxworks.h.
(elf32-mips.lo): Likewise.
* Makefile.in: Regenerate.
* reloc.c (BFD_RELOC_MIPS_COPY, BFD_RELOC_MIPS_JUMP_SLOT): Declare.
* targets.c (bfd_elf32_bigmips_vxworks_vec): Declare.
(bfd_elf32_littlemips_vxworks_vec): Likewise.
(_bfd_target_vector): Add entries for them.
gas/
* config/tc-mips.c (mips_target_format): Handle vxworks targets.
(md_begin): Complain about -G being used for PIC. Don't change
the text, data and bss alignments on VxWorks.
(reloc_needs_lo_p): Don't return true for R_MIPS_GOT16 when
generating VxWorks PIC.
(load_address): Extend SVR4_PIC handling to VXWORKS_PIC.
(macro): Likewise, but do not treat la $25 specially for
VxWorks PIC, and do not handle jal.
(OPTION_MVXWORKS_PIC): New macro.
(md_longopts): Add -mvxworks-pic.
(md_parse_option): Don't complain about using PIC and -G together here.
Handle OPTION_MVXWORKS_PIC.
(md_estimate_size_before_relax): Always use the first relaxation
sequence on VxWorks.
* config/tc-mips.h (VXWORKS_PIC): New.
gas/testsuite/
* gas/mips/vxworks1.s, gas/mips/vxworks1.d,
* gas/mips/vxworks1-xgot.d: New tests.
* gas/mips/mips.exp: Run them. Do not run other tests on VxWorks.
include/elf/
* mips.h (R_MIPS_COPY, R_MIPS_JUMP_SLOT): New relocs.
ld/
* configure.tgt (mips*el-*-vxworks*, mips*-*-vxworks*): Use
separate VxWorks emulations.
* emulparams/elf32ebmipvxworks.sh: New file.
* emulparams/elf32elmipvxworks.sh: New file.
* Makefile.am (ALL_EMULATIONS): Add eelf32ebmipvxworks.o and
eelf32elmipvxworks.o.
(eelf32ebmipvxworks.c, eelf32elmipvxworks.c): New rules.
* Makefile.in: Regenerate.
ld/testsuite/
* ld-mips/vxworks1.dd, ld-mips/vxworks1.ld, ld-mips/vxworks1-lib.dd,
* ld-mips/vxworks1-lib.nd, ld-mips/vxworks1-lib.rd,
* ld-mips/vxworks1-lib.s, ld-mips/vxworks1.rd, ld-mips/vxworks1.s,
* ld-mips/vxworks1-static.d, ld-mips/vxworks2.s, ld-mips/vxworks2.sd,
* ld-mips/vxworks2-static.sd: New tests.
* ld-mips/mips-elf.exp: Run them.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/ChangeLog | 16 | ||||
-rw-r--r-- | ld/Makefile.am | 12 | ||||
-rw-r--r-- | ld/Makefile.in | 12 | ||||
-rw-r--r-- | ld/configure.tgt | 7 | ||||
-rw-r--r-- | ld/emulparams/elf32ebmipvxworks.sh | 11 | ||||
-rw-r--r-- | ld/emulparams/elf32elmipvxworks.sh | 11 | ||||
-rw-r--r-- | ld/testsuite/ChangeLog | 9 | ||||
-rw-r--r-- | ld/testsuite/ld-mips-elf/mips-elf.exp | 28 | ||||
-rw-r--r-- | ld/testsuite/ld-mips-elf/vxworks1-lib.dd | 50 | ||||
-rw-r--r-- | ld/testsuite/ld-mips-elf/vxworks1-lib.nd | 9 | ||||
-rw-r--r-- | ld/testsuite/ld-mips-elf/vxworks1-lib.rd | 18 | ||||
-rw-r--r-- | ld/testsuite/ld-mips-elf/vxworks1-lib.s | 52 | ||||
-rw-r--r-- | ld/testsuite/ld-mips-elf/vxworks1-static.d | 4 | ||||
-rw-r--r-- | ld/testsuite/ld-mips-elf/vxworks1.dd | 51 | ||||
-rw-r--r-- | ld/testsuite/ld-mips-elf/vxworks1.ld | 32 | ||||
-rw-r--r-- | ld/testsuite/ld-mips-elf/vxworks1.rd | 32 | ||||
-rw-r--r-- | ld/testsuite/ld-mips-elf/vxworks1.s | 27 | ||||
-rw-r--r-- | ld/testsuite/ld-mips-elf/vxworks2-static.sd | 9 | ||||
-rw-r--r-- | ld/testsuite/ld-mips-elf/vxworks2.s | 5 | ||||
-rw-r--r-- | ld/testsuite/ld-mips-elf/vxworks2.sd | 13 |
20 files changed, 405 insertions, 3 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index 9005e8f..3918cc0 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,19 @@ +2006-03-22 Richard Sandiford <richard@codesourcery.com> + Daniel Jacobowitz <dan@codesourcery.com> + Phil Edwards <phil@codesourcery.com> + Zack Weinberg <zack@codesourcery.com> + Mark Mitchell <mark@codesourcery.com> + Nathan Sidwell <nathan@codesourcery.com> + + * configure.tgt (mips*el-*-vxworks*, mips*-*-vxworks*): Use + separate VxWorks emulations. + * emulparams/elf32ebmipvxworks.sh: New file. + * emulparams/elf32elmipvxworks.sh: New file. + * Makefile.am (ALL_EMULATIONS): Add eelf32ebmipvxworks.o and + eelf32elmipvxworks.o. + (eelf32ebmipvxworks.c, eelf32elmipvxworks.c): New rules. + * Makefile.in: Regenerate. + 2006-03-16 Alan Modra <amodra@bigpond.net.au> PR 2434 diff --git a/ld/Makefile.am b/ld/Makefile.am index db64da4..d59d734 100644 --- a/ld/Makefile.am +++ b/ld/Makefile.am @@ -158,7 +158,9 @@ ALL_EMULATIONS = \ eelf32ltsmip.o \ eelf32ltsmipn32.o \ eelf32ebmip.o \ + eelf32ebmipvxworks.o \ eelf32elmip.o \ + eelf32elmipvxworks.o \ eelf32fr30.o \ eelf32frv.o \ eelf32i370.o \ @@ -725,10 +727,20 @@ eelf32ebmip.c: $(srcdir)/emulparams/elf32ebmip.sh \ $(srcdir)/emulparams/elf32bmip.sh \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32ebmip "$(tdir_elf32ebmip)" +eelf32ebmipvxworks.c: $(srcdir)/emulparams/elf32ebmipvxworks.sh \ + $(srcdir)/emulparams/elf32ebmip.sh $(srcdir)/emulparams/vxworks.sh \ + $(srcdir)/emultempl/elf32.em $(srcdir)/emultempl/vxworks.em \ + $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} + ${GENSCRIPTS} elf32ebmipvxworks "$(tdir_elf32ebmipvxworks)" eelf32elmip.c: $(srcdir)/emulparams/elf32elmip.sh \ $(srcdir)/emulparams/elf32lmip.sh $(srcdir)/emulparams/elf32bmip.sh \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32elmip "$(tdir_elf32elmip)" +eelf32elmipvxworks.c: $(srcdir)/emulparams/elf32elmipvxworks.sh \ + $(srcdir)/emulparams/elf32elmip.sh $(srcdir)/emulparams/vxworks.sh \ + $(srcdir)/emultempl/elf32.em $(srcdir)/emultempl/vxworks.em \ + $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} + ${GENSCRIPTS} elf32elmipvxworks "$(tdir_elf32elmipvxworks)" eelf32bmipn32.c: $(srcdir)/emulparams/elf32bmipn32.sh \ $(srcdir)/emultempl/irix.em \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} diff --git a/ld/Makefile.in b/ld/Makefile.in index dff4173..fde6f7c 100644 --- a/ld/Makefile.in +++ b/ld/Makefile.in @@ -381,7 +381,9 @@ ALL_EMULATIONS = \ eelf32ltsmip.o \ eelf32ltsmipn32.o \ eelf32ebmip.o \ + eelf32ebmipvxworks.o \ eelf32elmip.o \ + eelf32elmipvxworks.o \ eelf32fr30.o \ eelf32frv.o \ eelf32i370.o \ @@ -1531,10 +1533,20 @@ eelf32ebmip.c: $(srcdir)/emulparams/elf32ebmip.sh \ $(srcdir)/emulparams/elf32bmip.sh \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32ebmip "$(tdir_elf32ebmip)" +eelf32ebmipvxworks.c: $(srcdir)/emulparams/elf32ebmipvxworks.sh \ + $(srcdir)/emulparams/elf32ebmip.sh $(srcdir)/emulparams/vxworks.sh \ + $(srcdir)/emultempl/elf32.em $(srcdir)/emultempl/vxworks.em \ + $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} + ${GENSCRIPTS} elf32ebmipvxworks "$(tdir_elf32ebmipvxworks)" eelf32elmip.c: $(srcdir)/emulparams/elf32elmip.sh \ $(srcdir)/emulparams/elf32lmip.sh $(srcdir)/emulparams/elf32bmip.sh \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32elmip "$(tdir_elf32elmip)" +eelf32elmipvxworks.c: $(srcdir)/emulparams/elf32elmipvxworks.sh \ + $(srcdir)/emulparams/elf32elmip.sh $(srcdir)/emulparams/vxworks.sh \ + $(srcdir)/emultempl/elf32.em $(srcdir)/emultempl/vxworks.em \ + $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} + ${GENSCRIPTS} elf32elmipvxworks "$(tdir_elf32elmipvxworks)" eelf32bmipn32.c: $(srcdir)/emulparams/elf32bmipn32.sh \ $(srcdir)/emultempl/irix.em \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} diff --git a/ld/configure.tgt b/ld/configure.tgt index 56e1ae4..9511666 100644 --- a/ld/configure.tgt +++ b/ld/configure.tgt @@ -324,9 +324,10 @@ mips*vr5000-*-elf*) targ_emul=elf32b4300 ;; mips*el-*-elf*) targ_emul=elf32elmip ;; mips*-*-elf*) targ_emul=elf32ebmip ;; mips*-*-rtems*) targ_emul=elf32ebmip ;; -mips*el-*-vxworks*) targ_emul=elf32elmip ;; -mips*-*-vxworks*) targ_emul=elf32ebmip - targ_extra_emuls="elf32elmip" ;; +mips*el-*-vxworks*) targ_emul=elf32elmipvxworks + targ_extra_emuls="elf32ebmipvxworks" ;; +mips*-*-vxworks*) targ_emul=elf32ebmipvxworks + targ_extra_emuls="elf32elmipvxworks" ;; mips*-*-windiss) targ_emul=elf32mipswindiss ;; mips64*el-*-linux-*) targ_emul=elf32ltsmipn32 targ_extra_emuls="elf32btsmipn32 elf32ltsmip elf32btsmip elf64ltsmip elf64btsmip" diff --git a/ld/emulparams/elf32ebmipvxworks.sh b/ld/emulparams/elf32ebmipvxworks.sh new file mode 100644 index 0000000..4145488 --- /dev/null +++ b/ld/emulparams/elf32ebmipvxworks.sh @@ -0,0 +1,11 @@ +. ${srcdir}/emulparams/elf32bmip.sh + +OUTPUT_FORMAT="elf32-bigmips-vxworks" +BIG_OUTPUT_FORMAT="elf32-bigmips-vxworks" +LITTLE_OUTPUT_FORMAT="elf32-littlemips-vxworks" +unset OTHER_GOT_SYMBOLS +SHLIB_TEXT_START_ADDR=0 +unset TEXT_DYNAMIC +unset DATA_ADDR + +. ${srcdir}/emulparams/vxworks.sh diff --git a/ld/emulparams/elf32elmipvxworks.sh b/ld/emulparams/elf32elmipvxworks.sh new file mode 100644 index 0000000..c123944 --- /dev/null +++ b/ld/emulparams/elf32elmipvxworks.sh @@ -0,0 +1,11 @@ +. ${srcdir}/emulparams/elf32bmip.sh + +OUTPUT_FORMAT="elf32-littlemips-vxworks" +BIG_OUTPUT_FORMAT="elf32-bigmips-vxworks" +LITTLE_OUTPUT_FORMAT="elf32-littlemips-vxworks" +unset OTHER_GOT_SYMBOLS +SHLIB_TEXT_START_ADDR=0 +unset TEXT_DYNAMIC +unset DATA_ADDR + +. ${srcdir}/emulparams/vxworks.sh diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index f968b4c..763c325 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2006-03-22 Richard Sandiford <richard@codesourcery.com> + + * ld-mips/vxworks1.dd, ld-mips/vxworks1.ld, ld-mips/vxworks1-lib.dd, + * ld-mips/vxworks1-lib.nd, ld-mips/vxworks1-lib.rd, + * ld-mips/vxworks1-lib.s, ld-mips/vxworks1.rd, ld-mips/vxworks1.s, + * ld-mips/vxworks1-static.d, ld-mips/vxworks2.s, ld-mips/vxworks2.sd, + * ld-mips/vxworks2-static.sd: New tests. + * ld-mips/mips-elf.exp: Run them. + 2006-03-17 Alexandre Oliva <aoliva@redhat.com> * ld-powerpc/tls32.s: Verify that +32768 @plt addend is diff --git a/ld/testsuite/ld-mips-elf/mips-elf.exp b/ld/testsuite/ld-mips-elf/mips-elf.exp index aac3418..add2060 100644 --- a/ld/testsuite/ld-mips-elf/mips-elf.exp +++ b/ld/testsuite/ld-mips-elf/mips-elf.exp @@ -16,6 +16,34 @@ # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. # +if {[istarget "mips*-*-vxworks"]} { + set mipsvxtests { + {"VxWorks shared library test 1" "-shared -Tvxworks1.ld" + "-mips2" {vxworks1-lib.s} + {{readelf --relocs vxworks1-lib.rd} {objdump -dr vxworks1-lib.dd} + {readelf --symbols vxworks1-lib.nd}} + "libvxworks1.so"} + {"VxWorks executable test 1 (dynamic)" \ + "tmpdir/libvxworks1.so -Tvxworks1.ld -q --force-dynamic" + "-mips2" {vxworks1.s} + {{readelf --relocs vxworks1.rd} {objdump -dr vxworks1.dd}} + "vxworks1"} + {"VxWorks executable test 2 (dynamic)" \ + "-Tvxworks1.ld -q --force-dynamic" + "-mips2" {vxworks2.s} + {{readelf --segments vxworks2.sd}} + "vxworks2"} + {"VxWorks executable test 2 (static)" + "-Tvxworks1.ld" + "-mips2" {vxworks2.s} + {{readelf --segments vxworks2-static.sd}} + "vxworks2"} + } + run_ld_link_tests $mipsvxtests + run_dump_test "vxworks1-static" + return +} + if {![istarget mips*-*-*] || ![is_elf_format]} { return } diff --git a/ld/testsuite/ld-mips-elf/vxworks1-lib.dd b/ld/testsuite/ld-mips-elf/vxworks1-lib.dd new file mode 100644 index 0000000..ab060d9 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/vxworks1-lib.dd @@ -0,0 +1,50 @@ + +.*: file format .* + +Disassembly of section \.plt: + +00080800 <_PROCEDURE_LINKAGE_TABLE_>: + 80800: 8f990008 lw t9,8\(gp\) + 80804: 00000000 nop + 80808: 03200008 jr t9 + 8080c: 00000000 nop + \.\.\. + 80818: 1000fff9 b 80800 <_PROCEDURE_LINKAGE_TABLE_> + 8081c: 24180000 li t8,0 + 80820: 1000fff7 b 80800 <_PROCEDURE_LINKAGE_TABLE_> + 80824: 24180001 li t8,1 +Disassembly of section \.text: + +00080c00 <foo>: + 80c00: 27bdffe0 addiu sp,sp,-32 + 80c04: afbf0000 sw ra,0\(sp\) + 80c08: afbc0004 sw gp,4\(sp\) + 80c0c: 3c1c0000 lui gp,0x0 + 80c10: 8f9c0000 lw gp,0\(gp\) + 80c14: 8f9c0000 lw gp,0\(gp\) + 80c18: 8f820014 lw v0,20\(gp\) + 80c1c: 8c430000 lw v1,0\(v0\) + 80c20: 24630001 addiu v1,v1,1 + 80c24: ac430000 sw v1,0\(v0\) + 80c28: 8f99000c lw t9,12\(gp\) + 80c2c: 0320f809 jalr t9 + 80c30: 00000000 nop + 80c34: 8f99fff4 lw t9,-12\(gp\) + 80c38: 0320f809 jalr t9 + 80c3c: 00000000 nop + 80c40: 8f99fff0 lw t9,-16\(gp\) + 80c44: 0320f809 jalr t9 + 80c48: 00000000 nop + 80c4c: 8fbf0000 lw ra,0\(sp\) + 80c50: 8fbc0004 lw gp,4\(sp\) + 80c54: 03e00008 jr ra + 80c58: 27bd0020 addiu sp,sp,32 + +00080c5c <slocal>: + 80c5c: 03e00008 jr ra + 80c60: 00000000 nop + +00080c64 <sglobal>: + 80c64: 03e00008 jr ra + 80c68: 00000000 nop +#pass diff --git a/ld/testsuite/ld-mips-elf/vxworks1-lib.nd b/ld/testsuite/ld-mips-elf/vxworks1-lib.nd new file mode 100644 index 0000000..adbf7d7 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/vxworks1-lib.nd @@ -0,0 +1,9 @@ +#... +Symbol table '\.dynsym' .*: +#... +.*: 00081410 * 0 * OBJECT * GLOBAL * DEFAULT * [0-9]+ _GLOBAL_OFFSET_TABLE_ +#... +Symbol table '\.symtab' .*: +#... +.*: 00081410 * 0 * OBJECT * GLOBAL * DEFAULT * [0-9]+ _GLOBAL_OFFSET_TABLE_ +#pass diff --git a/ld/testsuite/ld-mips-elf/vxworks1-lib.rd b/ld/testsuite/ld-mips-elf/vxworks1-lib.rd new file mode 100644 index 0000000..9a8b35e --- /dev/null +++ b/ld/testsuite/ld-mips-elf/vxworks1-lib.rd @@ -0,0 +1,18 @@ + +Relocation section '\.rela\.dyn' at offset .* contains .* entries: + Offset Info Type Sym\.Value Sym\. Name \+ Addend +00080c0c .*05 R_MIPS_HI16 00000000 __GOTT_BASE__ \+ 0 +00080c10 .*06 R_MIPS_LO16 00000000 __GOTT_BASE__ \+ 0 +00080c14 .*01 R_MIPS_16 00000000 __GOTT_INDEX__ \+ 0 +0008141c .*02 R_MIPS_32 00080c00 \.text \+ 5c +00081c00 00000002 R_MIPS_32 00080c5c +00081c04 00000002 R_MIPS_32 00081c00 +00081c08 .*02 R_MIPS_32 00081c08 dglobal \+ 0 +00081c0c .*02 R_MIPS_32 00000000 dexternal \+ 0 +00081424 .*02 R_MIPS_32 00081800 x \+ 0 +00000000 00000000 R_MIPS_NONE 00000000 +#... +Relocation section '\.rela\.plt' at offset .* contains 2 entries: + Offset Info Type Sym\.Value Sym\. Name \+ Addend +00081400 .*7f R_MIPS_JUMP_SLOT 00000000 sexternal \+ 0 +00081404 .*7f R_MIPS_JUMP_SLOT 00080c64 sglobal \+ 0 diff --git a/ld/testsuite/ld-mips-elf/vxworks1-lib.s b/ld/testsuite/ld-mips-elf/vxworks1-lib.s new file mode 100644 index 0000000..827332c --- /dev/null +++ b/ld/testsuite/ld-mips-elf/vxworks1-lib.s @@ -0,0 +1,52 @@ + .text + .globl foo + .type foo, @function +foo: + addiu $sp,$sp,-32 + sw $31,($sp) + sw $28,4($sp) + lui $28,%hi(__GOTT_BASE__) + lw $28,%lo(__GOTT_BASE__)($28) + lw $28,%half(__GOTT_INDEX__)($28) + lw $2,%got(x)($28) + lw $3,($2) + addiu $3,$3,1 + sw $3,($2) + lw $25,%got(slocal)($gp) + jalr $25 + lw $25,%call16(sglobal)($gp) + jalr $25 + lw $25,%call16(sexternal)($gp) + jalr $25 + lw $31,($sp) + lw $28,4($sp) + addiu $sp,$sp,32 + jr $31 + .size foo, .-foo + + .type slocal, @function +slocal: + jr $31 + .size slocal, .-slocal + + .globl sglobal + .type sglobal, @function +sglobal: + jr $31 + .size sglobal, .-sglobal + + .comm x,4,4 + + .data + .type dlocal, @object +dlocal: + .word slocal + .word dlocal + .size dlocal, .-dlocal + + .globl dglobal + .type dglobal, @object +dglobal: + .word dglobal + .word dexternal + .size dglobal, .-dglobal diff --git a/ld/testsuite/ld-mips-elf/vxworks1-static.d b/ld/testsuite/ld-mips-elf/vxworks1-static.d new file mode 100644 index 0000000..88c0baf --- /dev/null +++ b/ld/testsuite/ld-mips-elf/vxworks1-static.d @@ -0,0 +1,4 @@ +#name: VxWorks executable test 1 (static) +#source: vxworks1.s +#ld: tmpdir/libvxworks1.so -Tvxworks1.ld +#error: Dynamic sections created in non-dynamic link diff --git a/ld/testsuite/ld-mips-elf/vxworks1.dd b/ld/testsuite/ld-mips-elf/vxworks1.dd new file mode 100644 index 0000000..af9e354 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/vxworks1.dd @@ -0,0 +1,51 @@ + +.*: file format .* + +Disassembly of section \.plt: + +00080800 <_PROCEDURE_LINKAGE_TABLE_>: + 80800: 3c190008 lui t9,0x8 + 80800: R_MIPS_HI16 _GLOBAL_OFFSET_TABLE_ + 80804: 27391410 addiu t9,t9,5136 + 80804: R_MIPS_LO16 _GLOBAL_OFFSET_TABLE_ + 80808: 8f390008 lw t9,8\(t9\) + 8080c: 00000000 nop + 80810: 03200008 jr t9 + 80814: 00000000 nop + 80818: 1000fff9 b 80800 <_PROCEDURE_LINKAGE_TABLE_> + 8081c: 24180000 li t8,0 + 80820: 3c190008 lui t9,0x8 + 80820: R_MIPS_HI16 _GLOBAL_OFFSET_TABLE_\+0xfffffff0 + 80824: 27391400 addiu t9,t9,5120 + 80824: R_MIPS_LO16 _GLOBAL_OFFSET_TABLE_\+0xfffffff0 + 80828: 8f390000 lw t9,0\(t9\) + 8082c: 00000000 nop + 80830: 03200008 jr t9 + 80834: 00000000 nop + 80838: 1000fff1 b 80800 <_PROCEDURE_LINKAGE_TABLE_> + 8083c: 24180001 li t8,1 + 80840: 3c190008 lui t9,0x8 + 80840: R_MIPS_HI16 _GLOBAL_OFFSET_TABLE_\+0xfffffff4 + 80844: 27391404 addiu t9,t9,5124 + 80844: R_MIPS_LO16 _GLOBAL_OFFSET_TABLE_\+0xfffffff4 + 80848: 8f390000 lw t9,0\(t9\) + 8084c: 00000000 nop + 80850: 03200008 jr t9 + 80854: 00000000 nop +Disassembly of section \.text: + +00080c00 <_start>: + 80c00: 0c020210 jal 80840 <_PROCEDURE_LINKAGE_TABLE_\+0x40> + 80c00: R_MIPS_26 \.plt\+0x40 + 80c04: 00000000 nop + 80c08: 0c020306 jal 80c18 <sexternal> + 80c08: R_MIPS_26 sexternal + 80c0c: 00000000 nop + 80c10: 08020208 j 80820 <_PROCEDURE_LINKAGE_TABLE_\+0x20> + 80c10: R_MIPS_26 \.plt\+0x20 + 80c14: 00000000 nop + +00080c18 <sexternal>: + 80c18: 03e00008 jr ra + 80c1c: 00000000 nop +#pass diff --git a/ld/testsuite/ld-mips-elf/vxworks1.ld b/ld/testsuite/ld-mips-elf/vxworks1.ld new file mode 100644 index 0000000..74e2c26 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/vxworks1.ld @@ -0,0 +1,32 @@ +SECTIONS +{ + . = 0x80000; + .interp : { *(.interp) } + .hash : { *(.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + + . = ALIGN (0x400); + .rela.dyn : { *(.rela.dyn) } + .rela.plt : { *(.rela.plt) } + + . = ALIGN (0x400); + .plt : { *(.plt) } + + . = ALIGN (0x400); + .text : { *(.text) } + + . = ALIGN (0x1000); + .dynamic : { *(.dynamic) } + + . = ALIGN (0x400); + .got : { *(.got.plt) *(.got) } + + . = ALIGN (0x400); + .bss : { *(.bss) *(.dynbss) } + + . = ALIGN (0x400); + .data : { *(.data) } + + /DISCARD/ : { *(.reginfo) } +} diff --git a/ld/testsuite/ld-mips-elf/vxworks1.rd b/ld/testsuite/ld-mips-elf/vxworks1.rd new file mode 100644 index 0000000..f4793a2 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/vxworks1.rd @@ -0,0 +1,32 @@ + +Relocation section '\.rela\.dyn' at offset .* contains 1 entries: + Offset Info Type Sym.Value Sym. Name \+ Addend +00081800 .*7e R_MIPS_COPY 00081800 dglobal \+ 0 + +Relocation section '\.rela\.plt' at offset .* contains 2 entries: + Offset Info Type Sym\.Value Sym\. Name \+ Addend +00081400 .*7f R_MIPS_JUMP_SLOT 00080820 sglobal \+ 0 +00081404 .*7f R_MIPS_JUMP_SLOT 00080840 foo \+ 0 + +Relocation section '\.rela\.text' at offset .* contains 3 entries: + Offset Info Type Sym\.Value Sym\. Name \+ Addend +00080c00 .*04 R_MIPS_26 00080800 \.plt \+ 40 +00080c08 .*04 R_MIPS_26 00080c18 sexternal \+ 0 +00080c10 .*04 R_MIPS_26 00080800 \.plt \+ 20 + +Relocation section '\.rela\.data' at offset .* contains 3 entries: + Offset Info Type Sym.Value Sym. Name \+ Addend +00081c00 .*02 R_MIPS_32 00081c00 .data \+ 0 +00081c04 .*02 R_MIPS_32 00081800 .bss \+ 0 +00081c08 .*02 R_MIPS_32 00081c04 dexternal \+ 0 + +Relocation section '\.rela\.plt\.unloaded' at offset .* contains 8 entries: + Offset Info Type Sym\.Value Sym\. Name \+ Addend +00080800 .*05 R_MIPS_HI16 00081410 _GLOBAL_OFFSET_TABLE_ \+ 0 +00080804 .*06 R_MIPS_LO16 00081410 _GLOBAL_OFFSET_TABLE_ \+ 0 +00081400 .*02 R_MIPS_32 00080800 _PROCEDURE_LINKAGE_TAB.* \+ 18 +00080820 .*05 R_MIPS_HI16 00081410 _GLOBAL_OFFSET_TABLE_ \+ fffffff0 +00080824 .*06 R_MIPS_LO16 00081410 _GLOBAL_OFFSET_TABLE_ \+ fffffff0 +00081404 .*02 R_MIPS_32 00080800 _PROCEDURE_LINKAGE_TAB.* \+ 38 +00080840 .*05 R_MIPS_HI16 00081410 _GLOBAL_OFFSET_TABLE_ \+ fffffff4 +00080844 .*06 R_MIPS_LO16 00081410 _GLOBAL_OFFSET_TABLE_ \+ fffffff4 diff --git a/ld/testsuite/ld-mips-elf/vxworks1.s b/ld/testsuite/ld-mips-elf/vxworks1.s new file mode 100644 index 0000000..33a247f --- /dev/null +++ b/ld/testsuite/ld-mips-elf/vxworks1.s @@ -0,0 +1,27 @@ + .text + .globl _start + .type _start, @function +_start: + jal foo + jal sexternal + j sglobal + .size _start, .-_start + + .globl sexternal + .type sexternal, @function +sexternal: + jr $31 + .size sexternal, .-sexternal + + .data + .type dlocal, @object +dlocal: + .word dlocal + .size dlocal, .-dlocal + + .globl dexternal + .type dexternal, @object +dexternal: + .word dglobal + .word dexternal + .size dexternal, .-dexternal diff --git a/ld/testsuite/ld-mips-elf/vxworks2-static.sd b/ld/testsuite/ld-mips-elf/vxworks2-static.sd new file mode 100644 index 0000000..912755b --- /dev/null +++ b/ld/testsuite/ld-mips-elf/vxworks2-static.sd @@ -0,0 +1,9 @@ +#... +Elf file type is EXEC \(Executable file\) +Entry point 0x80000 +#... +Program Headers: + Type .* + LOAD .* 0x00080000 0x00080000 .* R E 0x1000 + +#... diff --git a/ld/testsuite/ld-mips-elf/vxworks2.s b/ld/testsuite/ld-mips-elf/vxworks2.s new file mode 100644 index 0000000..25f078e --- /dev/null +++ b/ld/testsuite/ld-mips-elf/vxworks2.s @@ -0,0 +1,5 @@ + .globl _start + .type _start, @function +_start: + jr $31 + .size _start, .-_start diff --git a/ld/testsuite/ld-mips-elf/vxworks2.sd b/ld/testsuite/ld-mips-elf/vxworks2.sd new file mode 100644 index 0000000..5ff87d3 --- /dev/null +++ b/ld/testsuite/ld-mips-elf/vxworks2.sd @@ -0,0 +1,13 @@ +#... +Elf file type is EXEC \(Executable file\) +Entry point 0x80400 +#... +Program Headers: + Type .* + PHDR .* +#... + LOAD .* 0x00080000 0x00080000 .* R E 0x1000 + LOAD .* 0x00081000 0x00081000 .* RW 0x1000 + DYNAMIC .* + +#... |