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
|
|
|
#
|
|
|
|
|
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"
|
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"
|
|
|
|
}
|
|
|
|
|
* 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"}
|
|
|
|
}
|
|
|
|
|
|
|
|
if {[istarget mips*-*-linux*]} {
|
|
|
|
run_ld_link_tests $mips_tls_tests
|
|
|
|
}
|
|
|
|
|