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