Commit | Line | Data |
---|---|---|
252b5132 RH |
1 | # |
2 | # These tests should be valid on all targets. | |
3 | # | |
4 | ||
5 | # I think currently all targets fail this one when listings are enabled. | |
6 | gas_test "p2425.s" "" "" "pcrel values in assignment" | |
7 | ||
8 | # p1480.s uses a ".space" directive which for most assemblers means | |
9 | # "allocate some space". On the PA it means "switch into this space". | |
10 | # | |
11 | # Therefore this test (as it is currently written) is completely bogus | |
12 | # for any PA target. Do not bother trying to run it and just claim | |
13 | # it fails. | |
39bec121 TW |
14 | # |
15 | # The C54x uses ".space" to allocate bits, and requires absolute expressions; | |
16 | # The ".space" directive is taken care of in the C54x-specific tests, so fail | |
17 | # here | |
18 | # | |
19 | if { [istarget hppa*-*-*] || [istarget *c54x*-*-*] } then { | |
252b5132 RH |
20 | setup_xfail *-*-* |
21 | fail "simplifiable double subtraction" | |
22 | } else { | |
23 | gas_test "p1480.s" "" "-a>" "simplifiable double subtraction" | |
24 | } | |
25 | ||
3c9b82ba NC |
26 | # No floating point support in assembly code for CRIS and Z80. |
27 | if { ![istarget cris-*-*] && ![istarget crisv32-*-*] | |
28 | && ![istarget z80-*-*] } then { | |
483f05e3 HPN |
29 | gas_test "float.s" "" "" "simple FP constants" |
30 | } | |
252b5132 RH |
31 | |
32 | # This test is meaningless for the PA; the difference of two undefined | |
33 | # symbols is something that is (and must be) supported on the PA. | |
34 | if ![istarget hppa*-*-*] then { | |
35 | gas_test_error "diff1.s" "" "difference of two undefined symbols" | |
36 | } | |
37 | ||
9497f5ac NC |
38 | # PR/1387 |
39 | setup_xfail "*-*-*" | |
40 | gas_test_error "equiv1.s" "" ".equiv for symbol already set to another one" | |
41 | gas_test_error "equiv2.s" "" ".equiv for symbol already set to an expression" | |
42 | ||
43 | # .equ works differently on some targets. | |
44 | case $target_triplet in { | |
45 | { hppa*-*-* } { } | |
46 | { *c54x*-*-* } { } | |
47 | default { | |
48 | gas_test "equ-ok.s" "" "" ".equ for symbol already set" | |
49 | gas_test_error "equ-bad.s" "" ".equ for symbol already set through .eqv" | |
50 | } | |
51 | } | |
52 | ||
53 | gas_test "eqv-ok.s" "" "" ".eqv support" | |
54 | gas_test_error "eqv-bad.s" "" ".eqv for symbol already set" | |
55 | ||
56 | gas_test "assign-ok.s" "" "" "== assignment support" | |
57 | gas_test_error "assign-bad.s" "" "== assignment for symbol already set" | |
58 | ||
59 | # .equ works differently on some targets. | |
60 | # linkrelax-ing prevents most forward references from working. | |
61 | case $target_triplet in { | |
62 | { crx*-*-* } { } | |
63 | { h8300*-*-* } { } | |
64 | { hppa*-*-* } { } | |
65 | { mn10\[23\]00*-*-* } { } | |
66 | { *c54x*-*-* } { } | |
67 | default { | |
68 | # Some targets don't manage to resolve BFD_RELOC_8 for constants. | |
69 | setup_xfail "alpha*-*-*" "avr-*-*" "*c30*-*-*" "*c4x*-*-*" \ | |
70 | "d\[13\]0v*-*-*" "i860-*-*" "mips*-*-*" "msp430-*-*" \ | |
71 | "pdp11-*-*" "sparc*-*-*" "xtensa-*-*" | |
72 | run_dump_test forward | |
73 | } | |
74 | } | |
75 | ||
76 | # .set works differently on some targets. | |
77 | case $target_triplet in { | |
78 | { alpha*-*-* } { } | |
79 | { iq2000*-*-* } { } | |
80 | { mips*-*-* } { } | |
81 | { *c54x*-*-* } { } | |
3c9b82ba | 82 | { z80-*-* } { } |
9497f5ac NC |
83 | default { |
84 | setup_xfail "*c30*-*-*" "*c4x*-*-*" "pdp11-*-*" | |
85 | run_dump_test redef | |
86 | } | |
87 | } | |
88 | ||
252b5132 RH |
89 | proc do_comment {} { |
90 | set testname "comment.s: comments in listings" | |
91 | set x1 0 | |
92 | set x2 0 | |
93 | set x3 0 | |
94 | set white {[ \t]*} | |
95 | gas_start "comment.s" "-al" | |
96 | while 1 { | |
97 | # Apparently CRLF is received when using ptys for subprocesses; hence the | |
98 | # \r\n for line 3. | |
99 | expect { | |
100 | -re "^ +1\[ \t\]+# This\[^\n\]*\n" { set x1 1 } | |
101 | -re "^ +2\[ \t\]+# correctly\[^\n\]*\n" { set x2 1 } | |
102 | -re "^ +3\[ \t\]+/. C comments too. ./\r?\n" { set x3 1 } | |
103 | -re "\[^\n\]*\n" { } | |
104 | timeout { perror "timeout\n"; break } | |
105 | eof { break } | |
106 | } | |
107 | } | |
108 | gas_finish | |
109 | if [all_ones $x1 $x2 $x3] then { pass $testname } else { fail $testname } | |
110 | } | |
111 | ||
112 | do_comment | |
113 | ||
114 | # | |
115 | # Test x930509a -- correct assembly of differences involving forward | |
116 | # references. | |
117 | # | |
118 | ||
119 | proc do_930509a {} { | |
120 | set testname "difference between forward references" | |
121 | set x 0 | |
122 | gas_start "x930509.s" "-al" | |
123 | while 1 { | |
124 | # We need to accomodate both byte orders here. | |
125 | # If ".long" means an 8-byte value on some target someday, this test will have | |
126 | # to be fixed. | |
127 | expect { | |
224de7a5 AM |
128 | -re "^ +1 .... 00 ?00 ?00 ?00" { fail $testname; set x 1 } |
129 | -re "^ +1 .... 04 ?00 ?00 ?00" { pass $testname; set x 1 } | |
130 | -re "^ +1 .... 00 ?00 ?00 ?04" { pass $testname; set x 1 } | |
252b5132 RH |
131 | -re "\[^\n\]*\n" { } |
132 | timeout { perror "timeout\n"; break } | |
133 | eof { break } | |
134 | } | |
135 | } | |
136 | gas_finish | |
137 | if !$x then { fail $testname } | |
138 | } | |
139 | ||
670ec21d | 140 | # This test is meaningless for the PA and CRX; the difference of two symbols |
252b5132 | 141 | # must not be resolved by the assembler. |
39bec121 TW |
142 | # C54x assembler (for compatibility) does not allow differences between |
143 | # forward references | |
8bda4946 | 144 | # C30 counts a four byte offset as a difference of one. |
48c5eb8a | 145 | if { ![istarget hppa*-*-*] && |
670ec21d | 146 | ![istarget crx*-*-*] && |
48c5eb8a SS |
147 | ![istarget *c30*-*-*] && |
148 | ![istarget *c4x*-*-*] && | |
149 | ![istarget *c54x*-*-*] } then { | |
252b5132 RH |
150 | # the vax fails because VMS can apparently actually handle this |
151 | # case in relocs, so gas doesn't handle it itself. | |
8bda4946 | 152 | setup_xfail "h8300*-*-elf*" "mn10200*-*-*" "mn10300*-*-*" "vax*-*-vms*" |
252b5132 RH |
153 | do_930509a |
154 | } | |
155 | ||
39bec121 TW |
156 | # ".struct" and ".align" have different meanings on c54x |
157 | # These directives are done in the c54x-specific tests instead | |
252b5132 RH |
158 | case $target_triplet in { |
159 | { hppa*-*-* } { } | |
48c5eb8a | 160 | { *c4x*-*-* } { } |
39bec121 | 161 | { *c54x*-*-* } { } |
252b5132 RH |
162 | default { |
163 | run_dump_test struct | |
164 | run_dump_test align | |
76101304 | 165 | run_dump_test align2 |
252b5132 RH |
166 | } |
167 | } | |
168 | ||
5069eab2 NC |
169 | # '<' and '>' appear to have special meanings on the excluded targets |
170 | case $target_triplet in { | |
5069eab2 NC |
171 | { frv-*-* } { } |
172 | { hppa*-*-* } { } | |
173 | { m32r-*-* } { } | |
174 | { mmix-*-* } { } | |
175 | { *c4x*-*-* } { } | |
176 | { *c54x*-*-* } { } | |
8df55cb8 | 177 | { bfin-*-* } { } |
5069eab2 NC |
178 | default { |
179 | run_dump_test altmacro | |
180 | # The second test is valid only when '!' is not a comment | |
181 | # character (it is allowed to be a line comment character). | |
26a78d4a | 182 | if [string match "" [lindex [gas_run excl.s "-o /dev/null" ""] 0]] { |
5069eab2 | 183 | run_dump_test altmac2 |
9497f5ac NC |
184 | # Similarly this test does not work when ! is a line seperator. |
185 | run_dump_test eval | |
5069eab2 NC |
186 | } |
187 | } | |
188 | } | |
caa32fe5 | 189 | |
252b5132 | 190 | # This test is for any COFF target. |
252b5132 RH |
191 | # We omit the ARM toolchains because they define locals to |
192 | # start with '.', which eliminates .eos, .text etc from the output. | |
39bec121 | 193 | # Omit c54x, since .tag and .def mean something different on that target |
3c9b82ba NC |
194 | # Omit Z80, since octal numbers need a suffix on that target |
195 | if { ([istarget *-*-coff*] && ![istarget *arm*-*-coff] && ![istarget thumb*-*-coff] && ![istarget xscale-*-coff] && ![istarget *c4x*-*-coff] && ![istarget *c54x*-*-coff] && ![istarget z80-*-coff]) \ | |
252b5132 | 196 | ||([istarget *-*-pe*] && ![istarget arm*-*-pe*] && ![istarget thumb*-*-pe*]) \ |
252b5132 RH |
197 | || [istarget i*86-*-aix*] \ |
198 | || [istarget i*86-*-sco*] \ | |
199 | || [istarget i*86-*-isc*] \ | |
200 | || [istarget i*86-*-go32*] \ | |
201 | || [istarget i*86-*-cygwin*] \ | |
202 | || [istarget i*86-*-*nt] \ | |
61feeec2 | 203 | || [istarget i*86-*-interix*] \ |
252b5132 RH |
204 | || ([istarget i960-*-vxworks5.*] && ![istarget i960-*-vxworks5.0*]) } { |
205 | run_dump_test cofftag | |
206 | } | |
207 | ||
208 | # Test omitting conditionals from listings. | |
209 | proc test_cond {} { | |
210 | global comp_output | |
211 | global srcdir | |
212 | global subdir | |
213 | ||
214 | set testname "conditional listings" | |
224de7a5 | 215 | gas_run cond.s "-alc" ">dump.out" |
252b5132 RH |
216 | if ![string match "" $comp_output] { |
217 | send_log "$comp_output\n" | |
218 | fail $testname | |
219 | } else { | |
9497f5ac | 220 | if { [regexp_diff dump.out $srcdir/$subdir/cond.l] } { |
252b5132 RH |
221 | fail $testname |
222 | } else { | |
223 | pass $testname | |
224 | } | |
225 | } | |
226 | } | |
227 | ||
c8060cba JL |
228 | # This test is not suitable for the PA for various reasons |
229 | # not limited to the fact that it depends on specific section | |
230 | # names appearing in the output file. | |
39bec121 | 231 | # again, p2align doesn't work on c54x target |
aceebfd6 NC |
232 | case $target_triplet in { |
233 | { hppa*-*-* } { } | |
48c5eb8a | 234 | { *c4x*-*-* } { } |
aceebfd6 NC |
235 | { *c54x*-*-* } { } |
236 | default { | |
237 | test_cond | |
238 | run_dump_test incbin | |
239 | } | |
39bec121 | 240 | } |
c9e38879 | 241 | |
01ed09aa | 242 | if { ([istarget "i*86-*-*pe*"] && ![istarget "i*86-*-openbsd*"]) \ |
b46c1691 NC |
243 | || [istarget "i*86-*-cygwin*"] \ |
244 | || [istarget "i*86-*-mingw32*"] } { | |
245 | gas_test "fastcall.s" "" "" "fastcall labels" | |
246 | } | |
a7eec876 | 247 | |
6efba987 | 248 | run_dump_test assign |
e5604d79 | 249 | run_dump_test sleb128 |
ddc07134 AM |
250 | |
251 | # .quad is 16 bytes on i960. | |
252 | if { ![istarget "i960-*-*"] } { | |
253 | run_dump_test quad | |
254 | } | |
e5604d79 | 255 | |
3c9b82ba NC |
256 | |
257 | # .set works differently on some targets. | |
258 | case $target_triplet in { | |
259 | { z80-*-* } { } | |
260 | default { | |
261 | run_dump_test weakref1 | |
262 | run_dump_test weakref1g | |
263 | run_dump_test weakref1l | |
264 | run_dump_test weakref1u | |
265 | run_dump_test weakref1w | |
266 | } | |
267 | } | |
06e77878 AO |
268 | gas_test_error "weakref2.s" "" "e: would close weakref loop: e => a => b => c => d => e" |
269 | gas_test_error "weakref3.s" "" "a: would close weakref loop: a => b => c => d => e => a" | |
270 | ||
a7eec876 HPN |
271 | load_lib gas-dg.exp |
272 | dg-init | |
273 | dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/err-*.s $srcdir/$subdir/warn-*.s]] "" "" | |
274 | dg-finish |