1 # Copyright (C) 1993 Free Software Foundation, Inc.
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.
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.
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. */
17 # Please email any bugs, comments, and/or additions to this file to:
20 # Written by the Center for Software Science at the University of Utah
21 # and by Cygnus Support.
23 proc do_ble_relocation_test {} {
24 set testname "blebug.s: Test for proper relocation for BLE (part 2)"
27 if [gas_test_old "blebug.s" "" "Proper relocation for BLE (part 1)"] then {
28 objdump_start_no_subdir "a.out" "-r"
30 # At one time both versions of the assembler would incorrectly use
31 # a PC-relative relocation for a BLE instruction.
34 -re "^00000004\[^\n\]*ABS_CALL\[^\n\]*\n" { set x 1 }
36 timeout { error "timeout\n"; break }
42 # This was intended to do any cleanup necessary. It kinda looks like it
43 # isn't needed, but just in case, please keep it in for now.
46 # Did we find what we were looking for? If not, flunk it.
47 if [expr $x==1] then { pass $testname } else { fail $testname }
50 proc do_relocation_reduction_tests {} {
51 set testname "relocreduce.s: Test relocation reductions (part 2)"
54 if [gas_test_old "relocreduce.s" "" "Relocation reductions (part1)"] then {
55 objdump_start_no_subdir "a.out" "-r"
57 # Check to make sure relocations involving procedure labels
58 # are not reduced to a relocation involving some other symbol.
59 # Doing so makes generating parameter relocation stubs impossible.
62 -re "^00000004\[^\n\]*PLABEL\[^\n\]*foo\[^\n\]*\n"
64 -re "^00000014\[^\n\]*PCREL_CALL\[^\n\]*foo\[^\n\]*\n"
67 timeout { error "timeout\n"; break }
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.
77 # Did we find what we were looking for? If not, flunk it.
78 if [expr $x==2] then { pass $testname } else { fail $testname }
81 proc do_ble_mode_selector_test {} {
82 set testname "blebug2.s: blebug2"
85 gas_start "blebug2.s" "-al"
87 # GAS uses too many bits on the BLE instruction.
90 -re "^ +\[0-9\]+ 0000 20202801\[^\n\]*\n" { set x [expr $x+1] }
91 -re "^ +\[0-9\]+ 0004 E420E008\[^\n\]*\n" { set x [expr $x+1] }
93 timeout { error "timeout\n"; break }
98 # This was intended to do any cleanup necessary. It kinda looks like it
99 # isn't needed, but just in case, please keep it in for now.
102 # Did we find what we were looking for? If not, flunk it.
103 if [expr $x==2] then { pass $testname } else { fail $testname }
106 proc do_plabel_relocation_test {} {
107 set testname "plabelbug.s: Old gas-1.36 plabel bug (part 2)"
110 if [gas_test_old "plabelbug.s" "" "Old gas-1.36 plabel bug (part 1)"] {
111 objdump_start_no_subdir "a.out" "-r"
113 # Check that we make PLABEL relocation entries when they're needed.
116 -re "^\[04\]0000000\[^\n\]*PLABEL\[^\n\]*\n"
117 { set x [expr $x+1] }
118 -re "^\[04\]0000004\[^\n\]*PLABEL\[^\n\]*\n"
119 { set x [expr $x+1] }
121 timeout { error "timeout\n"; break }
126 # This was intended to do any cleanup necessary. It kinda looks like it
127 # isn't needed, but just in case, please keep it in for now.
130 # Did we find what we were looking for? If not, flunk it.
131 if [expr $x==2] then { pass $testname } else { fail $testname }
135 proc do_selector_scope_test {} {
136 set testname "selectorbug.s: Test scope of field selector"
139 if [gas_test_old "selectorbug.s" "" "Test scope of field selector (part 1)"] {
140 objdump_start_no_subdir "a.out" "-r"
142 # Check to make sure the relocation entry after the plabel is correct.
143 # If an old field selector was incorrectly "carried" over, then
144 # this test will fail.
145 if [istarget hppa*-*-osf] then {
148 -re "^00000014\[^\n\]*HPPA_32\[^\n\]*\n"
150 -re "^00000014\[^\n\]*PLABEL\[^\n\]*foo\[^\n\]*\n"
153 timeout { error "timeout\n"; break }
160 -re "^00000014\[^\n\]*DATA_ONE\[^\n\]*\n"
162 -re "^00000014\[^\n\]*PLABEL\[^\n\]*foo\[^\n\]*\n"
165 timeout { error "timeout\n"; break }
171 # This was intended to do any cleanup necessary. It kinda looks like it
172 # isn't needed, but just in case, please keep it in for now.
175 # Did we find what we were looking for? If not, flunk it.
176 if [expr $x==1] then { pass $testname } else { fail $testname }
180 proc do_local_label_as_operand_test {} {
181 set testname "labelopbug.s: Test local label as operand (non-branching)"
184 if [gas_test_old "labelopbug.s" "" "Local label as operand (part 1)"] {
185 objdump_start_no_subdir "a.out" "-r"
187 # Check to make sure we handle difference of local lables as an operand
188 # to a non-branching instruction correctly.
191 -re "^0000002c\[^\n\]*0x00000024\[^\n\]*\n"
192 { set x [expr $x+1] }
193 -re "^00000030\[^\n\]*0x00000024\[^\n\]*\n"
194 { set x [expr $x+1] }
196 timeout { error "timeout\n"; break }
201 # This was intended to do any cleanup necessary. It kinda looks like it
202 # isn't needed, but just in case, please keep it in for now.
205 # Did we find what we were looking for? If not, flunk it.
206 if [expr $x==2] then { pass $testname } else { fail $testname }
210 proc do_exit_relocation_test {} {
211 set testname "exitbug.s: Test for bogus R_EXIT relocation (part 2)"
214 # Elf (osf) does not use ENTRY/EXIT relocations.
215 # I guess we could look at the unwind subspaces it builds...
216 if [istarget hppa*-*-osf*] then {
220 if [gas_test_old "exitbug.s" "" "Test for bogus R_EXIT relocation (part 1)"] {
221 objdump_start_no_subdir "a.out" "-r"
223 # Note that a match here is really a FAILURE!
226 -re "^00000000\[^\n\]*R_EXIT\[^\n\]*\n"
227 { set x [expr $x+1] }
229 timeout { error "timeout\n"; break }
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.
238 # Did we find what we were looking for? If not, flunk it.
239 if [expr $x==0] then { pass $testname } else { fail $testname }
243 if [istarget hppa*-*-*] then {
244 # Make sure we put the right relocation entry on a BLE instruction.
245 do_ble_relocation_test
247 # Make sure relocation reductions are not too agressive about
248 # adjusting relocations against some symbols.
249 do_relocation_reduction_tests
251 # Check that mode selectors on a ble instruction actually work.
252 do_ble_mode_selector_test
254 # 1.36 simply didn't generate all the plabels it should have. Make
256 do_plabel_relocation_test
258 # Make sure a field selector only effects the current instruction
259 # or assembler directive.
260 do_selector_scope_test
262 # This should really generate a relocation. It would make life much
263 # easier on the optimizing linker. Until then just make sure the
264 # difference is computed correctly.
265 do_local_label_as_operand_test
267 # GAS2 incorrectly generated R_EXIT relocations when .exit directives
268 # were not in the source code.
269 do_exit_relocation_test