Commit | Line | Data |
---|---|---|
e31cd5a0 | 1 | # Copyright 1993, 1996, 1997, 2002 Free Software Foundation, Inc. |
252b5132 RH |
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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 | ||
170cdc4f AM |
30 | if {[istarget hppa*64*-*-*] |
31 | || [istarget hppa*-*-*elf*] || [istarget hppa*-*-linux*]} then { | |
252b5132 RH |
32 | # At one time both versions of the assembler would incorrectly use |
33 | # a PC-relative relocation for a BLE instruction. | |
34 | while 1 { | |
35 | expect { | |
170cdc4f AM |
36 | -re "^0+\[^\n\]*DIR21L\[^\n\]*\n" { set x 1 } |
37 | -re "^0+4\[^\n\]*DIR17R\[^\n\]*\n" { set x 1 } | |
252b5132 RH |
38 | -re "\[^\n\]*\n" { } |
39 | timeout { perror "timeout\n"; break } | |
40 | eof { break } | |
41 | } | |
42 | } | |
43 | } else { | |
44 | # At one time both versions of the assembler would incorrectly use | |
45 | # a PC-relative relocation for a BLE instruction. | |
46 | while 1 { | |
47 | expect { | |
170cdc4f | 48 | -re "^0+4\[^\n\]*ABS_CALL\[^\n\]*\n" { set x 1 } |
252b5132 RH |
49 | -re "\[^\n\]*\n" { } |
50 | timeout { perror "timeout\n"; break } | |
51 | eof { break } | |
52 | } | |
53 | } | |
54 | } | |
55 | } | |
56 | ||
57 | # This was intended to do any cleanup necessary. It kinda looks like it | |
58 | # isn't needed, but just in case, please keep it in for now. | |
59 | objdump_finish | |
60 | ||
61 | # Did we find what we were looking for? If not, flunk it. | |
62 | if [expr $x==1] then { pass $testname } else { fail $testname } | |
63 | } | |
64 | ||
65 | proc do_relocation_reduction_tests {} { | |
66 | set testname "reduce.s: Test relocation reductions (part 2)" | |
67 | set x 0 | |
68 | ||
170cdc4f | 69 | if {[istarget hppa*64*-*-*] |
4b6341e9 | 70 | || [istarget hppa*-*-*elf*] || [istarget hppa*-*-linux*]} then { |
a91f57fd JL |
71 | return; |
72 | } | |
73 | ||
252b5132 RH |
74 | if [gas_test_old "reduce.s" "" "Relocation reductions (part1)"] then { |
75 | objdump_start_no_subdir "a.out" "-r" | |
76 | ||
77 | # Check to make sure relocations involving procedure labels | |
78 | # are not reduced to a relocation involving some other symbol. | |
79 | # Doing so makes generating parameter relocation stubs impossible. | |
80 | while 1 { | |
81 | expect { | |
a91f57fd | 82 | -re "^0+4\[^\n\]*PLABEL\[^\n\]*foo\[^\n\]*\n" |
252b5132 | 83 | { set x [expr $x+1] } |
a91f57fd | 84 | -re "^0+14\[^\n\]*PCREL\[^\n\]*foo\[^\n\]*\n" |
252b5132 RH |
85 | { set x [expr $x+1] } |
86 | -re "\[^\n\]*\n" { } | |
87 | timeout { perror "timeout\n"; break } | |
88 | eof { break } | |
89 | } | |
90 | } | |
91 | } | |
92 | ||
93 | # This was intended to do any cleanup necessary. It kinda looks like it | |
94 | # isn't needed, but just in case, please keep it in for now. | |
95 | objdump_finish | |
96 | ||
97 | # Did we find what we were looking for? If not, flunk it. | |
98 | if [expr $x==2] then { pass $testname } else { fail $testname } | |
99 | ||
100 | set testname "reduce2.s: More relocation reduction tests (part 2)" | |
101 | set x 0 | |
102 | ||
a91f57fd | 103 | if [gas_test_old "reduce2.s" "" "More relocation reductions (part1)"] then { |
252b5132 RH |
104 | objdump_start_no_subdir "a.out" "-r" |
105 | ||
106 | # Check to make sure DLT relative relocs are not reduced to sym+addend | |
107 | # Doing so doesn't work as one might expect | |
108 | while 1 { | |
109 | expect { | |
a91f57fd | 110 | -re "^0+4\[^\n\]*DLT\[^\n\]*L.C0000\[^\n\]*\n" |
252b5132 | 111 | { set x [expr $x+1] } |
a91f57fd | 112 | -re "^0+1c\[^\n\]*DLT\[^\n\]*L.C0000\[^\n\]*\n" |
252b5132 | 113 | { set x [expr $x+1] } |
a91f57fd | 114 | -re "^0+30\[^\n\]*DLT\[^\n\]*L.C0001\[^\n\]*\n" |
252b5132 | 115 | { set x [expr $x+1] } |
a91f57fd | 116 | -re "^0+48\[^\n\]*DLT\[^\n\]*L.C0001\[^\n\]*\n" |
252b5132 RH |
117 | { set x [expr $x+1] } |
118 | -re "\[^\n\]*\n" { } | |
119 | timeout { perror "timeout\n"; break } | |
120 | eof { break } | |
121 | } | |
122 | } | |
123 | } | |
124 | ||
125 | # This was intended to do any cleanup necessary. It kinda looks like it | |
126 | # isn't needed, but just in case, please keep it in for now. | |
127 | objdump_finish | |
128 | ||
129 | # Did we find what we were looking for? If not, flunk it. | |
130 | if [expr $x==2] then { pass $testname } else { fail $testname } | |
131 | ||
132 | set testname "reduce3.s: Test even more relocation reductions (part 2)" | |
133 | set x 0 | |
134 | ||
135 | if [gas_test_old "reduce3.s" "" "Even more relocation reductions (part1)"] then { | |
136 | objdump_start_no_subdir "a.out" "-r" | |
137 | ||
138 | # Check to make sure relocations involving procedure labels | |
139 | # are not reduced to a relocation involving some other symbol. | |
140 | # Doing so makes generating parameter relocation stubs impossible. | |
141 | while 1 { | |
142 | expect { | |
a91f57fd | 143 | -re "^0+c\[^\n\]*yabba\[^\n\+\]*\n" |
252b5132 | 144 | { set x [expr $x+1] } |
a91f57fd | 145 | -re "^0+c\[^\n\]*yabba\+\[^\n\]*\n" |
252b5132 | 146 | { set x 0; break } |
a91f57fd | 147 | -re "^0+10\[^\n\]*yabba\[^\n\+\]*\n" |
252b5132 | 148 | { set x [expr $x+1] } |
a91f57fd | 149 | -re "^0+10\[^\n\]*yabba\+\[^\n\]*\n" |
252b5132 RH |
150 | { set x 0; break } |
151 | -re "\[^\n\]*\n" { } | |
152 | timeout { perror "timeout\n"; break } | |
153 | eof { break } | |
154 | } | |
155 | } | |
156 | } | |
157 | ||
158 | # This was intended to do any cleanup necessary. It kinda looks like it | |
159 | # isn't needed, but just in case, please keep it in for now. | |
160 | objdump_finish | |
161 | ||
162 | # Did we find what we were looking for? If not, flunk it. | |
163 | if [expr $x==2] then { pass $testname } else { fail $testname } | |
164 | } | |
165 | ||
166 | proc do_ble_mode_selector_test {} { | |
167 | set testname "blebug2.s: blebug2" | |
168 | set x 0 | |
169 | ||
170 | gas_start "blebug2.s" "-al" | |
171 | ||
172 | # GAS uses too many bits on the BLE instruction. | |
173 | while 1 { | |
174 | expect { | |
175 | -re "^ +\[0-9\]+ 0000 20202801\[^\n\]*\n" { set x [expr $x+1] } | |
176 | -re "^ +\[0-9\]+ 0004 E420E008\[^\n\]*\n" { set x [expr $x+1] } | |
177 | -re "\[^\n\]*\n" { } | |
178 | timeout { perror "timeout\n"; break } | |
179 | eof { break } | |
180 | } | |
181 | } | |
182 | ||
183 | # This was intended to do any cleanup necessary. It kinda looks like it | |
184 | # isn't needed, but just in case, please keep it in for now. | |
185 | gas_finish | |
186 | ||
187 | # Did we find what we were looking for? If not, flunk it. | |
188 | if [expr $x==2] then { pass $testname } else { fail $testname } | |
189 | } | |
190 | ||
191 | proc do_ble_relocation_test {} { | |
192 | set testname "blebug3.s: blebug3" | |
193 | set x 0 | |
194 | ||
195 | gas_start "blebug3.s" "-al" | |
196 | ||
197 | while 1 { | |
198 | expect { | |
199 | -re "^ +\[0-9\]+ 0000 E4002000\[^\n\]*\n" { set x [expr $x+1] } | |
200 | -re "\[^\n\]*\n" { } | |
201 | timeout { perror "timeout\n"; break } | |
202 | eof { break } | |
203 | } | |
204 | } | |
205 | ||
206 | # This was intended to do any cleanup necessary. It kinda looks like it | |
207 | # isn't needed, but just in case, please keep it in for now. | |
208 | gas_finish | |
209 | ||
210 | # Did we find what we were looking for? If not, flunk it. | |
211 | if [expr $x==1] then { pass $testname } else { fail $testname } | |
212 | } | |
213 | ||
214 | proc do_plabel_relocation_test {} { | |
215 | set testname "plabelbug.s: Old gas-1.36 plabel bug (part 2)" | |
216 | set x 0 | |
217 | ||
218 | if [gas_test_old "plabelbug.s" "" "Old gas-1.36 plabel bug (part 1)"] { | |
219 | objdump_start_no_subdir "a.out" "-r" | |
220 | ||
221 | # Check that we make PLABEL relocation entries when they're needed. | |
222 | while 1 { | |
223 | expect { | |
a91f57fd | 224 | -re "^0+\[^\n\]*PLABEL\[^\n\]*\n" |
252b5132 | 225 | { set x [expr $x+1] } |
a91f57fd | 226 | -re "^0+4\[^\n\]*PLABEL\[^\n\]*\n" |
252b5132 RH |
227 | { set x [expr $x+1] } |
228 | -re "\[^\n\]*\n" { } | |
229 | timeout { perror "timeout\n"; break } | |
230 | eof { break } | |
231 | } | |
232 | } | |
233 | ||
234 | # This was intended to do any cleanup necessary. It kinda looks like it | |
235 | # isn't needed, but just in case, please keep it in for now. | |
236 | objdump_finish | |
237 | ||
238 | # Did we find what we were looking for? If not, flunk it. | |
239 | if [expr $x==2] then { pass $testname } else { fail $testname } | |
240 | } | |
241 | } | |
242 | ||
243 | proc do_selector_scope_test {} { | |
244 | set testname "selectorbug.s: Test scope of field selector" | |
245 | set x 0 | |
246 | ||
170cdc4f | 247 | if [istarget hppa*64*-*-*] then { |
a91f57fd JL |
248 | return; |
249 | } | |
250 | ||
252b5132 RH |
251 | if [gas_test_old "selectorbug.s" "" "Test scope of field selector (part 1)"] { |
252 | objdump_start_no_subdir "a.out" "-r" | |
253 | ||
254 | # Check to make sure the relocation entry after the plabel is correct. | |
255 | # If an old field selector was incorrectly "carried" over, then | |
256 | # this test will fail. | |
36f89926 | 257 | if {[istarget hppa*-*-*elf*] || [istarget hppa*-*-linux*]} then { |
252b5132 RH |
258 | while 1 { |
259 | expect { | |
a91f57fd | 260 | -re "^0+14\[^\n\]*DIR32\[^\n\]*\n" |
252b5132 | 261 | { set x 1 } |
a91f57fd | 262 | -re "^0+14\[^\n\]*PLABEL\[^\n\]*foo\[^\n\]*\n" |
252b5132 RH |
263 | { set x 0 } |
264 | -re "\[^\n\]*\n" { } | |
265 | timeout { perror "timeout\n"; break } | |
266 | eof { break } | |
267 | } | |
268 | } | |
269 | } else { | |
270 | while 1 { | |
271 | expect { | |
a91f57fd | 272 | -re "^0+14\[^\n\]*DATA_ONE\[^\n\]*\n" |
252b5132 | 273 | { set x 1 } |
a91f57fd | 274 | -re "^0+14\[^\n\]*PLABEL\[^\n\]*foo\[^\n\]*\n" |
252b5132 RH |
275 | { set x 0 } |
276 | -re "\[^\n\]*\n" { } | |
277 | timeout { perror "timeout\n"; break } | |
278 | eof { break } | |
279 | } | |
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_local_label_as_operand_test {} { | |
293 | set testname "labelopbug.s: Test local label as operand (non-branching)" | |
294 | set x 0 | |
295 | ||
296 | if [gas_test_old "labelopbug.s" "" "Local label as operand (part 1)"] { | |
297 | objdump_start_no_subdir "a.out" "-r" | |
298 | ||
5c1e36e1 AM |
299 | # Check to make sure we handle difference of local labels as an operand |
300 | # to a non-branching instruction correctly. On hppa elf targets, the | |
301 | # R_PARISC_DIR21 and R_PARISC_DIR14R relocations are done with LR and | |
302 | # RR selectors, respectively. As a result, we can't reduce these to | |
303 | # section offsets without risking incorrect rounding. So, we just | |
304 | # check to see if the label hasn't been reduced. | |
305 | if {[istarget hppa*64*-*-*] | |
306 | || [istarget hppa*-*-*elf*] || [istarget hppa*-*-linux*]} then { | |
307 | while 1 { | |
308 | expect { | |
309 | -re "^0+2c\[^\n\]*L.0002\[^\n\]*\n" | |
310 | { set x [expr $x+1] } | |
311 | -re "^0+30\[^\n\]*L.0002\[^\n\]*\n" | |
312 | { set x [expr $x+1] } | |
313 | -re "\[^\n\]*\n" { } | |
314 | timeout { perror "timeout\n"; break } | |
315 | eof { break } | |
316 | } | |
317 | } | |
318 | } else { | |
319 | while 1 { | |
320 | expect { | |
321 | -re "^0+2c\[^\n\]*0x0+24\[^\n\]*\n" | |
322 | { set x [expr $x+1] } | |
323 | -re "^0+30\[^\n\]*0x0+24\[^\n\]*\n" | |
324 | { set x [expr $x+1] } | |
325 | -re "\[^\n\]*\n" { } | |
326 | timeout { perror "timeout\n"; break } | |
327 | eof { break } | |
328 | } | |
329 | } | |
252b5132 RH |
330 | } |
331 | ||
332 | # This was intended to do any cleanup necessary. It kinda looks like it | |
333 | # isn't needed, but just in case, please keep it in for now. | |
334 | objdump_finish | |
335 | ||
336 | # Did we find what we were looking for? If not, flunk it. | |
337 | if [expr $x==2] then { pass $testname } else { fail $testname } | |
338 | } | |
339 | } | |
340 | ||
341 | proc do_exit_relocation_test {} { | |
342 | set testname "exitbug.s: Test for bogus R_EXIT relocation (part 2)" | |
343 | set x 0 | |
344 | ||
345 | # Elf (osf) does not use ENTRY/EXIT relocations. | |
346 | # I guess we could look at the unwind subspaces it builds... | |
347 | # Until then, make sure it still assembles. | |
170cdc4f AM |
348 | if {[istarget hppa*64*-*-*] |
349 | || [istarget hppa*-*-*elf*] || [istarget hppa*-*-linux*]} then { | |
252b5132 RH |
350 | gas_test_old "exitbug.s" "" "Test for bogus R_EXIT relocation (part 1)" |
351 | return; | |
352 | } | |
353 | ||
354 | if [gas_test_old "exitbug.s" "" "Test for bogus R_EXIT relocation (part 1)"] { | |
355 | objdump_start_no_subdir "a.out" "-r" | |
356 | ||
357 | # Note that a match here is really a FAILURE! | |
358 | while 1 { | |
359 | expect { | |
a91f57fd | 360 | -re "^0+\[^\n\]*R_EXIT\[^\n\]*\n" |
252b5132 RH |
361 | { set x [expr $x+1] } |
362 | -re "\[^\n\]*\n" { } | |
363 | timeout { perror "timeout\n"; break } | |
364 | eof { break } | |
365 | } | |
366 | } | |
367 | ||
368 | # This was intended to do any cleanup necessary. It kinda looks like it | |
369 | # isn't needed, but just in case, please keep it in for now. | |
370 | objdump_finish | |
371 | ||
372 | # Did we find what we were looking for? If not, flunk it. | |
373 | if [expr $x==0] then { pass $testname } else { fail $testname } | |
374 | } | |
375 | } | |
376 | ||
377 | proc do_cross_space_fixup_test_1 {} { | |
378 | set testname "fixupbug.s: Test cross space jump/call fixup bug (part 2)" | |
379 | set x 0 | |
380 | ||
170cdc4f AM |
381 | # ELF doesn't really handle extra sections too well... |
382 | if {[istarget hppa*64*-*-*] | |
383 | || [istarget hppa*-*-*elf*] || [istarget hppa*-*-linux*]} then { | |
252b5132 RH |
384 | return; |
385 | } | |
386 | ||
387 | if [gas_test_old "fixupbug.s" "" "Test cross space jump/call fixup bug (part 1)"] { | |
388 | objdump_start_no_subdir "a.out" "-r" | |
389 | ||
390 | # Make sure GAS generated a fixup/relocation for the cross-space | |
391 | # branch/call | |
392 | while 1 { | |
393 | expect { | |
a91f57fd | 394 | -re "^0+\[^\n\]*PCREL_CALL\[^\n\]*\n" |
252b5132 RH |
395 | { set x [expr $x+1] } |
396 | -re "\[^\n\]*\n" { } | |
397 | timeout { perror "timeout\n"; break } | |
398 | eof { break } | |
399 | } | |
400 | } | |
401 | ||
402 | # This was intended to do any cleanup necessary. It kinda looks like it | |
403 | # isn't needed, but just in case, please keep it in for now. | |
404 | objdump_finish | |
405 | ||
406 | # Did we find what we were looking for? If not, flunk it. | |
407 | if [expr $x==1] then { pass $testname } else { fail $testname } | |
408 | } | |
409 | } | |
410 | ||
411 | proc do_cross_space_fixup_test_2 {} { | |
412 | set testname "fixupbug.s: Test cross space jump/call fixup bug (part 3)" | |
413 | set x 0 | |
414 | ||
170cdc4f AM |
415 | # ELF doesn't really handle extra sections too well... |
416 | if {[istarget hppa*64*-*-*] | |
417 | || [istarget hppa*-*-*elf*] || [istarget hppa*-*-linux*]} then { | |
252b5132 RH |
418 | return; |
419 | } | |
420 | ||
421 | gas_start "fixupbug.s" "-al" | |
422 | ||
423 | while 1 { | |
424 | expect { | |
425 | -re "^ +\[0-9\]+ 0000 E8000002\[^\n\]*\n" { set x [expr $x+1] } | |
426 | -re "\[^\n\]*\n" { } | |
427 | timeout { perror "timeout\n"; break } | |
428 | eof { break } | |
429 | } | |
430 | } | |
431 | ||
432 | # This was intended to do any cleanup necessary. It kinda looks like it | |
433 | # isn't needed, but just in case, please keep it in for now. | |
434 | gas_finish | |
435 | ||
436 | # Did we find what we were looking for? If not, flunk it. | |
437 | if [expr $x==1] then { pass $testname } else { fail $testname } | |
438 | } | |
439 | ||
440 | proc do_round_mode_test {} { | |
441 | set testname "roundmode.s: Test switching of rounding modes (part 2)" | |
442 | set x 0 | |
443 | ||
444 | if [gas_test_old "roundmode.s" "" "Test switch of rounding modes(part 1)"] { | |
445 | objdump_start_no_subdir "a.out" "-r" | |
446 | ||
447 | # Make sure GAS generated correct relocations to switch rounding modes. | |
448 | # Also make sure (for SOM) that redundant rounding mode relocations | |
449 | # were eliminated. | |
170cdc4f AM |
450 | if {[istarget hppa*64*-*-*] |
451 | || [istarget hppa*-*-*elf*] || [istarget hppa*-*-linux*]} then { | |
252b5132 RH |
452 | while 1 { |
453 | expect { | |
a91f57fd | 454 | -re "^0+\[^\n\]*DIR21L\[^\n\]*\n" |
252b5132 | 455 | { set x [expr $x+1] } |
a91f57fd | 456 | -re "^0+4\[^\n\]*DIR14R\[^\n\]*\n" |
252b5132 | 457 | { set x [expr $x+1] } |
a91f57fd | 458 | -re "^0+8\[^\n\]*DIR21L\[^\n\]*\n" |
252b5132 | 459 | { set x [expr $x+1] } |
a91f57fd | 460 | -re "^0+c\[^\n\]*DIR14R\[^\n\]*\n" |
252b5132 | 461 | { set x [expr $x+1] } |
a91f57fd | 462 | -re "^0+10\[^\n\]*DIR21L\[^\n\]*\n" |
252b5132 | 463 | { set x [expr $x+1] } |
a91f57fd | 464 | -re "^0+14\[^\n\]*DIR14R\[^\n\]*\n" |
252b5132 | 465 | { set x [expr $x+1] } |
a91f57fd | 466 | -re "^0+18\[^\n\]*DIR21L\[^\n\]*\n" |
252b5132 | 467 | { set x [expr $x+1] } |
a91f57fd | 468 | -re "^0+1c\[^\n\]*DIR14R\[^\n\]*\n" |
252b5132 RH |
469 | { set x [expr $x+1] } |
470 | -re "\[^\n\]*\n" { } | |
471 | timeout { perror "timeout\n"; break } | |
472 | eof { break } | |
473 | } | |
474 | } | |
475 | } else { | |
476 | while 1 { | |
477 | expect { | |
a91f57fd | 478 | -re "^0+\[^\n\]*R_R_MODE\[^\n\]*\n" |
252b5132 | 479 | { set x [expr $x+1] } |
a91f57fd | 480 | -re "^0+4\[^\n\]*R_R_MODE\[^\n\]*\n" |
252b5132 | 481 | { fail $testname } |
a91f57fd | 482 | -re "^0+8\[^\n\]*R_N_MODE\[^\n\]*\n" |
252b5132 | 483 | { set x [expr $x+1] } |
a91f57fd | 484 | -re "^0+c\[^\n\]*R_N_MODE\[^\n\]*\n" |
252b5132 | 485 | { fail $testname } |
a91f57fd | 486 | -re "^0+10\[^\n\]*R_R_MODE\[^\n\]*\n" |
252b5132 | 487 | { set x [expr $x+1] } |
a91f57fd | 488 | -re "^0+14\[^\n\]*R_R_MODE\[^\n\]*\n" |
252b5132 | 489 | { fail $testname } |
a91f57fd | 490 | -re "^0+1c\[^\n\]*R_R_MODE\[^\n\]*\n" |
252b5132 RH |
491 | { fail $testname } |
492 | -re "\[^\n\]*\n" { } | |
493 | timeout { perror "timeout\n"; break } | |
494 | eof { break } | |
495 | } | |
496 | } | |
497 | } | |
498 | ||
499 | # This was intended to do any cleanup necessary. It kinda looks like it | |
500 | # isn't needed, but just in case, please keep it in for now. | |
501 | objdump_finish | |
502 | ||
503 | # Did we find what we were looking for? If not, flunk it. | |
170cdc4f AM |
504 | if {[istarget hppa*64*-*-*] |
505 | || [istarget hppa*-*-*elf*] || [istarget hppa*-*-linux*]} then { | |
252b5132 RH |
506 | if [expr $x==8] then { pass $testname } else { fail $testname } |
507 | } else { | |
508 | if [expr $x==3] then { pass $testname } else { fail $testname } | |
509 | } | |
510 | } | |
511 | } | |
512 | ||
513 | proc do_function_reloc_bug {} { | |
514 | set testname "funcrelocbug.s: Test for reloc bug in non-plabel function reference (part 2)" | |
515 | set x 0 | |
516 | ||
517 | if [gas_test_old "funcrelocbug.s" "" "Test for reloc bug in non-plabel function reference (part 1)"] { | |
518 | objdump_start_no_subdir "a.out" "-r" | |
519 | ||
520 | # Make sure GAS generated a correct relocation for the reference. | |
521 | # branch/call | |
522 | while 1 { | |
523 | expect { | |
a91f57fd | 524 | -re "^0+cc\[^\n\]*f2___4\[^\n+\]*\n" |
252b5132 | 525 | { set x [expr $x+1] } |
a91f57fd | 526 | -re "^0+d0\[^\n\]*f2___4\[^\n+\]*\n" |
252b5132 RH |
527 | { set x [expr $x+1] } |
528 | -re "\[^\n\]*\n" { } | |
529 | timeout { perror "timeout\n"; break } | |
530 | eof { break } | |
531 | } | |
532 | } | |
533 | ||
534 | # This was intended to do any cleanup necessary. It kinda looks like it | |
535 | # isn't needed, but just in case, please keep it in for now. | |
536 | objdump_finish | |
537 | ||
538 | # Did we find what we were looking for? If not, flunk it. | |
539 | if [expr $x==2] then { pass $testname } else { fail $testname } | |
540 | ||
541 | set testname "funcrelocbug.s: Test for reloc bug in non-plabel function reference (part3)" | |
542 | set x 0 | |
543 | ||
544 | objdump_start_no_subdir "a.out" "--prefix-addresses -d" | |
545 | # Make sure we didn't put anything in the instruction itself! | |
546 | while 1 { | |
547 | expect { | |
a91f57fd | 548 | -re "^0+cc\[^\n\]*ldil 0,r20\[^\n\]*\n" |
252b5132 | 549 | { set x [expr $x+1] } |
a91f57fd | 550 | -re "^0+d0\[^\n\]*ldo 0\[\(\]+r20\[\)\]+,r19\[^\n\]*\n" |
252b5132 RH |
551 | { set x [expr $x+1] } |
552 | -re "\[^\n\]*\n" { } | |
553 | timeout { perror "timeout\n"; break } | |
554 | eof { break } | |
555 | } | |
556 | } | |
557 | ||
558 | # This was intended to do any cleanup necessary. It kinda looks like it | |
559 | # isn't needed, but just in case, please keep it in for now. | |
560 | objdump_finish | |
561 | ||
562 | # Did we find what we were looking for? If not, flunk it. | |
563 | if [expr $x==2] then { pass $testname } else { fail $testname } | |
564 | } | |
565 | ||
566 | } | |
567 | ||
568 | proc do_r_no_reloc {} { | |
569 | set testname "r_no_reloc.s: Test for reloc bug in 4-byte R_NO_RELCOATION fixups (part 2)" | |
570 | set x 0 | |
571 | ||
572 | if [gas_test_old "r_no_reloc.s" "" "Test for reloc bug in 4-byte R_NO_RELOCATION fixups (part 1)"] { | |
573 | objdump_start_no_subdir "a.out" "-r" | |
574 | ||
575 | # Make sure GAS generated a correct relocation for the reference. | |
576 | while 1 { | |
577 | expect { | |
a91f57fd | 578 | -re "^0+c0004\[^\n\]*PLABEL\[^\n]*g\[^\n\]*\n" |
252b5132 RH |
579 | { set x [expr $x+1] } |
580 | -re "\[^\n\]*\n" { } | |
581 | timeout { perror "timeout\n"; break } | |
582 | eof { break } | |
583 | } | |
584 | } | |
585 | ||
586 | # This was intended to do any cleanup necessary. It kinda looks like it | |
587 | # isn't needed, but just in case, please keep it in for now. | |
588 | objdump_finish | |
589 | ||
590 | # Did we find what we were looking for? If not, flunk it. | |
591 | if [expr $x==1] then { pass $testname } else { fail $testname } | |
592 | ||
593 | } | |
594 | } | |
595 | ||
596 | proc do_pic_relocation_test {} { | |
597 | set testname "picreloc.s: Test for proper PIC relocation (part 2)" | |
598 | set x 0 | |
599 | ||
170cdc4f AM |
600 | # ELF doesn't really handle extra sections too well... |
601 | if {[istarget hppa*64*-*-*] | |
602 | || [istarget hppa*-*-*elf*] || [istarget hppa*-*-linux*]} then { | |
252b5132 RH |
603 | return; |
604 | } | |
605 | ||
606 | gas_start "picreloc.s" "-al" | |
607 | ||
608 | while 1 { | |
609 | expect { | |
610 | -re "^ +\[0-9\]+ 0000 00000004\[^\n\]*\n" { set x [expr $x+1] } | |
611 | -re "\[^\n\]*\n" { } | |
612 | timeout { perror "timeout\n"; break } | |
613 | eof { break } | |
614 | } | |
615 | } | |
616 | ||
617 | # This was intended to do any cleanup necessary. It kinda looks like it | |
618 | # isn't needed, but just in case, please keep it in for now. | |
619 | gas_finish | |
620 | ||
621 | # Did we find what we were looking for? If not, flunk it. | |
622 | if [expr $x==1] then { pass $testname } else { fail $testname } | |
623 | } | |
624 | ||
625 | proc do_apply_test {} { | |
170cdc4f | 626 | set testname "applybug.s: Test for proper fixup application (part 2)" |
252b5132 RH |
627 | set x 0 |
628 | ||
170cdc4f AM |
629 | # ELF doesn't really handle extra sections too well... |
630 | if {[istarget hppa*64*-*-*] | |
631 | || [istarget hppa*-*-*elf*] || [istarget hppa*-*-linux*]} then { | |
252b5132 RH |
632 | return; |
633 | } | |
634 | ||
635 | gas_start "applybug.s" "-al" | |
636 | ||
637 | while 1 { | |
638 | expect { | |
639 | -re "^ +\[0-9\]+ 0000 00000000\[^\n\]*\n" { set x [expr $x+1] } | |
640 | -re "^ +\[0-9\]+ 0004 00000000\[^\n\]*\n" { set x [expr $x+1] } | |
641 | -re "^ +\[0-9\]+ 0008 00000000\[^\n\]*\n" { set x [expr $x+1] } | |
642 | -re "\[^\n\]*\n" { } | |
643 | timeout { perror "timeout\n"; break } | |
644 | eof { break } | |
645 | } | |
646 | } | |
647 | ||
648 | # This was intended to do any cleanup necessary. It kinda looks like it | |
649 | # isn't needed, but just in case, please keep it in for now. | |
650 | gas_finish | |
651 | ||
652 | # Did we find what we were looking for? If not, flunk it. | |
653 | if [expr $x==3] then { pass $testname } else { fail $testname } | |
654 | } | |
170cdc4f | 655 | |
252b5132 RH |
656 | if [istarget hppa*-*-*] then { |
657 | # Make sure we put the right relocation entry on a BLE instruction. | |
658 | do_ble_relocation_test | |
659 | ||
660 | # Make sure relocation reductions are not too agressive about | |
661 | # adjusting relocations against some symbols. | |
662 | do_relocation_reduction_tests | |
663 | ||
664 | # Check that mode selectors on a ble instruction actually work. | |
665 | do_ble_mode_selector_test | |
666 | ||
667 | # Check that we take the -8 adjustment into account when zeroing | |
668 | # out the displacement field in a ble instruction with a reloc | |
669 | do_ble_relocation_test | |
670 | ||
671 | # 1.36 simply didn't generate all the plabels it should have. Make | |
672 | # sure gas-2 does. | |
673 | do_plabel_relocation_test | |
674 | ||
675 | # Make sure a field selector only effects the current instruction | |
676 | # or assembler directive. | |
677 | do_selector_scope_test | |
678 | ||
679 | # This should really generate a relocation. It would make life much | |
680 | # easier on the optimizing linker. Until then just make sure the | |
681 | # difference is computed correctly. | |
682 | do_local_label_as_operand_test | |
683 | ||
684 | # GAS2 incorrectly generated R_EXIT relocations when .exit directives | |
685 | # were not in the source code. | |
686 | do_exit_relocation_test | |
687 | ||
688 | # GAS2 incorrectly thought it could apply a fixup for a pc-relative | |
689 | # branch/call which crossed different subspaces. | |
690 | # Also check that the assembled instruction is correct | |
691 | do_cross_space_fixup_test_1 | |
692 | do_cross_space_fixup_test_2 | |
693 | ||
694 | # Make sure we switch rounding modes correctly | |
695 | do_round_mode_test | |
696 | ||
697 | # Test for a bug found when a function was used in a non-branching | |
698 | # instruction *without* a plabel (for portable runtime model) | |
699 | do_function_reloc_bug | |
700 | ||
701 | # Test for an off-by-one bug in the handling of 4-byte R_NO_RELOCATION | |
702 | # fixups. | |
703 | do_r_no_reloc | |
704 | ||
705 | # Test a relocation problem which shows up when building shared | |
706 | # libraries in SOM | |
707 | do_pic_relocation_test | |
708 | ||
709 | # Test a problem with md_apply_fix that was introduced when fixing | |
710 | # the pic relocation test. | |
711 | do_apply_test | |
712 | ||
713 | # Make sure gas doesn't resolve long-calls which are to be fixed | |
714 | # by the linker | |
715 | gas_test "longcall.s" "" "" "Avoid resolving long-calls" | |
716 | } |