1 |
205 |
julius |
# Copyright (C) 1993, 1997, 1999, 2000, 2002, 2004, 2005, 2007
|
2 |
|
|
# Free Software Foundation, Inc.
|
3 |
|
|
|
4 |
|
|
# This program 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 3 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
17 |
|
|
|
18 |
|
|
# Please email any bugs, comments, and/or additions to this file to:
|
19 |
|
|
# dejagnu@gnu.org
|
20 |
|
|
|
21 |
|
|
# Written by the Center for Software Science at the University of Utah
|
22 |
|
|
# and by Cygnus Support.
|
23 |
|
|
|
24 |
|
|
proc do_subspace_align_test {} {
|
25 |
|
|
set testname "ss_align.s: Test subspace alignment (part 2)"
|
26 |
|
|
set x 0
|
27 |
|
|
|
28 |
|
|
if {[istarget hppa*64*-*-*]
|
29 |
|
|
|| [istarget hppa*-*-*elf*] || [istarget hppa*-*-linux*]} then {
|
30 |
|
|
return
|
31 |
|
|
}
|
32 |
|
|
|
33 |
|
|
if [gas_test_old "ss_align.s" "" "subspace alignment (part 1)"] then {
|
34 |
|
|
objdump_start_no_subdir "a.out" "-h"
|
35 |
|
|
|
36 |
|
|
# Check the headers for the correct alignment value for the
|
37 |
|
|
# the $DATA$ subspace (som).
|
38 |
|
|
while 1 {
|
39 |
|
|
expect {
|
40 |
|
|
-re "DATA\[^\n\]* 2..6\[^\n\]*\n" { set x 1 }
|
41 |
|
|
-re "\[^\n\]*\n" { }
|
42 |
|
|
timeout { perror "timeout\n"; break }
|
43 |
|
|
eof { break }
|
44 |
|
|
}
|
45 |
|
|
}
|
46 |
|
|
|
47 |
|
|
# This was intended to do any cleanup necessary. It kinda looks like it
|
48 |
|
|
# isn't needed, but just in case, please keep it in for now.
|
49 |
|
|
objdump_finish
|
50 |
|
|
|
51 |
|
|
# Did we find what we were looking for? If not, flunk it.
|
52 |
|
|
if [expr $x==1] then { pass $testname } else { fail $testname }
|
53 |
|
|
}
|
54 |
|
|
}
|
55 |
|
|
|
56 |
|
|
proc do_local_label_test {} {
|
57 |
|
|
set testname "locallabel.s: Elimination of local labels (part 2)"
|
58 |
|
|
set x 0
|
59 |
|
|
|
60 |
|
|
if [gas_test_old "locallabel.s" "" "Elimination of local labels (part1)"] {
|
61 |
|
|
objdump_start_no_subdir "a.out" "-t"
|
62 |
|
|
|
63 |
|
|
while 1 {
|
64 |
|
|
expect {
|
65 |
|
|
-re "^00000000\[^\n\]*Label\[^\n\]*\n" { set x 1 }
|
66 |
|
|
-re "^00000000\[^\n\]*L\$01234\[^\n\]*\n" { set x 0 }
|
67 |
|
|
-re "\[^\n\]*\n" { }
|
68 |
|
|
timeout { perror "timeout\n"; break }
|
69 |
|
|
eof { break }
|
70 |
|
|
}
|
71 |
|
|
}
|
72 |
|
|
|
73 |
|
|
# This was intended to do any cleanup necessary. It kinda looks like it
|
74 |
|
|
# isn't needed, but just in case, please keep it in for now.
|
75 |
|
|
objdump_finish
|
76 |
|
|
|
77 |
|
|
# Did we find what we were looking for? If not, flunk it.
|
78 |
|
|
if [expr $x==1] then { pass $testname } else { fail $testname }
|
79 |
|
|
}
|
80 |
|
|
}
|
81 |
|
|
|
82 |
|
|
proc do_frchain_test {} {
|
83 |
|
|
set testname "fragbug.s: Test bug in frag chaining (part 2)"
|
84 |
|
|
set x 0
|
85 |
|
|
|
86 |
|
|
if [gas_test_old "fragbug.s" "" "Test bug in frag chaining (part1)"] {
|
87 |
|
|
objdump_start_no_subdir "a.out" "--prefix-addresses -d"
|
88 |
|
|
|
89 |
|
|
while 1 {
|
90 |
|
|
expect {
|
91 |
|
|
-re "^0x00000000\[^\n\]*nop\[^\n\]*\n" { set x 1 }
|
92 |
|
|
-re "^0x00000004\[^\n\]*nop\[^\n\]*\n" { set x 0 }
|
93 |
|
|
-re "\[^\n\]*\n" { }
|
94 |
|
|
timeout { perror "timeout\n"; break }
|
95 |
|
|
eof { break }
|
96 |
|
|
}
|
97 |
|
|
}
|
98 |
|
|
|
99 |
|
|
# This was intended to do any cleanup necessary. It kinda looks like it
|
100 |
|
|
# isn't needed, but just in case, please keep it in for now.
|
101 |
|
|
objdump_finish
|
102 |
|
|
|
103 |
|
|
# Did we find what we were looking for? If not, flunk it.
|
104 |
|
|
if [expr $x==1] then { pass $testname } else { fail $testname }
|
105 |
|
|
}
|
106 |
|
|
}
|
107 |
|
|
|
108 |
|
|
proc do_align3_test {} {
|
109 |
|
|
set testname "align3.s: Test for alignment bug when switching subspaces (part2)"
|
110 |
|
|
set x 0
|
111 |
|
|
|
112 |
|
|
if {[istarget hppa*64*-*-*]
|
113 |
|
|
|| [istarget hppa*-*-*elf*] || [istarget hppa*-*-linux*]} then {
|
114 |
|
|
return
|
115 |
|
|
}
|
116 |
|
|
|
117 |
|
|
if [gas_test_old "align3.s" "" "Test for alignment bug when switching subspaces (part1)"] {
|
118 |
|
|
objdump_start_no_subdir "a.out" "--prefix-addresses -d"
|
119 |
|
|
|
120 |
|
|
while 1 {
|
121 |
|
|
expect {
|
122 |
|
|
-re "\[^\n\]* nop\[^\n\]*\n" { set x 1 }
|
123 |
|
|
-re "\[^\n\]* <.*end_main> nop\[^\n\]*\n" { set x 1 }
|
124 |
|
|
-re "\[^\n\]* nop\[^\n\]*\n" { set x 0 }
|
125 |
|
|
-re "\[^\n\]*\n" { }
|
126 |
|
|
timeout { perror "timeout\n"; break }
|
127 |
|
|
eof { break }
|
128 |
|
|
}
|
129 |
|
|
}
|
130 |
|
|
|
131 |
|
|
# This was intended to do any cleanup necessary. It kinda looks like it
|
132 |
|
|
# isn't needed, but just in case, please keep it in for now.
|
133 |
|
|
objdump_finish
|
134 |
|
|
|
135 |
|
|
# Did we find what we were looking for? If not, flunk it.
|
136 |
|
|
if [expr $x==1] then { pass $testname } else { fail $testname }
|
137 |
|
|
}
|
138 |
|
|
}
|
139 |
|
|
|
140 |
|
|
proc do_align4_test {} {
|
141 |
|
|
set testname "align4.s: More subspace alignment tests (part2)"
|
142 |
|
|
set x 0
|
143 |
|
|
|
144 |
|
|
if {[istarget hppa*64*-*-*]
|
145 |
|
|
|| [istarget hppa*-*-*elf*] || [istarget hppa*-*-linux*]} then {
|
146 |
|
|
return
|
147 |
|
|
}
|
148 |
|
|
|
149 |
|
|
if [gas_test_old "align4.s" "" "More subspace alignment tests (part1)"] {
|
150 |
|
|
objdump_start_no_subdir "a.out" "-h"
|
151 |
|
|
|
152 |
|
|
while 1 {
|
153 |
|
|
expect {
|
154 |
|
|
-re "\[^\n\]*MILLICODE\[^\n\]*2..6\[^\n\]*\n"
|
155 |
|
|
{ set x [expr $x+1] }
|
156 |
|
|
-re "\[^\n\]*YABBA\[^\n\]*2..3\[^\n\]*\n"
|
157 |
|
|
{ set x [expr $x+1] }
|
158 |
|
|
timeout { perror "timeout\n"; break }
|
159 |
|
|
eof { break }
|
160 |
|
|
}
|
161 |
|
|
}
|
162 |
|
|
|
163 |
|
|
# This was intended to do any cleanup necessary. It kinda looks like it
|
164 |
|
|
# isn't needed, but just in case, please keep it in for now.
|
165 |
|
|
objdump_finish
|
166 |
|
|
|
167 |
|
|
# Did we find what we were looking for? If not, flunk it.
|
168 |
|
|
if [expr $x==2] then { pass $testname } else { fail $testname }
|
169 |
|
|
}
|
170 |
|
|
}
|
171 |
|
|
|
172 |
|
|
proc do_import_test {} {
|
173 |
|
|
set testname "importbug.s: Test for bug in .import directive (part2)"
|
174 |
|
|
set x 0
|
175 |
|
|
|
176 |
|
|
if [gas_test_old "importbug.s" "" "Test for bug in .import directive (part1)"] {
|
177 |
|
|
objdump_start_no_subdir "a.out" "--syms"
|
178 |
|
|
|
179 |
|
|
while 1 {
|
180 |
|
|
expect {
|
181 |
|
|
-re "\[^\n\]*.DATA..foo\[^\n\]*\n" { set x 1 }
|
182 |
|
|
-re "\[^\n\]*.data.*foo\[^\n\]*\n" { set x 1 }
|
183 |
|
|
-re "\[^\n\]*\n" { }
|
184 |
|
|
timeout { perror "timeout\n"; break }
|
185 |
|
|
eof { break }
|
186 |
|
|
}
|
187 |
|
|
}
|
188 |
|
|
|
189 |
|
|
# This was intended to do any cleanup necessary. It kinda looks like it
|
190 |
|
|
# isn't needed, but just in case, please keep it in for now.
|
191 |
|
|
objdump_finish
|
192 |
|
|
|
193 |
|
|
# Did we find what we were looking for? If not, flunk it.
|
194 |
|
|
if [expr $x==1] then { pass $testname } else { fail $testname }
|
195 |
|
|
}
|
196 |
|
|
}
|
197 |
|
|
|
198 |
|
|
proc do_common_test {} {
|
199 |
|
|
# linux has a different .comm syntax
|
200 |
|
|
if [istarget hppa*-*-linux*] then {
|
201 |
|
|
return
|
202 |
|
|
}
|
203 |
|
|
|
204 |
|
|
set testname "common.s: Test for bug in .comm handling (part2)"
|
205 |
|
|
set x 0
|
206 |
|
|
|
207 |
|
|
if [gas_test_old "common.s" "" "Test for bug in .comm handling (part1)"] {
|
208 |
|
|
objdump_start_no_subdir "a.out" "--syms"
|
209 |
|
|
|
210 |
|
|
while 1 {
|
211 |
|
|
expect {
|
212 |
|
|
-re "\[^\n\]*.COM.*common_symbol\[^\n\]*\n" { set x 1 }
|
213 |
|
|
-re "\[^\n\]*\n" { }
|
214 |
|
|
timeout { perror "timeout\n"; break }
|
215 |
|
|
eof { break }
|
216 |
|
|
}
|
217 |
|
|
}
|
218 |
|
|
|
219 |
|
|
# This was intended to do any cleanup necessary. It kinda looks like it
|
220 |
|
|
# isn't needed, but just in case, please keep it in for now.
|
221 |
|
|
objdump_finish
|
222 |
|
|
|
223 |
|
|
# Did we find what we were looking for? If not, flunk it.
|
224 |
|
|
if [expr $x==1] then { pass $testname } else { fail $testname }
|
225 |
|
|
}
|
226 |
|
|
}
|
227 |
|
|
|
228 |
|
|
if [istarget hppa*-*-*] then {
|
229 |
|
|
# Make sure subspace alignment requests from the subspace directives
|
230 |
|
|
# are honored
|
231 |
|
|
do_subspace_align_test
|
232 |
|
|
|
233 |
|
|
# Make sure the correct labels end up in the symbol table
|
234 |
|
|
do_local_label_test
|
235 |
|
|
|
236 |
|
|
# GAS-1.36 choked on this file.
|
237 |
|
|
gas_test "labeldiffs.s" "" "" "Difference of labels"
|
238 |
|
|
|
239 |
|
|
# Test a recent bug where frag chaining wasn't working correctly.
|
240 |
|
|
do_frchain_test
|
241 |
|
|
|
242 |
|
|
# Test bug where switching between subspaces creates bogus alignments
|
243 |
|
|
do_align3_test
|
244 |
|
|
|
245 |
|
|
# Test bug where switching between subspaces creates bogus alignments
|
246 |
|
|
do_align4_test
|
247 |
|
|
|
248 |
|
|
# Test a problem where $global$ is defined, then used within the
|
249 |
|
|
# same source file.
|
250 |
|
|
setup_xfail hppa*-*-*
|
251 |
|
|
gas_test "globalbug.s" "" "" "Use \$global\$ in file which defines it"
|
252 |
|
|
|
253 |
|
|
# Test that importing a defined symbol doesn't screw up the symbol's
|
254 |
|
|
# space/subspace.
|
255 |
|
|
do_import_test
|
256 |
|
|
|
257 |
|
|
# Test for a buglet in the handling of common symbols
|
258 |
|
|
do_common_test
|
259 |
|
|
|
260 |
|
|
# Test for an off-by-2 bug in range check for conditional branches
|
261 |
|
|
# The labels in brlenbug.s lack colons and are not linux compatible.
|
262 |
|
|
if {! [istarget *-*-linux*]} then {
|
263 |
|
|
gas_test_error "brlenbug.s" "" "Check for error(s) in branch length"
|
264 |
|
|
}
|
265 |
|
|
}
|