2002-01-02 18:59:32 +00:00
|
|
|
# Expect script for MIPS ELF linker tests
|
* ld-mips-elf/tlsbin-o32.s, ld-mips-elf/mips-dyn.ld,
ld-mips-elf/tlslib-o32.got, ld-mips-elf/tlslib-o32.d,
ld-mips-elf/tlslib-o32.s, ld-mips-elf/mips-lib.ld,
ld-mips-elf/tlsbin-o32.got, ld-mips-elf/tlsdyn-o32.d,
ld-mips-elf/tlsdyn-o32.got, ld-mips-elf/tlsbin-o32.d,
ld-mips-elf/tlsdyn-o32.s, ld-mips-elf/tls-multi-got-1.got,
ld-mips-elf/tls-multi-got-1-1.s, ld-mips-elf/tls-multi-got-1.d,
ld-mips-elf/tls-multi-got-1.r, ld-mips-elf/tls-multi-got-1-2.s,
ld-mips-elf/tlslib-o32-ver.got, ld-mips-elf/tlslib.ver,
ld-mips-elf/tlslib-o32-hidden.got, ld-mips-elf/tlslib-hidden.ver,
ld-mips-elf/tlsdyn-o32-1.d, ld-mips-elf/tlsdyn-o32-3.got,
ld-mips-elf/tlsdyn-o32-2.d, ld-mips-elf/tlsdyn-o32-2.s,
ld-mips-elf/tlsdyn-o32-3.d, ld-mips-elf/tlsdyn-o32-1.got,
ld-mips-elf/tlsdyn-o32-2.got: New files.
* ld-mips-elf/mips-elf.exp: Run the new tests.
2005-03-02 21:22:57 +00:00
|
|
|
# Copyright 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
2002-01-02 18:59:32 +00:00
|
|
|
#
|
|
|
|
# This file is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
2005-05-12 07:32:09 +00:00
|
|
|
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
2002-01-02 18:59:32 +00:00
|
|
|
#
|
|
|
|
|
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.
2006-03-22 09:28:15 +00:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2003-06-28 22:14:59 +00:00
|
|
|
if {![istarget mips*-*-*] || ![is_elf_format]} {
|
|
|
|
return
|
|
|
|
}
|
2002-10-03 23:56:24 +00:00
|
|
|
|
2003-06-28 22:14:59 +00:00
|
|
|
set has_newabi [expr [istarget *-*-irix6*] || [istarget mips64*-*-linux*]]
|
|
|
|
set linux_gnu [expr [istarget mips*-*-linux*]]
|
|
|
|
set embedded_elf [expr [istarget mips*-*-elf]]
|
2002-10-03 23:56:24 +00:00
|
|
|
|
|
|
|
|
2003-06-28 22:14:59 +00:00
|
|
|
# Check MIPS16 markings being passed through link.
|
|
|
|
run_dump_test "mips16-1"
|
2003-01-28 00:01:53 +00:00
|
|
|
|
2003-06-28 22:14:59 +00:00
|
|
|
# MIPS branch offset final link checking.
|
|
|
|
run_dump_test "branch-misc-1"
|
2003-04-11 01:56:51 +00:00
|
|
|
|
2005-02-02 20:19:35 +00:00
|
|
|
# Test multi-got link. We only do this on GNU/Linux because it requires
|
|
|
|
# the "traditional" emulations.
|
|
|
|
if { $linux_gnu } {
|
|
|
|
run_dump_test "multi-got-1"
|
2005-03-05 00:01:44 +00:00
|
|
|
run_dump_test "multi-got-no-shared"
|
2005-02-02 20:19:35 +00:00
|
|
|
}
|
2002-10-03 23:56:24 +00:00
|
|
|
|
2003-06-28 22:14:59 +00:00
|
|
|
if $has_newabi {
|
|
|
|
run_dump_test "elf-rel-got-n32"
|
|
|
|
run_dump_test "elf-rel-xgot-n32"
|
2003-03-11 19:20:16 +00:00
|
|
|
if { $linux_gnu } {
|
2003-06-28 22:14:59 +00:00
|
|
|
run_dump_test "elf-rel-got-n64-linux"
|
|
|
|
run_dump_test "elf-rel-xgot-n64-linux"
|
|
|
|
} else {
|
|
|
|
run_dump_test "elf-rel-got-n64"
|
|
|
|
run_dump_test "elf-rel-xgot-n64"
|
2003-03-11 19:20:16 +00:00
|
|
|
}
|
|
|
|
|
2003-06-28 22:14:59 +00:00
|
|
|
run_dump_test "relax-jalr-n32"
|
|
|
|
run_dump_test "relax-jalr-n32-shared"
|
|
|
|
run_dump_test "relax-jalr-n64"
|
|
|
|
run_dump_test "relax-jalr-n64-shared"
|
|
|
|
}
|
2003-03-11 19:20:16 +00:00
|
|
|
|
2003-06-28 22:14:59 +00:00
|
|
|
if { $linux_gnu } {
|
|
|
|
run_dump_test "rel32-o32"
|
|
|
|
run_dump_test "rel32-n32"
|
|
|
|
run_dump_test "rel64"
|
|
|
|
}
|
2002-01-02 18:59:32 +00:00
|
|
|
|
2003-06-28 22:14:59 +00:00
|
|
|
if { $embedded_elf } {
|
|
|
|
run_dump_test "region1"
|
2002-01-02 18:59:32 +00:00
|
|
|
}
|
2003-12-18 10:25:12 +00:00
|
|
|
|
|
|
|
if $embedded_elf {
|
|
|
|
# This could work on other targets too, but would need the appropriate
|
|
|
|
# ld -m switch.
|
|
|
|
run_dump_test "reloc-1-rel"
|
|
|
|
}
|
|
|
|
if $has_newabi {
|
|
|
|
run_dump_test "reloc-1-n32"
|
|
|
|
if $linux_gnu {
|
|
|
|
# Uses a linux-specific ld -m switch
|
|
|
|
run_dump_test "reloc-1-n64"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
run_dump_test "reloc-2"
|
2004-07-08 15:43:00 +00:00
|
|
|
run_dump_test "reloc-merge-lo16"
|
2006-09-18 18:21:42 +00:00
|
|
|
run_dump_test "reloc-3"
|
|
|
|
if {$has_newabi} {
|
|
|
|
run_dump_test "reloc-3-n32"
|
|
|
|
}
|
2004-11-16 10:16:30 +00:00
|
|
|
if {$has_newabi && $linux_gnu} {
|
|
|
|
run_dump_test "eh-frame1-n32"
|
|
|
|
run_dump_test "eh-frame1-n64"
|
2005-01-17 17:44:41 +00:00
|
|
|
run_dump_test "eh-frame2-n32"
|
|
|
|
run_dump_test "eh-frame2-n64"
|
2004-11-16 10:16:30 +00:00
|
|
|
}
|
2005-01-31 20:39:11 +00:00
|
|
|
if {$embedded_elf} {
|
|
|
|
run_dump_test "eh-frame3"
|
|
|
|
run_dump_test "eh-frame4"
|
|
|
|
}
|
2004-12-08 20:28:08 +00:00
|
|
|
|
|
|
|
run_dump_test "jaloverflow"
|
2004-12-14 09:48:20 +00:00
|
|
|
run_dump_test "jaloverflow-2"
|
2004-12-13 13:09:55 +00:00
|
|
|
if {$has_newabi} {
|
|
|
|
run_dump_test "jalbal"
|
|
|
|
}
|
bfd/:
2005-02-15 Nigel Stephens <nigel@mips.com>
Maciej W. Rozycki <macro@mips.com>
* elf32-mips.c (elf_mips16_howto_table_rel): New array for MIPS16
reloc howtos. Add R_MIPS16_HI16 and R_MIPS16_LO16 relocs and
R_MIPS16_GOT16 and R_MIPS16_CALL16 placeholders.
(elf_mips16_jump_howto): Move into elf_mips16_howto_table_rel.
(elf_mips16_gprel_howto): Likewise. Redefine src_mask and
dst_mask.
(mips16_gprel_reloc): Remove bit shuffling; call
_bfd_mips16_elf_reloc_unshuffle(), _bfd_mips_elf_gprel16_with_gp()
and _bfd_mips16_elf_reloc_shuffle() instead.
(mips16_reloc_map): New reloc map for MIPS16 relocs.
(bfd_elf32_bfd_reloc_type_lookup): Use mips16_reloc_map for MIPS16
relocs.
(mips_elf32_rtype_to_howto): Fetch MIPS16 howtos from
elf_mips16_howto_table_rel.
* elf64-mips.c (mips16_elf64_howto_table_rel): New array for
MIPS16 REL reloc howtos. Add R_MIPS16_HI16 and R_MIPS16_LO16
relocs and R_MIPS16_GOT16 and R_MIPS16_CALL16 placeholders.
(elf_mips16_jump_howto): Move into mips16_elf64_howto_table_rel.
(elf_mips16_gprel_howto): Likewise. Redefine src_mask and
dst_mask.
(mips16_elf64_howto_table_rela): New array for MIPS16 RELA
reloc howtos. Add R_MIPS16_26, R_MIPS16_GPREL, R_MIPS16_HI16 and
R_MIPS16_LO16 relocs and R_MIPS16_GOT16 and R_MIPS16_CALL16
placeholders.
(mips16_gprel_reloc): Remove bit shuffling; call
_bfd_mips16_elf_reloc_unshuffle(), _bfd_mips_elf_gprel16_with_gp()
and _bfd_mips16_elf_reloc_shuffle() instead.
(mips16_reloc_map): New reloc map for MIPS16 relocs.
(bfd_elf64_bfd_reloc_type_lookup): Use mips16_reloc_map for MIPS16
relocs.
(mips_elf64_rtype_to_howto): Fetch MIPS16 howtos from
mips16_elf64_howto_table_rela or mips16_elf64_howto_table_rel.
* elfn32-mips.c (elf_mips16_howto_table_rel): New array for MIPS16
REL reloc howtos. Add R_MIPS16_HI16 and R_MIPS16_LO16 relocs and
R_MIPS16_GOT16 and R_MIPS16_CALL16 placeholders.
(elf_mips16_jump_howto): Move into elf_mips16_howto_table_rel.
(elf_mips16_gprel_howto): Likewise. Redefine src_mask and
dst_mask.
(mips16_gprel_reloc): Remove bit shuffling; call
_bfd_mips16_elf_reloc_unshuffle(), _bfd_mips_elf_gprel16_with_gp()
and _bfd_mips16_elf_reloc_shuffle() instead.
(mips16_reloc_map): New reloc map for MIPS16 relocs.
(bfd_elf32_bfd_reloc_type_lookup): Use mips16_reloc_map for MIPS16
relocs.
(mips_elf_n32_rtype_to_howto): Fetch MIPS16 howtos from
elf_mips16_howto_table_rela or elf_mips16_howto_table_rel.
* elfxx-mips.c (_bfd_mips16_elf_reloc_unshuffle): New function to
handle bit shuffling for MIPS16 relocs.
(_bfd_mips16_elf_reloc_shuffle): Likewise.
(_bfd_mips_elf_lo16_reloc): Use _bfd_mips16_elf_reloc_unshuffle()
and _bfd_mips16_elf_reloc_shuffle().
(_bfd_mips_elf_generic_reloc): Likewise.
(mips_elf_calculate_relocation): Likewise. Handle R_MIPS16_HI16
and R_MIPS16_LO16.
(mips_elf_obtain_contents): Remove bit shuffling.
(mips_elf_perform_relocation): Likewise; call
_bfd_mips16_elf_reloc_unshuffle() and _bfd_mips16_elf_reloc_shuffle()
instead.
(_bfd_mips_elf_relocate_section): Likewise. Handle R_MIPS16_HI16
and R_MIPS16_LO16.
* elfxx-mips.h (_bfd_mips16_elf_reloc_unshuffle): Declare.
(_bfd_mips16_elf_reloc_shuffle): Likewise.
* reloc.c (BFD_RELOC_MIPS16_HI16): New reloc.
(BFD_RELOC_MIPS16_HI16_S): Likewise.
(BFD_RELOC_MIPS16_LO16): Likewise.
* bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.
gas/:
2005-02-15 Nigel Stephens <nigel@mips.com>
Maciej W. Rozycki <macro@mips.com>
* config/tc-mips.c (reloc_needs_lo_p): Handle
BFD_RELOC_MIPS16_HI16_S.
(fixup_has_matching_lo_p): Handle BFD_RELOC_MIPS16_LO16.
(append_insn): Add BFD_RELOC_MIPS16_GPREL, BFD_RELOC_MIPS16_HI16_S
and BFD_RELOC_MIPS16_LO16 to relocs to suppress overflow
complaints on.
(mips16_ip): Resolve BFD_RELOC_MIPS16_HI16_S,
BFD_RELOC_MIPS16_HI16 and BFD_RELOC_MIPS16_LO16 for constants.
Call my_getSmallExpression() to parse percent operators.
(percent_op_match, mips_percent_op): Separate definitions.
(mips16_percent_op): Define percent operators for the MIPS16 mode.
(parse_relocation): Handle the MIPS16 mode using
mips16_percent_op.
(md_apply_fix3): Handle BFD_RELOC_MIPS16_HI16,
BFD_RELOC_MIPS16_HI16_S and BFD_RELOC_MIPS16_LO16.
gas/testsuite/:
2005-02-15 Nigel Stephens <nigel@mips.com>
Maciej W. Rozycki <macro@mips.com>
* gas/mips/mips16-hilo.d: New test for the R_MIPS16_HI16 and
R_MIPS16_LO16 relocs.
* gas/mips/mips16-hilo-n32.d: Likewise, for the n32 ABI.
* gas/mips/mips16-hilo.s: Source for the new tests.
* gas/mips/mips.exp: Run the new tests.
include/:
2005-02-15 Nigel Stephens <nigel@mips.com>
Maciej W. Rozycki <macro@mips.com>
* elf/mips.h (R_MIPS16_GOT16): New reloc code.
(R_MIPS16_CALL16): Likewise.
(R_MIPS16_HI16): Likewise.
(R_MIPS16_LO16): Likewise.
(R_MIPS16_min): New fake reloc code.
(R_MIPS16_max): Likewise.
ld/testsuite/:
2005-02-15 Nigel Stephens <nigel@mips.com>
Maciej W. Rozycki <macro@mips.com>
* ld-mips-elf/mips16-hilo.d: New test for the R_MIPS16_HI16 and
R_MIPS16_LO16 relocs.
* ld-mips-elf/mips16-hilo-n32.d: Likewise, for the n32 ABI.
* ld-mips-elf/mips16-hilo.s: Auxiliary source for the new tests.
* ld-mips-elf/mips-elf.exp: Run the new tests.
2005-02-15 19:57:54 +00:00
|
|
|
|
|
|
|
run_dump_test "mips16-hilo"
|
|
|
|
if {$has_newabi} {
|
|
|
|
run_dump_test "mips16-hilo-n32"
|
|
|
|
}
|
* ld-mips-elf/tlsbin-o32.s, ld-mips-elf/mips-dyn.ld,
ld-mips-elf/tlslib-o32.got, ld-mips-elf/tlslib-o32.d,
ld-mips-elf/tlslib-o32.s, ld-mips-elf/mips-lib.ld,
ld-mips-elf/tlsbin-o32.got, ld-mips-elf/tlsdyn-o32.d,
ld-mips-elf/tlsdyn-o32.got, ld-mips-elf/tlsbin-o32.d,
ld-mips-elf/tlsdyn-o32.s, ld-mips-elf/tls-multi-got-1.got,
ld-mips-elf/tls-multi-got-1-1.s, ld-mips-elf/tls-multi-got-1.d,
ld-mips-elf/tls-multi-got-1.r, ld-mips-elf/tls-multi-got-1-2.s,
ld-mips-elf/tlslib-o32-ver.got, ld-mips-elf/tlslib.ver,
ld-mips-elf/tlslib-o32-hidden.got, ld-mips-elf/tlslib-hidden.ver,
ld-mips-elf/tlsdyn-o32-1.d, ld-mips-elf/tlsdyn-o32-3.got,
ld-mips-elf/tlsdyn-o32-2.d, ld-mips-elf/tlsdyn-o32-2.s,
ld-mips-elf/tlsdyn-o32-3.d, ld-mips-elf/tlsdyn-o32-1.got,
ld-mips-elf/tlsdyn-o32-2.got: New files.
* ld-mips-elf/mips-elf.exp: Run the new tests.
2005-03-02 21:22:57 +00:00
|
|
|
|
2005-03-24 01:30:47 +00:00
|
|
|
if { $linux_gnu } {
|
|
|
|
run_dump_test "textrel-1"
|
|
|
|
}
|
|
|
|
|
2006-03-14 07:47:49 +00:00
|
|
|
if $has_newabi {
|
|
|
|
run_dump_test "emit-relocs-1"
|
|
|
|
}
|
|
|
|
|
2006-07-29 08:48:15 +00:00
|
|
|
run_dump_test "hash1a"
|
|
|
|
run_dump_test "hash1b"
|
|
|
|
run_dump_test "hash1c"
|
|
|
|
|
2006-06-11 08:33:27 +00:00
|
|
|
if {[istarget mips*-*-linux*]} {
|
|
|
|
# The number of symbols that are always included in the symbol table
|
2006-10-17 13:41:49 +00:00
|
|
|
# for these tests. The 4 are:
|
2006-06-11 08:33:27 +00:00
|
|
|
#
|
|
|
|
# the null symbol entry
|
|
|
|
# the .MIPS.stubs section symbol
|
|
|
|
# _gp
|
|
|
|
# _GLOBAL_OFFSET_TABLE_
|
2006-10-17 13:41:49 +00:00
|
|
|
set base_syms 4
|
2006-06-11 08:33:27 +00:00
|
|
|
foreach dynsym { 7fff 8000 fff0 10000 2fe80 } {
|
|
|
|
run_ld_link_tests \
|
|
|
|
[list [list \
|
|
|
|
"Stub for dynsym 0x$dynsym" \
|
|
|
|
"-shared -melf32btsmip -T stub-dynsym-1.ld" \
|
|
|
|
[concat \
|
|
|
|
"-EB -march=mips1 -32 -KPIC" \
|
|
|
|
"--defsym base_syms=$base_syms" \
|
|
|
|
"--defsym dynsym=0x$dynsym"] \
|
|
|
|
[list "stub-dynsym-1.s"] \
|
|
|
|
[list [list \
|
|
|
|
"objdump" "-dz" \
|
|
|
|
"stub-dynsym-1-$dynsym.d"]] \
|
|
|
|
"stub-dynsym-1-$dynsym"]]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
* ld-mips-elf/tlsbin-o32.s, ld-mips-elf/mips-dyn.ld,
ld-mips-elf/tlslib-o32.got, ld-mips-elf/tlslib-o32.d,
ld-mips-elf/tlslib-o32.s, ld-mips-elf/mips-lib.ld,
ld-mips-elf/tlsbin-o32.got, ld-mips-elf/tlsdyn-o32.d,
ld-mips-elf/tlsdyn-o32.got, ld-mips-elf/tlsbin-o32.d,
ld-mips-elf/tlsdyn-o32.s, ld-mips-elf/tls-multi-got-1.got,
ld-mips-elf/tls-multi-got-1-1.s, ld-mips-elf/tls-multi-got-1.d,
ld-mips-elf/tls-multi-got-1.r, ld-mips-elf/tls-multi-got-1-2.s,
ld-mips-elf/tlslib-o32-ver.got, ld-mips-elf/tlslib.ver,
ld-mips-elf/tlslib-o32-hidden.got, ld-mips-elf/tlslib-hidden.ver,
ld-mips-elf/tlsdyn-o32-1.d, ld-mips-elf/tlsdyn-o32-3.got,
ld-mips-elf/tlsdyn-o32-2.d, ld-mips-elf/tlsdyn-o32-2.s,
ld-mips-elf/tlsdyn-o32-3.d, ld-mips-elf/tlsdyn-o32-1.got,
ld-mips-elf/tlsdyn-o32-2.got: New files.
* ld-mips-elf/mips-elf.exp: Run the new tests.
2005-03-02 21:22:57 +00:00
|
|
|
# For tests which may involve multiple files, use run_ld_link_tests.
|
|
|
|
|
|
|
|
# List contains test-items with 3 items followed by 2 lists:
|
|
|
|
# 0:name 1:ld options 2:assembler options
|
|
|
|
# 3:filenames of assembler files 4: action and options. 5: name of output file
|
|
|
|
|
|
|
|
# Actions:
|
|
|
|
# objdump: Apply objdump options on result. Compare with regex (last arg).
|
|
|
|
# nm: Apply nm options on result. Compare with regex (last arg).
|
|
|
|
# readelf: Apply readelf options on result. Compare with regex (last arg).
|
|
|
|
|
|
|
|
set mips_tls_tests {
|
|
|
|
{"Static executable with TLS" "-static -melf32btsmip -T mips-dyn.ld"
|
|
|
|
"-EB -march=mips1 -32 -KPIC" {tlsbin-o32.s}
|
|
|
|
{{objdump {-dr -m mips:isa32r2} tlsbin-o32.d} {objdump -srj.got tlsbin-o32.got}}
|
|
|
|
"tls-static-o32"}
|
|
|
|
{"Shared library with TLS" "-shared -melf32btsmip -T mips-lib.ld"
|
|
|
|
"-EB -march=mips1 -32 -KPIC" {tlslib-o32.s}
|
|
|
|
{{objdump {-dr -m mips:isa32r2} tlslib-o32.d} {objdump -Rsj.got tlslib-o32.got}}
|
|
|
|
"tlslib-o32.so"}
|
|
|
|
{"Dynamic executable with TLS"
|
|
|
|
"-melf32btsmip -T mips-dyn.ld tmpdir/tlslib-o32.so"
|
|
|
|
"-EB -march=mips1 -32 -KPIC" {tlsdyn-o32.s}
|
|
|
|
{{objdump {-dr -m mips:isa32r2} tlsdyn-o32.d} {objdump -Rsj.got tlsdyn-o32.got}}
|
|
|
|
"tls-dynamic-o32"}
|
|
|
|
{"Shared library with multiple GOTs and TLS"
|
|
|
|
"-shared -melf32btsmip -T mips-lib.ld"
|
|
|
|
"-EB -march=mips1 -32 -KPIC" {tls-multi-got-1-1.s tls-multi-got-1-2.s}
|
|
|
|
{{readelf {-d -r} tls-multi-got-1.r}
|
|
|
|
{objdump {-dr -m mips:isa32r2} tls-multi-got-1.d}
|
|
|
|
{objdump -Rsj.got tls-multi-got-1.got}}
|
|
|
|
"tlslib-multi.so"}
|
|
|
|
{"Shared library with TLS and versioning"
|
|
|
|
"-shared -melf32btsmip -T mips-lib.ld --version-script tlslib.ver"
|
|
|
|
"-EB -march=mips1 -32 -KPIC" {tlslib-o32.s}
|
|
|
|
{{objdump {-dr -m mips:isa32r2} tlslib-o32.d} {objdump -Rsj.got tlslib-o32-ver.got}}
|
|
|
|
"tlslib-o32-ver.so"}
|
|
|
|
{"Dynamic executable with TLS and versioning"
|
|
|
|
"-melf32btsmip -T mips-dyn.ld tmpdir/tlslib-o32-ver.so"
|
|
|
|
"-EB -march=mips1 -32 -KPIC" {tlsdyn-o32.s tlsdyn-o32-2.s}
|
|
|
|
{{objdump {-dr -m mips:isa32r2} tlsdyn-o32-1.d} {objdump -Rsj.got tlsdyn-o32-1.got}}
|
|
|
|
"tls-dynamic-o32-ver"}
|
|
|
|
{"Dynamic executable with TLS and versioning (order 2)"
|
|
|
|
"-melf32btsmip -T mips-dyn.ld tmpdir/tlsdyn-o32.o tmpdir/tlslib-o32-ver.so tmpdir/tlsdyn-o32-2.o"
|
|
|
|
"-EB -march=mips1 -32 -KPIC" {}
|
|
|
|
{{objdump {-dr -m mips:isa32r2} tlsdyn-o32-2.d} {objdump -Rsj.got tlsdyn-o32-2.got}}
|
|
|
|
"tls-dynamic-o32-ver-2"}
|
|
|
|
{"Dynamic executable with TLS and versioning (order 3)"
|
|
|
|
"-melf32btsmip -T mips-dyn.ld tmpdir/tlsdyn-o32-2.o tmpdir/tlslib-o32-ver.so tmpdir/tlsdyn-o32.o"
|
|
|
|
"-EB -march=mips1 -32 -KPIC" {}
|
|
|
|
{{objdump {-dr -m mips:isa32r2} tlsdyn-o32-3.d} {objdump -Rsj.got tlsdyn-o32-3.got}}
|
|
|
|
"tls-dynamic-o32-ver-3"}
|
|
|
|
{"Shared library with TLS and hidden symbols"
|
|
|
|
"-shared -melf32btsmip -T mips-lib.ld --version-script tlslib-hidden.ver"
|
|
|
|
"-EB -march=mips1 -32 -KPIC" {tlslib-o32.s}
|
|
|
|
{{objdump {-dr -m mips:isa32r2} tlslib-o32.d} {objdump -Rsj.got tlslib-o32-hidden.got}}
|
|
|
|
"tlslib-o32-hidden.so"}
|
2006-02-04 08:29:58 +00:00
|
|
|
{"Shared library with TLS and hidden symbols (2)"
|
|
|
|
"-shared -melf32btsmip -T mips-lib.ld"
|
|
|
|
"-EB -march=mips1 -32 -KPIC" {tls-hidden2a.s tls-hidden2b.s}
|
|
|
|
{{objdump -drj.text tls-hidden2.d} {objdump -sj.got tls-hidden2-got.d}}
|
|
|
|
"tls-hidden2.so"}
|
* elfxx-mips.c (mips_got_entry): Add more commentary.
(mips_elf_local_got_index): Use the hash table entry to record
the GOT index of forced-local symbols.
(mips_elf_initialize_tls_index): Rearrange code. Store the index
in either the hash table entry or the mips_got_entry, not both.
Add more commentary.
(mips_elf_multi_got): Make sure the g->next is nonnull when calling
mips_elf_initialize_tls_index.
* ld-mips-elf/tls-hidden3a.s, ld-mips-elf/tls-hidden3b.s,
* ld-mips-elf/tls-hidden3.d, ld-mips-elf/tls-hidden3.got,
* ld-mips-elf/tls-hidden3.ld, ld-mips-elf/tls-hidden3.r,
* ld-mips-elf/tls-hidden4a.s, ld-mips-elf/tls-hidden4b.s,
* ld-mips-elf/tls-hidden4.got, ld-mips-elf/tls-hidden4.r: New tests.
* ld-mips-elf/mips-elf.exp: Run them.
2006-03-27 11:30:54 +00:00
|
|
|
{"Shared library with TLS and hidden symbols (3)"
|
|
|
|
"-shared -melf32btsmip -T tls-hidden3.ld"
|
|
|
|
"-EB -march=mips2 -32 -KPIC" {tls-hidden3a.s tls-hidden3b.s}
|
|
|
|
{{objdump -dj.text tls-hidden3.d} {objdump -sj.got tls-hidden3.got}
|
|
|
|
{readelf --relocs tls-hidden3.r}}
|
|
|
|
"tls-hidden3.so"}
|
|
|
|
{"Shared library with TLS and hidden symbols (4)"
|
|
|
|
"-shared -melf32btsmip -T tls-hidden3.ld"
|
|
|
|
"-EB -march=mips2 -32 -KPIC" {tls-hidden4a.s tls-hidden4b.s}
|
|
|
|
{{objdump -sj.got tls-hidden4.got} {readelf --relocs tls-hidden4.r}}
|
|
|
|
"tls-hidden4.so"}
|
* ld-mips-elf/tlsbin-o32.s, ld-mips-elf/mips-dyn.ld,
ld-mips-elf/tlslib-o32.got, ld-mips-elf/tlslib-o32.d,
ld-mips-elf/tlslib-o32.s, ld-mips-elf/mips-lib.ld,
ld-mips-elf/tlsbin-o32.got, ld-mips-elf/tlsdyn-o32.d,
ld-mips-elf/tlsdyn-o32.got, ld-mips-elf/tlsbin-o32.d,
ld-mips-elf/tlsdyn-o32.s, ld-mips-elf/tls-multi-got-1.got,
ld-mips-elf/tls-multi-got-1-1.s, ld-mips-elf/tls-multi-got-1.d,
ld-mips-elf/tls-multi-got-1.r, ld-mips-elf/tls-multi-got-1-2.s,
ld-mips-elf/tlslib-o32-ver.got, ld-mips-elf/tlslib.ver,
ld-mips-elf/tlslib-o32-hidden.got, ld-mips-elf/tlslib-hidden.ver,
ld-mips-elf/tlsdyn-o32-1.d, ld-mips-elf/tlsdyn-o32-3.got,
ld-mips-elf/tlsdyn-o32-2.d, ld-mips-elf/tlsdyn-o32-2.s,
ld-mips-elf/tlsdyn-o32-3.d, ld-mips-elf/tlsdyn-o32-1.got,
ld-mips-elf/tlsdyn-o32-2.got: New files.
* ld-mips-elf/mips-elf.exp: Run the new tests.
2005-03-02 21:22:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if {[istarget mips*-*-linux*]} {
|
|
|
|
run_ld_link_tests $mips_tls_tests
|
|
|
|
}
|
|
|
|
|
2006-07-20 16:46:30 +00:00
|
|
|
set mips16_call_global_test {
|
|
|
|
{"Global calls from mips16"
|
|
|
|
""
|
|
|
|
"-mips32r2" {mips16-call-global-1.s mips16-call-global-2.s mips16-call-global-3.s}
|
|
|
|
{{objdump -dr mips16-call-global.d}}
|
|
|
|
"mips16-call-global"}
|
|
|
|
}
|
|
|
|
|
|
|
|
run_ld_link_tests $mips16_call_global_test
|