* gas/hppa/reloc/reloc.exp: Tweak expected output to match new
[deliverable/binutils-gdb.git] / gas / testsuite / gas / hppa / reloc / reloc.exp
1 # Copyright (C) 1993 Free Software Foundation, Inc.
2
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
16
17 # Please email any bugs, comments, and/or additions to this file to:
18 # DejaGnu@cygnus.com
19
20 # Written by the Center for Software Science at the University of Utah
21 # and by Cygnus Support.
22
23 proc do_ble_relocation_test {} {
24 set testname "blebug.s: Test for proper relocation for BLE (part 2)"
25 set x 0
26
27 if [gas_test_old "blebug.s" "" "Proper relocation for BLE (part 1)"] then {
28 objdump_start_no_subdir "a.out" "-r"
29
30 if ![istarget hppa*-*-*elf*] then {
31 # At one time both versions of the assembler would incorrectly use
32 # a PC-relative relocation for a BLE instruction.
33 while 1 {
34 expect {
35 -re "^00000004\[^\n\]*ABS_CALL\[^\n\]*\n" { set x 1 }
36 -re "\[^\n\]*\n" { }
37 timeout { perror "timeout\n"; break }
38 eof { break }
39 }
40 }
41 } else {
42 # At one time both versions of the assembler would incorrectly use
43 # a PC-relative relocation for a BLE instruction.
44 while 1 {
45 expect {
46 -re "^00000000\[^\n\]*DIR21L\[^\n\]*\n" { set x 1 }
47 -re "^00000004\[^\n\]*DIR17R\[^\n\]*\n" { set x 1 }
48 -re "\[^\n\]*\n" { }
49 timeout { perror "timeout\n"; break }
50 eof { break }
51 }
52 }
53 }
54 }
55
56 # This was intended to do any cleanup necessary. It kinda looks like it
57 # isn't needed, but just in case, please keep it in for now.
58 objdump_finish
59
60 # Did we find what we were looking for? If not, flunk it.
61 if [expr $x==1] then { pass $testname } else { fail $testname }
62 }
63
64 proc do_relocation_reduction_tests {} {
65 set testname "relocreduce.s: Test relocation reductions (part 2)"
66 set x 0
67
68 if [gas_test_old "relocreduce.s" "" "Relocation reductions (part1)"] then {
69 objdump_start_no_subdir "a.out" "-r"
70
71 # Check to make sure relocations involving procedure labels
72 # are not reduced to a relocation involving some other symbol.
73 # Doing so makes generating parameter relocation stubs impossible.
74 while 1 {
75 expect {
76 -re "^00000004\[^\n\]*PLABEL\[^\n\]*foo\[^\n\]*\n"
77 { set x [expr $x+1] }
78 -re "^00000014\[^\n\]*PCREL\[^\n\]*foo\[^\n\]*\n"
79 { set x [expr $x+1] }
80 -re "\[^\n\]*\n" { }
81 timeout { perror "timeout\n"; break }
82 eof { break }
83 }
84 }
85 }
86
87 # This was intended to do any cleanup necessary. It kinda looks like it
88 # isn't needed, but just in case, please keep it in for now.
89 objdump_finish
90
91 # Did we find what we were looking for? If not, flunk it.
92 if [expr $x==2] then { pass $testname } else { fail $testname }
93 }
94
95 proc do_ble_mode_selector_test {} {
96 set testname "blebug2.s: blebug2"
97 set x 0
98
99 gas_start "blebug2.s" "-al"
100
101 # GAS uses too many bits on the BLE instruction.
102 while 1 {
103 expect {
104 -re "^ +\[0-9\]+ 0000 20202801\[^\n\]*\n" { set x [expr $x+1] }
105 -re "^ +\[0-9\]+ 0004 E420E008\[^\n\]*\n" { set x [expr $x+1] }
106 -re "\[^\n\]*\n" { }
107 timeout { perror "timeout\n"; break }
108 eof { break }
109 }
110 }
111
112 # This was intended to do any cleanup necessary. It kinda looks like it
113 # isn't needed, but just in case, please keep it in for now.
114 gas_finish
115
116 # Did we find what we were looking for? If not, flunk it.
117 if [expr $x==2] then { pass $testname } else { fail $testname }
118 }
119
120 proc do_plabel_relocation_test {} {
121 set testname "plabelbug.s: Old gas-1.36 plabel bug (part 2)"
122 set x 0
123
124 if [gas_test_old "plabelbug.s" "" "Old gas-1.36 plabel bug (part 1)"] {
125 objdump_start_no_subdir "a.out" "-r"
126
127 # Check that we make PLABEL relocation entries when they're needed.
128 while 1 {
129 expect {
130 -re "^\[04\]0000000\[^\n\]*PLABEL\[^\n\]*\n"
131 { set x [expr $x+1] }
132 -re "^\[04\]0000004\[^\n\]*PLABEL\[^\n\]*\n"
133 { set x [expr $x+1] }
134 -re "\[^\n\]*\n" { }
135 timeout { perror "timeout\n"; break }
136 eof { break }
137 }
138 }
139
140 # This was intended to do any cleanup necessary. It kinda looks like it
141 # isn't needed, but just in case, please keep it in for now.
142 objdump_finish
143
144 # Did we find what we were looking for? If not, flunk it.
145 if [expr $x==2] then { pass $testname } else { fail $testname }
146 }
147 }
148
149 proc do_selector_scope_test {} {
150 set testname "selectorbug.s: Test scope of field selector"
151 set x 0
152
153 if [gas_test_old "selectorbug.s" "" "Test scope of field selector (part 1)"] {
154 objdump_start_no_subdir "a.out" "-r"
155
156 # Check to make sure the relocation entry after the plabel is correct.
157 # If an old field selector was incorrectly "carried" over, then
158 # this test will fail.
159 if [istarget hppa*-*-*elf*] then {
160 while 1 {
161 expect {
162 -re "^00000014\[^\n\]*DIR32\[^\n\]*\n"
163 { set x 1 }
164 -re "^00000014\[^\n\]*PLABEL\[^\n\]*foo\[^\n\]*\n"
165 { set x 0 }
166 -re "\[^\n\]*\n" { }
167 timeout { perror "timeout\n"; break }
168 eof { break }
169 }
170 }
171 } else {
172 while 1 {
173 expect {
174 -re "^00000014\[^\n\]*DATA_ONE\[^\n\]*\n"
175 { set x 1 }
176 -re "^00000014\[^\n\]*PLABEL\[^\n\]*foo\[^\n\]*\n"
177 { set x 0 }
178 -re "\[^\n\]*\n" { }
179 timeout { perror "timeout\n"; break }
180 eof { break }
181 }
182 }
183 }
184
185 # This was intended to do any cleanup necessary. It kinda looks like it
186 # isn't needed, but just in case, please keep it in for now.
187 objdump_finish
188
189 # Did we find what we were looking for? If not, flunk it.
190 if [expr $x==1] then { pass $testname } else { fail $testname }
191 }
192 }
193
194 proc do_local_label_as_operand_test {} {
195 set testname "labelopbug.s: Test local label as operand (non-branching)"
196 set x 0
197
198 if [gas_test_old "labelopbug.s" "" "Local label as operand (part 1)"] {
199 objdump_start_no_subdir "a.out" "-r"
200
201 # Check to make sure we handle difference of local lables as an operand
202 # to a non-branching instruction correctly.
203 while 1 {
204 expect {
205 -re "^0000002c\[^\n\]*0x00000024\[^\n\]*\n"
206 { set x [expr $x+1] }
207 -re "^00000030\[^\n\]*0x00000024\[^\n\]*\n"
208 { set x [expr $x+1] }
209 -re "\[^\n\]*\n" { }
210 timeout { perror "timeout\n"; break }
211 eof { break }
212 }
213 }
214
215 # This was intended to do any cleanup necessary. It kinda looks like it
216 # isn't needed, but just in case, please keep it in for now.
217 objdump_finish
218
219 # Did we find what we were looking for? If not, flunk it.
220 if [expr $x==2] then { pass $testname } else { fail $testname }
221 }
222 }
223
224 proc do_exit_relocation_test {} {
225 set testname "exitbug.s: Test for bogus R_EXIT relocation (part 2)"
226 set x 0
227
228 # Elf (osf) does not use ENTRY/EXIT relocations.
229 # I guess we could look at the unwind subspaces it builds...
230 # Until then, make sure it still assembles.
231 if [istarget hppa*-*-*elf*] then {
232 gas_test_old "exitbug.s" "" "Test for bogus R_EXIT relocation (part 1)"
233 return;
234 }
235
236 if [gas_test_old "exitbug.s" "" "Test for bogus R_EXIT relocation (part 1)"] {
237 objdump_start_no_subdir "a.out" "-r"
238
239 # Note that a match here is really a FAILURE!
240 while 1 {
241 expect {
242 -re "^00000000\[^\n\]*R_EXIT\[^\n\]*\n"
243 { set x [expr $x+1] }
244 -re "\[^\n\]*\n" { }
245 timeout { perror "timeout\n"; break }
246 eof { break }
247 }
248 }
249
250 # This was intended to do any cleanup necessary. It kinda looks like it
251 # isn't needed, but just in case, please keep it in for now.
252 objdump_finish
253
254 # Did we find what we were looking for? If not, flunk it.
255 if [expr $x==0] then { pass $testname } else { fail $testname }
256 }
257 }
258
259 proc do_cross_space_fixup_test_1 {} {
260 set testname "fixupbug.s: Test cross space jump/call fixup bug (part 2)"
261 set x 0
262
263 # ELF (osf) doesn't really handle extra sections too well...
264 if [istarget hppa*-*-*elf*] then {
265 return;
266 }
267
268 if [gas_test_old "fixupbug.s" "" "Test cross space jump/call fixup bug (part 1)"] {
269 objdump_start_no_subdir "a.out" "-r"
270
271 # Make sure GAS generated a fixup/relocation for the cross-space
272 # branch/call
273 while 1 {
274 expect {
275 -re "^00000000\[^\n\]*PCREL_CALL\[^\n\]*\n"
276 { set x [expr $x+1] }
277 -re "\[^\n\]*\n" { }
278 timeout { perror "timeout\n"; break }
279 eof { break }
280 }
281 }
282
283 # This was intended to do any cleanup necessary. It kinda looks like it
284 # isn't needed, but just in case, please keep it in for now.
285 objdump_finish
286
287 # Did we find what we were looking for? If not, flunk it.
288 if [expr $x==1] then { pass $testname } else { fail $testname }
289 }
290 }
291
292 proc do_cross_space_fixup_test_2 {} {
293 set testname "fixupbug.s: Test cross space jump/call fixup bug (part 3)"
294 set x 0
295
296 # ELF (osf) doesn't really handle extra sections too well...
297 if [istarget hppa*-*-*elf*] then {
298 return;
299 }
300
301 gas_start "fixupbug.s" "-al"
302
303 while 1 {
304 expect {
305 -re "^ +\[0-9\]+ 0000 E8000002\[^\n\]*\n" { set x [expr $x+1] }
306 -re "\[^\n\]*\n" { }
307 timeout { perror "timeout\n"; break }
308 eof { break }
309 }
310 }
311
312 # This was intended to do any cleanup necessary. It kinda looks like it
313 # isn't needed, but just in case, please keep it in for now.
314 gas_finish
315
316 # Did we find what we were looking for? If not, flunk it.
317 if [expr $x==1] then { pass $testname } else { fail $testname }
318 }
319
320 proc do_round_mode_test {} {
321 set testname "roundmode.s: Test switching of rounding modes (part 2)"
322 set x 0
323
324 if [gas_test_old "roundmode.s" "" "Test switch of rounding modes(part 1)"] {
325 objdump_start_no_subdir "a.out" "-r"
326
327 # Make sure GAS generated correct relocations to switch rounding modes.
328 # Also make sure (for SOM) that redundant rounding mode relocations
329 # were eliminated.
330 if [istarget hppa*-*-*elf*] then {
331 while 1 {
332 expect {
333 -re "^00000000\[^\n\]*DIR21L\[^\n\]*\n"
334 { set x [expr $x+1] }
335 -re "^00000004\[^\n\]*DIR14R\[^\n\]*\n"
336 { set x [expr $x+1] }
337 -re "^00000008\[^\n\]*DIR21L\[^\n\]*\n"
338 { set x [expr $x+1] }
339 -re "^0000000c\[^\n\]*DIR14R\[^\n\]*\n"
340 { set x [expr $x+1] }
341 -re "^00000010\[^\n\]*DIR21L\[^\n\]*\n"
342 { set x [expr $x+1] }
343 -re "^00000014\[^\n\]*DIR14R\[^\n\]*\n"
344 { set x [expr $x+1] }
345 -re "^00000018\[^\n\]*DIR21L\[^\n\]*\n"
346 { set x [expr $x+1] }
347 -re "^0000001c\[^\n\]*DIR14R\[^\n\]*\n"
348 { set x [expr $x+1] }
349 -re "\[^\n\]*\n" { }
350 timeout { perror "timeout\n"; break }
351 eof { break }
352 }
353 }
354 } else {
355 while 1 {
356 expect {
357 -re "^00000000\[^\n\]*R_R_MODE\[^\n\]*\n"
358 { set x [expr $x+1] }
359 -re "^00000004\[^\n\]*R_R_MODE\[^\n\]*\n"
360 { fail $testname }
361 -re "^00000008\[^\n\]*R_N_MODE\[^\n\]*\n"
362 { set x [expr $x+1] }
363 -re "^0000000c\[^\n\]*R_N_MODE\[^\n\]*\n"
364 { fail $testname }
365 -re "^00000010\[^\n\]*R_R_MODE\[^\n\]*\n"
366 { set x [expr $x+1] }
367 -re "^00000014\[^\n\]*R_R_MODE\[^\n\]*\n"
368 { fail $testname }
369 -re "^00000018\[^\n\]*R_R_MODE\[^\n\]*\n"
370 { set x [expr $x+1] }
371 -re "^0000001c\[^\n\]*R_R_MODE\[^\n\]*\n"
372 { fail $testname }
373 -re "\[^\n\]*\n" { }
374 timeout { perror "timeout\n"; break }
375 eof { break }
376 }
377 }
378 }
379
380 # This was intended to do any cleanup necessary. It kinda looks like it
381 # isn't needed, but just in case, please keep it in for now.
382 objdump_finish
383
384 # Did we find what we were looking for? If not, flunk it.
385 if [istarget hppa*-*-*elf*] then {
386 if [expr $x==8] then { pass $testname } else { fail $testname }
387 } else {
388 if [expr $x==4] then { pass $testname } else { fail $testname }
389 }
390 }
391 }
392
393 proc do_function_reloc_bug {} {
394 set testname "funcrelocbug.s: Test for reloc bug in non-plabel function reference (part 2)"
395 set x 0
396
397 if [gas_test_old "funcrelocbug.s" "" "Test for reloc bug in non-plabel function reference (part 1)"] {
398 objdump_start_no_subdir "a.out" "-r"
399
400 # Make sure GAS generated a correct relocation for the reference.
401 # branch/call
402 while 1 {
403 expect {
404 -re "^000000cc\[^\n\]*f2___4\[^\n+\]*\n"
405 { set x [expr $x+1] }
406 -re "^000000d0\[^\n\]*f2___4\[^\n+\]*\n"
407 { set x [expr $x+1] }
408 -re "\[^\n\]*\n" { }
409 timeout { perror "timeout\n"; break }
410 eof { break }
411 }
412 }
413
414 # This was intended to do any cleanup necessary. It kinda looks like it
415 # isn't needed, but just in case, please keep it in for now.
416 objdump_finish
417
418 # Did we find what we were looking for? If not, flunk it.
419 if [expr $x==2] then { pass $testname } else { fail $testname }
420
421 set testname "funcrelocbug.s: Test for reloc bug in non-plabel function reference (part3)"
422 set x 0
423
424 objdump_start_no_subdir "a.out" "-d"
425 # Make sure we didn't put anything in the instruction itself!
426 while 1 {
427 expect {
428 -re "^000000cc\[^\n\]*ldil 0,r20\[^\n\]*\n"
429 { set x [expr $x+1] }
430 -re "^000000d0\[^\n\]*ldo 0\[\(\]+r20\[\)\]+,r19\[^\n\]*\n"
431 { set x [expr $x+1] }
432 -re "\[^\n\]*\n" { }
433 timeout { perror "timeout\n"; break }
434 eof { break }
435 }
436 }
437
438 # This was intended to do any cleanup necessary. It kinda looks like it
439 # isn't needed, but just in case, please keep it in for now.
440 objdump_finish
441
442 # Did we find what we were looking for? If not, flunk it.
443 if [expr $x==2] then { pass $testname } else { fail $testname }
444 }
445
446 }
447
448 if [istarget hppa*-*-*] then {
449 # Make sure we put the right relocation entry on a BLE instruction.
450 do_ble_relocation_test
451
452 # Make sure relocation reductions are not too agressive about
453 # adjusting relocations against some symbols.
454 do_relocation_reduction_tests
455
456 # Check that mode selectors on a ble instruction actually work.
457 do_ble_mode_selector_test
458
459 # 1.36 simply didn't generate all the plabels it should have. Make
460 # sure gas-2 does.
461 do_plabel_relocation_test
462
463 # Make sure a field selector only effects the current instruction
464 # or assembler directive.
465 do_selector_scope_test
466
467 # This should really generate a relocation. It would make life much
468 # easier on the optimizing linker. Until then just make sure the
469 # difference is computed correctly.
470 do_local_label_as_operand_test
471
472 # GAS2 incorrectly generated R_EXIT relocations when .exit directives
473 # were not in the source code.
474 do_exit_relocation_test
475
476 # GAS2 incorrectly thought it could apply a fixup for a pc-relative
477 # branch/call which crossed different subspaces.
478 # Also check that the assembled instruction is correct
479 do_cross_space_fixup_test_1
480 do_cross_space_fixup_test_2
481
482 # Make sure we switch rounding modes correctly
483 do_round_mode_test
484
485 # Test for a bug found when a function was used in a non-branching
486 # instruction *without* a plabel (for portable runtime model)
487 do_function_reloc_bug
488 }
This page took 0.040699 seconds and 5 git commands to generate.