OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [binutils-2.20.1/] [ld/] [testsuite/] [ld-m68k/] [m68k-got.exp] - Blame information for rev 205

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 205 julius
# Expect script for run_dump_test based ld-m68k GOT tests.
2
#   Copyright 2008, 2009 Free Software Foundation, Inc.
3
#
4
# This file is part of the GNU Binutils.
5
#
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.
10
#
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.
15
#
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,
19
# MA 02110-1301, USA.
20
#
21
 
22
if { ![is_elf_format] || ![istarget m68k-*-*] } {
23
    return
24
}
25
 
26
# 1 - 1
27
# 2 - 8189
28
# 3 - 8190
29
# 4 - 16382
30
# 5 - 16385
31
 
32
proc gen_got_test { testname } {
33
    global srcdir
34
    global subdir
35
 
36
    if [catch { set ofd [open "tmpdir/$testname.s" w] } msg] {
37
        perror "$msg"
38
        unresolved $testname
39
        return
40
    }
41
 
42
    switch --  $testname {
43
        "got-12" {
44
            set start 1
45
            set count 8189
46
            set xgot 0
47
        }
48
        "got-13" {
49
            set start 1
50
            set count 8190
51
            set xgot 0
52
        }
53
        "got-14" {
54
            set start 1
55
            set count 16382
56
            set xgot 0
57
        }
58
        "got-15" {
59
            set start 1
60
            set count 16385
61
            set xgot 0
62
        }
63
        "got-34" {
64
            set start 8190
65
            set count 16382
66
            set xgot 0
67
        }
68
        "got-35" {
69
            set start 8190
70
            set count 16385
71
            set xgot 0
72
        }
73
        "xgot-15" {
74
            set start 1
75
            set count 16385
76
            set xgot 1
77
        }
78
    }
79
 
80
    set func [format "sum_%05d_%05d" $start $count]
81
    puts $ofd "\t.text"
82
    puts $ofd "\t.align 2"
83
    puts $ofd "\t.globl $func"
84
    puts $ofd "\t.type $func,@function"
85
    puts $ofd "$func:"
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"
90
 
91
    if { $xgot == 1 } {
92
        set symbol [format "a%05d" $start]
93
        incr 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"
105
        }
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"
112
    } else {
113
        set symbol [format "a%05d" $start]
114
        incr 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"
124
        }
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"
130
    }
131
 
132
    puts $ofd "\tmove.l (%sp)+,%a5"
133
    puts $ofd "\tunlk %fp"
134
    puts $ofd "\trts"
135
    puts $ofd "\t.size  $func, .-$func"
136
 
137
    close $ofd
138
}
139
 
140
proc got_test { testname } {
141
    global srcdir
142
    global subdir
143
    global objdir
144
 
145
    if [catch { set ifd [open "$srcdir/$subdir/$testname.d" r] } msg] {
146
        perror "$msg"
147
        unresolved $testname
148
        return
149
    }
150
    if [catch { set ofd [open "tmpdir/$testname.d" w] } msg] {
151
        perror "$msg"
152
        unresolved $testname
153
        return
154
    }
155
 
156
    switch --  $testname {
157
        "got-single-12-ok" {
158
            puts $ofd "#source: $objdir/tmpdir/got-12.s"
159
            set count 8189
160
        }
161
        "got-single-13-er" {
162
            puts $ofd "#source: $objdir/tmpdir/got-13.s"
163
            set count 0
164
        }
165
        "got-negative-14-ok" {
166
            puts $ofd "#source: $objdir/tmpdir/got-14.s"
167
            set count 16382
168
        }
169
        "got-negative-15-er" {
170
            puts $ofd "#source: $objdir/tmpdir/got-15.s"
171
            set count 0
172
        }
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"
178
            set count 16382
179
        }
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"
185
            set count 0
186
        }
187
        "got-multigot-14-ok" {
188
            puts $ofd "#source: $objdir/tmpdir/got-14.s"
189
            set count 16382
190
        }
191
        "got-multigot-15-er" {
192
            puts $ofd "#source: $objdir/tmpdir/got-15.s"
193
            set count 0
194
        }
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"
201
            set count 24578
202
        }
203
        "got-xgot-15-ok" {
204
            puts $ofd "#source: $objdir/tmpdir/xgot-15.s"
205
            set count 16385
206
        }
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"
214
            set count 24581
215
        }
216
    }
217
 
218
    while { [gets $ifd line] != -1 } {
219
        puts $ofd $line
220
    }
221
 
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"
224
    }
225
 
226
    close $ifd
227
    close $ofd
228
    run_dump_test "tmpdir/$testname"
229
}
230
 
231
gen_got_test got-12
232
gen_got_test got-13
233
gen_got_test got-14
234
gen_got_test got-15
235
gen_got_test got-34
236
gen_got_test got-35
237
gen_got_test xgot-15
238
 
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"

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.