| 1 |
# Expect script for MIPS ELF linker tests |
| 2 |
# Copyright 2002, 2003, 2004, 2005 Free Software Foundation, Inc. |
| 3 |
# |
| 4 |
# This file is free software; you can redistribute it and/or modify |
| 5 |
# it under the terms of the GNU General Public License as published by |
| 6 |
# the Free Software Foundation; either version 2 of the License, or |
| 7 |
# (at your option) any later version. |
| 8 |
# |
| 9 |
# This program is distributed in the hope that it will be useful, |
| 10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
# GNU General Public License for more details. |
| 13 |
# |
| 14 |
# You should have received a copy of the GNU General Public License |
| 15 |
# along with this program; if not, write to the Free Software |
| 16 |
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 17 |
# |
| 18 |
|
| 19 |
if {![istarget mips*-*-*] || ![is_elf_format]} { |
| 20 |
return |
| 21 |
} |
| 22 |
|
| 23 |
set has_newabi [expr [istarget *-*-irix6*] || [istarget mips64*-*-linux*]] |
| 24 |
set linux_gnu [expr [istarget mips*-*-linux*]] |
| 25 |
set embedded_elf [expr [istarget mips*-*-elf]] |
| 26 |
|
| 27 |
|
| 28 |
# Check MIPS16 markings being passed through link. |
| 29 |
run_dump_test "mips16-1" |
| 30 |
|
| 31 |
# MIPS branch offset final link checking. |
| 32 |
run_dump_test "branch-misc-1" |
| 33 |
|
| 34 |
# Test multi-got link. We only do this on GNU/Linux because it requires |
| 35 |
# the "traditional" emulations. |
| 36 |
if { $linux_gnu } { |
| 37 |
run_dump_test "multi-got-1" |
| 38 |
run_dump_test "multi-got-no-shared" |
| 39 |
} |
| 40 |
|
| 41 |
if $has_newabi { |
| 42 |
run_dump_test "elf-rel-got-n32" |
| 43 |
run_dump_test "elf-rel-xgot-n32" |
| 44 |
if { $linux_gnu } { |
| 45 |
run_dump_test "elf-rel-got-n64-linux" |
| 46 |
run_dump_test "elf-rel-xgot-n64-linux" |
| 47 |
} else { |
| 48 |
run_dump_test "elf-rel-got-n64" |
| 49 |
run_dump_test "elf-rel-xgot-n64" |
| 50 |
} |
| 51 |
|
| 52 |
run_dump_test "relax-jalr-n32" |
| 53 |
run_dump_test "relax-jalr-n32-shared" |
| 54 |
run_dump_test "relax-jalr-n64" |
| 55 |
run_dump_test "relax-jalr-n64-shared" |
| 56 |
} |
| 57 |
|
| 58 |
if { $linux_gnu } { |
| 59 |
run_dump_test "rel32-o32" |
| 60 |
run_dump_test "rel32-n32" |
| 61 |
run_dump_test "rel64" |
| 62 |
} |
| 63 |
|
| 64 |
if { $embedded_elf } { |
| 65 |
run_dump_test "region1" |
| 66 |
} |
| 67 |
|
| 68 |
if $embedded_elf { |
| 69 |
# This could work on other targets too, but would need the appropriate |
| 70 |
# ld -m switch. |
| 71 |
run_dump_test "reloc-1-rel" |
| 72 |
} |
| 73 |
if $has_newabi { |
| 74 |
run_dump_test "reloc-1-n32" |
| 75 |
if $linux_gnu { |
| 76 |
# Uses a linux-specific ld -m switch |
| 77 |
run_dump_test "reloc-1-n64" |
| 78 |
} |
| 79 |
} |
| 80 |
run_dump_test "reloc-2" |
| 81 |
run_dump_test "reloc-merge-lo16" |
| 82 |
if {$has_newabi && $linux_gnu} { |
| 83 |
run_dump_test "eh-frame1-n32" |
| 84 |
run_dump_test "eh-frame1-n64" |
| 85 |
run_dump_test "eh-frame2-n32" |
| 86 |
run_dump_test "eh-frame2-n64" |
| 87 |
} |
| 88 |
if {$embedded_elf} { |
| 89 |
run_dump_test "eh-frame3" |
| 90 |
run_dump_test "eh-frame4" |
| 91 |
} |
| 92 |
|
| 93 |
run_dump_test "jaloverflow" |
| 94 |
run_dump_test "jaloverflow-2" |
| 95 |
if {$has_newabi} { |
| 96 |
run_dump_test "jalbal" |
| 97 |
} |
| 98 |
|
| 99 |
run_dump_test "mips16-hilo" |
| 100 |
if {$has_newabi} { |
| 101 |
run_dump_test "mips16-hilo-n32" |
| 102 |
} |
| 103 |
|
| 104 |
# For tests which may involve multiple files, use run_ld_link_tests. |
| 105 |
|
| 106 |
# List contains test-items with 3 items followed by 2 lists: |
| 107 |
# 0:name 1:ld options 2:assembler options |
| 108 |
# 3:filenames of assembler files 4: action and options. 5: name of output file |
| 109 |
|
| 110 |
# Actions: |
| 111 |
# objdump: Apply objdump options on result. Compare with regex (last arg). |
| 112 |
# nm: Apply nm options on result. Compare with regex (last arg). |
| 113 |
# readelf: Apply readelf options on result. Compare with regex (last arg). |
| 114 |
|
| 115 |
set mips_tls_tests { |
| 116 |
{"Static executable with TLS" "-static -melf32btsmip -T mips-dyn.ld" |
| 117 |
"-EB -march=mips1 -32 -KPIC" {tlsbin-o32.s} |
| 118 |
{{objdump {-dr -m mips:isa32r2} tlsbin-o32.d} {objdump -srj.got tlsbin-o32.got}} |
| 119 |
"tls-static-o32"} |
| 120 |
{"Shared library with TLS" "-shared -melf32btsmip -T mips-lib.ld" |
| 121 |
"-EB -march=mips1 -32 -KPIC" {tlslib-o32.s} |
| 122 |
{{objdump {-dr -m mips:isa32r2} tlslib-o32.d} {objdump -Rsj.got tlslib-o32.got}} |
| 123 |
"tlslib-o32.so"} |
| 124 |
{"Dynamic executable with TLS" |
| 125 |
"-melf32btsmip -T mips-dyn.ld tmpdir/tlslib-o32.so" |
| 126 |
"-EB -march=mips1 -32 -KPIC" {tlsdyn-o32.s} |
| 127 |
{{objdump {-dr -m mips:isa32r2} tlsdyn-o32.d} {objdump -Rsj.got tlsdyn-o32.got}} |
| 128 |
"tls-dynamic-o32"} |
| 129 |
{"Shared library with multiple GOTs and TLS" |
| 130 |
"-shared -melf32btsmip -T mips-lib.ld" |
| 131 |
"-EB -march=mips1 -32 -KPIC" {tls-multi-got-1-1.s tls-multi-got-1-2.s} |
| 132 |
{{readelf {-d -r} tls-multi-got-1.r} |
| 133 |
{objdump {-dr -m mips:isa32r2} tls-multi-got-1.d} |
| 134 |
{objdump -Rsj.got tls-multi-got-1.got}} |
| 135 |
"tlslib-multi.so"} |
| 136 |
{"Shared library with TLS and versioning" |
| 137 |
"-shared -melf32btsmip -T mips-lib.ld --version-script tlslib.ver" |
| 138 |
"-EB -march=mips1 -32 -KPIC" {tlslib-o32.s} |
| 139 |
{{objdump {-dr -m mips:isa32r2} tlslib-o32.d} {objdump -Rsj.got tlslib-o32-ver.got}} |
| 140 |
"tlslib-o32-ver.so"} |
| 141 |
{"Dynamic executable with TLS and versioning" |
| 142 |
"-melf32btsmip -T mips-dyn.ld tmpdir/tlslib-o32-ver.so" |
| 143 |
"-EB -march=mips1 -32 -KPIC" {tlsdyn-o32.s tlsdyn-o32-2.s} |
| 144 |
{{objdump {-dr -m mips:isa32r2} tlsdyn-o32-1.d} {objdump -Rsj.got tlsdyn-o32-1.got}} |
| 145 |
"tls-dynamic-o32-ver"} |
| 146 |
{"Dynamic executable with TLS and versioning (order 2)" |
| 147 |
"-melf32btsmip -T mips-dyn.ld tmpdir/tlsdyn-o32.o tmpdir/tlslib-o32-ver.so tmpdir/tlsdyn-o32-2.o" |
| 148 |
"-EB -march=mips1 -32 -KPIC" {} |
| 149 |
{{objdump {-dr -m mips:isa32r2} tlsdyn-o32-2.d} {objdump -Rsj.got tlsdyn-o32-2.got}} |
| 150 |
"tls-dynamic-o32-ver-2"} |
| 151 |
{"Dynamic executable with TLS and versioning (order 3)" |
| 152 |
"-melf32btsmip -T mips-dyn.ld tmpdir/tlsdyn-o32-2.o tmpdir/tlslib-o32-ver.so tmpdir/tlsdyn-o32.o" |
| 153 |
"-EB -march=mips1 -32 -KPIC" {} |
| 154 |
{{objdump {-dr -m mips:isa32r2} tlsdyn-o32-3.d} {objdump -Rsj.got tlsdyn-o32-3.got}} |
| 155 |
"tls-dynamic-o32-ver-3"} |
| 156 |
{"Shared library with TLS and hidden symbols" |
| 157 |
"-shared -melf32btsmip -T mips-lib.ld --version-script tlslib-hidden.ver" |
| 158 |
"-EB -march=mips1 -32 -KPIC" {tlslib-o32.s} |
| 159 |
{{objdump {-dr -m mips:isa32r2} tlslib-o32.d} {objdump -Rsj.got tlslib-o32-hidden.got}} |
| 160 |
"tlslib-o32-hidden.so"} |
| 161 |
} |
| 162 |
|
| 163 |
if {[istarget mips*-*-linux*]} { |
| 164 |
run_ld_link_tests $mips_tls_tests |
| 165 |
} |
| 166 |
|