1 # Expect script
for run_dump_test based
ld-m68k GOT tests.
2 # Copyright
008 Free Software Foundation
, Inc.
4 # This file is part of the GNU Binutils.
6 # This
program is free software
; you can redistribute it and
/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation
; either version
3 of the License
, or
9 #
(at your option
) any later version.
11 # This
program is distributed in the hope that it will be useful
,
12 # but WITHOUT
ANY WARRANTY
; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License
for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this
program; if not
, write to the Free Software
18 # Foundation
, Inc.
, 51 Franklin Street
- Fifth Floor
, Boston
,
22 if { ![is_elf_format
] ||
![istarget m68k
-*-*] } {
32 proc gen_got_test
{ testname
} {
36 if [catch
{ set ofd
[open
"tmpdir/$testname.s" w] } msg] {
80 set func
[format
"sum_%05d_%05d" $start $count]
82 puts $ofd
"\t.align 2"
83 puts $ofd
"\t.globl $func"
84 puts $ofd
"\t.type $func,@function"
86 puts $ofd
"\tlink.w %fp,#0"
87 puts $ofd
"\tmove.l %a5,-(%sp)"
88 puts $ofd
"\tmove.l #_GLOBAL_OFFSET_TABLE_@GOTPC, %a5"
89 puts $ofd
"\tlea (-6, %pc, %a5), %a5"
92 set symbol
[format
"a%05d" $start]
94 puts $ofd
"\tlea $symbol@GOT,%a0"
95 puts $ofd
"\tadd.l %a5,%a0"
96 puts $ofd
"\tmove.l (%a0),%a0"
97 puts $ofd
"\tmove.l (%a0),%d1"
98 for { set i $start
} { $i
< $
count } { incr i
} {
99 set symbol
[format
"a%05d" $i]
100 puts $ofd
"\tlea $symbol@GOT,%a0"
101 puts $ofd
"\tadd.l %a5,%a0"
102 puts $ofd
"\tmove.l (%a0),%a0"
103 puts $ofd
"\tmove.l (%a0),%d0"
104 puts $ofd
"\tadd.l %d0,%d1"
106 set symbol
[format
"a%05d" $count]
107 puts $ofd
"\tlea $symbol@GOT,%a0"
108 puts $ofd
"\tadd.l %a5,%a0"
109 puts $ofd
"\tmove.l (%a0),%a0"
110 puts $ofd
"\tmove.l (%a0),%d0"
111 puts $ofd
"\tadd.l %d1,%d0"
113 set symbol
[format
"a%05d" $start]
115 puts $ofd
"\tmove.l $symbol@GOT(%a5),%d0"
116 puts $ofd
"\tmove.l %d0,%a0"
117 puts $ofd
"\tmove.l (%a0),%d1"
118 for { set i $start
} { $i
< $
count } { incr i
} {
119 set symbol
[format
"a%05d" $i]
120 puts $ofd
"\tmove.l $symbol@GOT(%a5),%d0"
121 puts $ofd
"\tmove.l %d0,%a0"
122 puts $ofd
"\tmove.l (%a0),%d0"
123 puts $ofd
"\tadd.l %d0,%d1"
125 set symbol
[format
"a%05d" $count]
126 puts $ofd
"\tmove.l $symbol@GOT(%a5),%d0"
127 puts $ofd
"\tmove.l %d0,%a0"
128 puts $ofd
"\tmove.l (%a0),%d0"
129 puts $ofd
"\tadd.l %d1,%d0"
132 puts $ofd
"\tmove.l (%sp)+,%a5"
133 puts $ofd
"\tunlk %fp"
135 puts $ofd
"\t.size $func, .-$func"
140 proc got_test
{ testname
} {
145 if [catch
{ set ifd
[open
"$srcdir/$subdir/$testname.d" r] } msg] {
150 if [catch
{ set ofd
[open
"tmpdir/$testname.d" w] } msg] {
156 switch -- $testname
{
158 puts $ofd
"#source: $objdir/tmpdir/got-12.s"
162 puts $ofd
"#source: $objdir/tmpdir/got-13.s"
165 "got-negative-14-ok" {
166 puts $ofd
"#source: $objdir/tmpdir/got-14.s"
169 "got-negative-15-er" {
170 puts $ofd
"#source: $objdir/tmpdir/got-15.s"
173 "got-negative-12-13-14-34-ok" {
174 puts $ofd
"#source: $objdir/tmpdir/got-12.s"
175 puts $ofd
"#source: $objdir/tmpdir/got-13.s"
176 puts $ofd
"#source: $objdir/tmpdir/got-14.s"
177 puts $ofd
"#source: $objdir/tmpdir/got-34.s"
180 "got-negative-12-13-14-35-er" {
181 puts $ofd
"#source: $objdir/tmpdir/got-12.s"
182 puts $ofd
"#source: $objdir/tmpdir/got-13.s"
183 puts $ofd
"#source: $objdir/tmpdir/got-14.s"
184 puts $ofd
"#source: $objdir/tmpdir/got-35.s"
187 "got-multigot-14-ok" {
188 puts $ofd
"#source: $objdir/tmpdir/got-14.s"
191 "got-multigot-15-er" {
192 puts $ofd
"#source: $objdir/tmpdir/got-15.s"
195 "got-multigot-12-13-14-34-35-ok" {
196 puts $ofd
"#source: $objdir/tmpdir/got-12.s"
197 puts $ofd
"#source: $objdir/tmpdir/got-13.s"
198 puts $ofd
"#source: $objdir/tmpdir/got-14.s"
199 puts $ofd
"#source: $objdir/tmpdir/got-34.s"
200 puts $ofd
"#source: $objdir/tmpdir/got-35.s"
204 puts $ofd
"#source: $objdir/tmpdir/xgot-15.s"
207 "got-xgot-12-13-14-15-34-35-ok" {
208 puts $ofd
"#source: $objdir/tmpdir/got-12.s"
209 puts $ofd
"#source: $objdir/tmpdir/got-13.s"
210 puts $ofd
"#source: $objdir/tmpdir/got-14.s"
211 puts $ofd
"#source: $objdir/tmpdir/xgot-15.s"
212 puts $ofd
"#source: $objdir/tmpdir/got-34.s"
213 puts $ofd
"#source: $objdir/tmpdir/got-35.s"
218 while { [gets $ifd line
] != -1 } {
222 for { set i
0 } { $i
< $
count } { incr i
} {
223 puts $ofd
"^\[0-9a-f\]+ \[0-9a-f\]+ R_68K_GLOB_DAT 00000000 a\[0-9\]+ \\\+ 0"
228 run_dump_test
"tmpdir/$testname"
239 run_dump_test
"got-1"
240 got_test
"got-single-12-ok"
241 got_test
"got-single-13-er"
242 got_test
"got-negative-14-ok"
243 got_test
"got-negative-15-er"
244 got_test
"got-negative-12-13-14-34-ok"
245 got_test
"got-negative-12-13-14-35-er"
246 got_test
"got-multigot-14-ok"
247 got_test
"got-multigot-15-er"
248 got_test
"got-multigot-12-13-14-34-35-ok"
249 got_test
"got-xgot-15-ok"
250 got_test
"got-xgot-12-13-14-15-34-35-ok"