📄 reloc.exp
字号:
# Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc.# This program is free software; you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation; either version 2 of the License, or# (at your option) any later version.# # This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU General Public License for more details.# # You should have received a copy of the GNU General Public License# along with this program; if not, write to the Free Software# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Please email any bugs, comments, and/or additions to this file to:# DejaGnu@cygnus.com# Written by the Center for Software Science at the University of Utah# and by Cygnus Support.proc do_ble_relocation_test {} { set testname "blebug.s: Test for proper relocation for BLE (part 2)" set x 0 if [gas_test_old "blebug.s" "" "Proper relocation for BLE (part 1)"] then { objdump_start_no_subdir "a.out" "-r" if ![istarget hppa*-*-*elf*] then { # At one time both versions of the assembler would incorrectly use # a PC-relative relocation for a BLE instruction. while 1 { expect { -re "^00000004\[^\n\]*ABS_CALL\[^\n\]*\n" { set x 1 } -re "\[^\n\]*\n" { } timeout { perror "timeout\n"; break } eof { break } } } } else { # At one time both versions of the assembler would incorrectly use # a PC-relative relocation for a BLE instruction. while 1 { expect { -re "^00000000\[^\n\]*DIR21L\[^\n\]*\n" { set x 1 } -re "^00000004\[^\n\]*DIR17R\[^\n\]*\n" { set x 1 } -re "\[^\n\]*\n" { } timeout { perror "timeout\n"; break } eof { break } } } } } # This was intended to do any cleanup necessary. It kinda looks like it # isn't needed, but just in case, please keep it in for now. objdump_finish # Did we find what we were looking for? If not, flunk it. if [expr $x==1] then { pass $testname } else { fail $testname }}proc do_relocation_reduction_tests {} { set testname "reduce.s: Test relocation reductions (part 2)" set x 0 if [gas_test_old "reduce.s" "" "Relocation reductions (part1)"] then { objdump_start_no_subdir "a.out" "-r" # Check to make sure relocations involving procedure labels # are not reduced to a relocation involving some other symbol. # Doing so makes generating parameter relocation stubs impossible. while 1 { expect { -re "^00000004\[^\n\]*PLABEL\[^\n\]*foo\[^\n\]*\n" { set x [expr $x+1] } -re "^00000014\[^\n\]*PCREL\[^\n\]*foo\[^\n\]*\n" { set x [expr $x+1] } -re "\[^\n\]*\n" { } timeout { perror "timeout\n"; break } eof { break } } } } # This was intended to do any cleanup necessary. It kinda looks like it # isn't needed, but just in case, please keep it in for now. objdump_finish # Did we find what we were looking for? If not, flunk it. if [expr $x==2] then { pass $testname } else { fail $testname } set testname "reduce2.s: More relocation reduction tests (part 2)" set x 0 if [gas_test_old "reduce2.s" "" "More relocatoin reductions (part1)"] then { objdump_start_no_subdir "a.out" "-r" # Check to make sure DLT relative relocs are not reduced to sym+addend # Doing so doesn't work as one might expect while 1 { expect { -re "^00000004\[^\n\]*DLT\[^\n\]*L.C0000\[^\n\]*\n" { set x [expr $x+1] } -re "^0000001c\[^\n\]*DLT\[^\n\]*L.C0000\[^\n\]*\n" { set x [expr $x+1] } -re "^00000030\[^\n\]*DLT\[^\n\]*L.C0001\[^\n\]*\n" { set x [expr $x+1] } -re "^00000048\[^\n\]*DLT\[^\n\]*L.C0001\[^\n\]*\n" { set x [expr $x+1] } -re "\[^\n\]*\n" { } timeout { perror "timeout\n"; break } eof { break } } } } # This was intended to do any cleanup necessary. It kinda looks like it # isn't needed, but just in case, please keep it in for now. objdump_finish # Did we find what we were looking for? If not, flunk it. if [expr $x==2] then { pass $testname } else { fail $testname } set testname "reduce3.s: Test even more relocation reductions (part 2)" set x 0 if [gas_test_old "reduce3.s" "" "Even more relocation reductions (part1)"] then { objdump_start_no_subdir "a.out" "-r" # Check to make sure relocations involving procedure labels # are not reduced to a relocation involving some other symbol. # Doing so makes generating parameter relocation stubs impossible. while 1 { expect { -re "^0000000c\[^\n\]*yabba\[^\n\+\]*\n" { set x [expr $x+1] } -re "^0000000c\[^\n\]*yabba\+\[^\n\]*\n" { set x 0; break } -re "^00000010\[^\n\]*yabba\[^\n\+\]*\n" { set x [expr $x+1] } -re "^00000010\[^\n\]*yabba\+\[^\n\]*\n" { set x 0; break } -re "\[^\n\]*\n" { } timeout { perror "timeout\n"; break } eof { break } } } } # This was intended to do any cleanup necessary. It kinda looks like it # isn't needed, but just in case, please keep it in for now. objdump_finish # Did we find what we were looking for? If not, flunk it. if [expr $x==2] then { pass $testname } else { fail $testname }}proc do_ble_mode_selector_test {} { set testname "blebug2.s: blebug2" set x 0 gas_start "blebug2.s" "-al" # GAS uses too many bits on the BLE instruction. while 1 { expect { -re "^ +\[0-9\]+ 0000 20202801\[^\n\]*\n" { set x [expr $x+1] } -re "^ +\[0-9\]+ 0004 E420E008\[^\n\]*\n" { set x [expr $x+1] } -re "\[^\n\]*\n" { } timeout { perror "timeout\n"; break } eof { break } } } # This was intended to do any cleanup necessary. It kinda looks like it # isn't needed, but just in case, please keep it in for now. gas_finish # Did we find what we were looking for? If not, flunk it. if [expr $x==2] then { pass $testname } else { fail $testname }}proc do_ble_relocation_test {} { set testname "blebug3.s: blebug3" set x 0 gas_start "blebug3.s" "-al" while 1 { expect { -re "^ +\[0-9\]+ 0000 E4002000\[^\n\]*\n" { set x [expr $x+1] } -re "\[^\n\]*\n" { } timeout { perror "timeout\n"; break } eof { break } } } # This was intended to do any cleanup necessary. It kinda looks like it # isn't needed, but just in case, please keep it in for now. gas_finish # Did we find what we were looking for? If not, flunk it. if [expr $x==1] then { pass $testname } else { fail $testname }}proc do_plabel_relocation_test {} { set testname "plabelbug.s: Old gas-1.36 plabel bug (part 2)" set x 0 if [gas_test_old "plabelbug.s" "" "Old gas-1.36 plabel bug (part 1)"] { objdump_start_no_subdir "a.out" "-r" # Check that we make PLABEL relocation entries when they're needed. while 1 { expect { -re "^00000000\[^\n\]*PLABEL\[^\n\]*\n" { set x [expr $x+1] } -re "^00000004\[^\n\]*PLABEL\[^\n\]*\n" { set x [expr $x+1] } -re "\[^\n\]*\n" { } timeout { perror "timeout\n"; break } eof { break } } } # This was intended to do any cleanup necessary. It kinda looks like it # isn't needed, but just in case, please keep it in for now. objdump_finish # Did we find what we were looking for? If not, flunk it. if [expr $x==2] then { pass $testname } else { fail $testname } }}proc do_selector_scope_test {} { set testname "selectorbug.s: Test scope of field selector" set x 0 if [gas_test_old "selectorbug.s" "" "Test scope of field selector (part 1)"] { objdump_start_no_subdir "a.out" "-r" # Check to make sure the relocation entry after the plabel is correct. # If an old field selector was incorrectly "carried" over, then # this test will fail. if [istarget hppa*-*-*elf*] then { while 1 { expect { -re "^00000014\[^\n\]*DIR32\[^\n\]*\n" { set x 1 } -re "^00000014\[^\n\]*PLABEL\[^\n\]*foo\[^\n\]*\n" { set x 0 } -re "\[^\n\]*\n" { } timeout { perror "timeout\n"; break } eof { break } } } } else { while 1 { expect { -re "^00000014\[^\n\]*DATA_ONE\[^\n\]*\n" { set x 1 } -re "^00000014\[^\n\]*PLABEL\[^\n\]*foo\[^\n\]*\n" { set x 0 } -re "\[^\n\]*\n" { } timeout { perror "timeout\n"; break } eof { break } } } } # This was intended to do any cleanup necessary. It kinda looks like it # isn't needed, but just in case, please keep it in for now. objdump_finish # Did we find what we were looking for? If not, flunk it. if [expr $x==1] then { pass $testname } else { fail $testname } }}proc do_local_label_as_operand_test {} { set testname "labelopbug.s: Test local label as operand (non-branching)" set x 0 if [gas_test_old "labelopbug.s" "" "Local label as operand (part 1)"] { objdump_start_no_subdir "a.out" "-r" # Check to make sure we handle difference of local lables as an operand # to a non-branching instruction correctly. while 1 { expect { -re "^0000002c\[^\n\]*0x00000024\[^\n\]*\n" { set x [expr $x+1] } -re "^00000030\[^\n\]*0x00000024\[^\n\]*\n" { set x [expr $x+1] } -re "\[^\n\]*\n" { } timeout { perror "timeout\n"; break } eof { break } } } # This was intended to do any cleanup necessary. It kinda looks like it # isn't needed, but just in case, please keep it in for now. objdump_finish # Did we find what we were looking for? If not, flunk it. if [expr $x==2] then { pass $testname } else { fail $testname } }}proc do_exit_relocation_test {} { set testname "exitbug.s: Test for bogus R_EXIT relocation (part 2)" set x 0 # Elf (osf) does not use ENTRY/EXIT relocations. # I guess we could look at the unwind subspaces it builds... # Until then, make sure it still assembles. if [istarget hppa*-*-*elf*] then { gas_test_old "exitbug.s" "" "Test for bogus R_EXIT relocation (part 1)" return; } if [gas_test_old "exitbug.s" "" "Test for bogus R_EXIT relocation (part 1)"] { objdump_start_no_subdir "a.out" "-r" # Note that a match here is really a FAILURE! while 1 { expect { -re "^00000000\[^\n\]*R_EXIT\[^\n\]*\n" { set x [expr $x+1] } -re "\[^\n\]*\n" { } timeout { perror "timeout\n"; break } eof { break } } } # This was intended to do any cleanup necessary. It kinda looks like it # isn't needed, but just in case, please keep it in for now. objdump_finish
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -