]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - binutils/testsuite/binutils-all/mips/mips.exp
Update year range in copyright notice of binutils files
[thirdparty/binutils-gdb.git] / binutils / testsuite / binutils-all / mips / mips.exp
CommitLineData
250d07de 1# Copyright (C) 2013-2021 Free Software Foundation, Inc.
5417f71e
MR
2
3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation; either version 3 of the License, or
6# (at your option) any later version.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program; if not, write to the Free Software
15# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
16# MA 02110-1301, USA.
17
dd47d677 18if {![istarget mips*-*-*] || ![is_elf_format]} {
5417f71e
MR
19 return
20}
21
40e5240e
MR
22if [is_remote host] {
23 set tempfile [remote_download host tmpdir/bintest.o]
24 set copyfile copy
25} else {
26 set tempfile tmpdir/bintest.o
27 set copyfile tmpdir/copy
28}
29
3abf9758
MR
30# run_dump_test_abi ABI NAME ARGS
31#
32# Invoke "run_dump_test" for test NAME using ABI if supported by the
33# target used, passing predefined ABI-specific arguments. ARGS are
34# as with "run_dump_test" and are appended to ABI-specific arguments,
35# except for the special "noarch" keyword, which, if present, must
36# appear first and is consumed causing any "-march=" option to be
37# removed from ABI-specific GAS arguments, and likewise the special
38# "useld" keyword, which, if present, must be next and is consumed
39# causing LD arguments to be passed.
40proc run_dump_test_abi { abi name args } {
41 global abi_asflags
42 global abi_ldflags
43 global has_abi
44
45 set args [lindex $args 0]
46 set asflags $abi_asflags($abi)
47 if { [lindex $args 0] == "noarch" } {
48 set asflags [regsub -- {-march=[^[:blank:]]*} $asflags {}]
49 set args [lreplace $args 0 0]
50 }
51 if { [lindex $args 0] == "useld" } {
52 set ldflags $abi_ldflags($abi)
53 set args [lreplace $args 0 0]
54 }
55 if !$has_abi($abi) {
56 lappend args {notarget *-*-*}
57 }
58
59 set testargs [list [list as $asflags]]
60 if { [info exists ldflags] } {
61 lappend testargs [list ld $ldflags]
62 }
63 if { [llength $args] > 0 } {
64 set testargs [concat $testargs $args]
65 }
66
67 run_dump_test $name $testargs
68}
69
70# run_dump_test_o32 NAME ARGS
71#
72# Invoke "run_dump_test_abi" for test NAME using the o32 ABI and
73# passing ARGS.
74proc run_dump_test_o32 { name args } {
75 run_dump_test_abi o32 $name [lindex $args 0]
76}
77
78# run_dump_test_n32 NAME ARGS
79#
80# Invoke "run_dump_test_abi" for test NAME using the n32 ABI and
81# passing ARGS.
82proc run_dump_test_n32 { name args } {
83 run_dump_test_abi n32 $name [lindex $args 0]
84}
85
86# run_dump_test_n64 NAME ARGS
87#
88# Invoke "run_dump_test_abi" for test NAME using the n64 ABI and
89# passing ARGS.
90proc run_dump_test_n64 { name args } {
91 run_dump_test_abi n64 $name [lindex $args 0]
92}
93
94set has_abi(o32) [expr ![istarget *-*-openbsd*] \
95 && ![istarget mips64*el-ps2-elf*]]
96set has_abi(n32) [expr [istarget *-img-elf*] \
97 || [istarget *-mti-elf*] \
98 || [istarget mips64*el-ps2-elf*] \
99 || [istarget *-sde-elf*] \
100 || [istarget *-*-freebsd*] \
101 || [istarget *-*-irix6*] \
102 || [istarget *-*-kfreebsd*-gnu] \
103 || [istarget *-*-linux*]]
104set has_abi(n64) [expr [istarget *-*-freebsd*] \
105 || [istarget *-*-irix6*] \
106 || [istarget *-*-kfreebsd*-gnu] \
107 || [istarget *-*-linux*] \
108 || [istarget *-*-netbsd*] \
109 || [istarget *-*-openbsd*]]
110
111# Set defaults.
112set abi_asflags(o32) ""
113set abi_asflags(n32) ""
114set abi_asflags(n64) ""
115set abi_asflags(eabi) ""
116set abi_ldflags(o32) ""
117set abi_ldflags(n32) ""
118set abi_ldflags(n64) ""
119set abi_ldflags(eabi) ""
120
121# Override as needed.
122if {[istarget *-*-openbsd*] } {
123 set irixemul 0
124} elseif { [istarget mips64*-*-linux*] } {
125 if [istarget *el-*-*] {
126 set abi_asflags(o32) -32
127 set abi_ldflags(o32) -melf32ltsmip
128 set abi_asflags(n64) "-march=from-abi -64"
129 set abi_ldflags(n64) -melf64ltsmip
130 } else {
131 set abi_asflags(o32) -32
132 set abi_ldflags(o32) -melf32btsmip
133 set abi_asflags(n64) "-march=from-abi -64"
134 set abi_ldflags(n64) -melf64btsmip
135 }
136 set irixemul 0
137} elseif {[istarget *-*-linux*] } {
138 if [istarget *el-*-*] {
139 set abi_asflags(n32) "-march=from-abi -n32"
140 set abi_ldflags(n32) -melf32ltsmipn32
141 set abi_asflags(n64) "-march=from-abi -64"
142 set abi_ldflags(n64) -melf64ltsmip
143 } else {
144 set abi_asflags(n32) "-march=from-abi -n32"
145 set abi_ldflags(n32) -melf32btsmipn32
146 set abi_asflags(n64) "-march=from-abi -64"
147 set abi_ldflags(n64) -melf64btsmip
148 }
149 set irixemul 0
150} elseif {[istarget *-img-elf*] \
151 || [istarget *-mti-elf*] \
152 || [istarget *-sde-elf*] \
153 || [istarget *-*-netbsd*] \
154 || [istarget *-*-linux*] \
155 || [istarget *-*-sysv4*] } {
156 if [istarget *el-*-*] {
157 set abi_asflags(o32) -32
158 set abi_asflags(n32) "-march=from-abi -n32"
159 set abi_ldflags(n32) -melf32ltsmipn32
160 set abi_asflags(n64) "-march=from-abi -64"
161 set abi_ldflags(n64) -melf64ltsmip
162 } else {
163 set abi_asflags(o32) -32
164 set abi_asflags(n32) "-march=from-abi -n32"
165 set abi_ldflags(n32) -melf32btsmipn32
166 set abi_asflags(n64) "-march=from-abi -64"
167 set abi_ldflags(n64) -melf64btsmip
168 }
169 set irixemul 0
170} elseif { [istarget mips64*-*-freebsd*] \
171 || [istarget mips64*-*-kfreebsd*-gnu] } {
172 if [istarget *el-*-*] {
173 set abi_asflags(o32) -32
174 set abi_ldflags(o32) -melf32ltsmip_fbsd
175 set abi_asflags(n64) "-march=from-abi -64"
176 set abi_ldflags(n64) -melf64ltsmip_fbsd
177 } else {
178 set abi_asflags(o32) -32
179 set abi_ldflags(o32) -melf32btsmip_fbsd
180 set abi_asflags(n64) "-march=from-abi -64"
181 set abi_ldflags(n64) -melf64btsmip_fbsd
182 }
183 set irixemul 0
184} elseif { [istarget *-*-freebsd*] \
185 || [istarget *-*-kfreebsd*-gnu] } {
186 if [istarget *el-*-*] {
187 set abi_asflags(n32) "-march=from-abi -n32"
188 set abi_ldflags(n32) -melf32ltsmipn32_fbsd
189 set abi_asflags(n64) "-march=from-abi -64"
190 set abi_ldflags(n64) -melf64ltsmip_fbsd
191 } else {
192 set abi_asflags(n32) "-march=from-abi -n32"
193 set abi_ldflags(n32) -melf32btsmipn32_fbsd
194 set abi_asflags(n64) "-march=from-abi -64"
195 set abi_ldflags(n64) -melf64btsmip_fbsd
196 }
197 set irixemul 0
198} elseif { [istarget *vr4100*-*-elf*] \
199 || [istarget *vr4300*-*-elf*] \
200 || [istarget *vr5000*-*-elf*] } {
201 set abi_asflags(o32) -32
202 set irixemul 1
203} elseif { [istarget mips64*el-ps2-elf*] } {
204 set abi_asflags(o32) -32
205 set abi_ldflags(o32) -melf32lr5900
206 set irixemul 1
207} elseif { [istarget *-*-elf*] \
208 || [istarget *-*-rtems*] } {
209 set abi_asflags(o32) -32
210 set irixemul 1
211} elseif { [istarget *-*-irix6*] } {
212 set abi_asflags(o32) -32
213 set abi_asflags(n64) "-march=from-abi -64"
214 set abi_ldflags(o32) -melf32bsmip
215 set abi_ldflags(n64) -melf64bmip
216 set irixemul 1
217} else {
218 set abi_asflags(o32) -32
219 set irixemul 1
220}
3f1b17bb 221set tmips [expr $irixemul ? {""} : {"t"}]
3abf9758
MR
222
223run_dump_test_o32 "mips-ase-1"
224run_dump_test_o32 "mips-ase-2"
225run_dump_test_o32 "mips-ase-3"
9785fc2a
MR
226run_dump_test "mips-xpa-virt-1"
227run_dump_test "mips-xpa-virt-2"
228run_dump_test "mips-xpa-virt-3"
229run_dump_test "mips-xpa-virt-4"
3abf9758
MR
230run_dump_test_o32 "mixed-mips16" noarch
231run_dump_test_o32 "mixed-micromips" noarch
dd47d677 232run_dump_test "mixed-mips16-micromips"
3abf9758
MR
233run_dump_test_o32 "mips16-undecoded" noarch
234run_dump_test_o32 "mips16e2-undecoded" noarch
235run_dump_test_o32 "mips16-pcrel"
236run_dump_test_o32 "mips16-extend-noinsn"
237run_dump_test_o32 "mips16-extend-insn" noarch
238run_dump_test_o32 "mips16e2-extend-insn" noarch
239run_dump_test_o32 "mips16-alias" noarch
240run_dump_test_o32 "mips16-noalias" noarch
2d6dda71 241
3abf9758
MR
242run_dump_test_o32 "mips-note-2"
243run_dump_test_n32 "mips-note-2-n32"
244run_dump_test_n64 "mips-note-2-n64"
245run_dump_test_o32 "mips-note-2r"
246run_dump_test_n32 "mips-note-2r-n32"
247run_dump_test_n64 "mips-note-2r-n64"
248
249run_dump_test_o32 "mips-reginfo"
250run_dump_test_n32 "mips-reginfo-n32"
3f1b17bb
MR
251
252run_dump_test_o32 "global-local-symtab-o32${tmips}"
253run_dump_test_n32 "global-local-symtab-n32${tmips}"
254run_dump_test_n64 "global-local-symtab-n64"
c77cb2a0
MR
255run_dump_test_o32 "global-local-symtab-sort-o32${tmips}"
256run_dump_test_n32 "global-local-symtab-sort-n32${tmips}"
257run_dump_test_n64 "global-local-symtab-sort-n64${tmips}"
258run_dump_test_o32 "global-local-symtab-final-o32" useld
259run_dump_test_n32 "global-local-symtab-final-n32" useld
260run_dump_test_n64 "global-local-symtab-final-n64" useld