📄 reloc.exp
字号:
# Did we find what we were looking for? If not, flunk it. if [expr $x==0] then { pass $testname } else { fail $testname } }}proc do_cross_space_fixup_test_1 {} { set testname "fixupbug.s: Test cross space jump/call fixup bug (part 2)" set x 0 # ELF (osf) doesn't really handle extra sections too well... if [istarget hppa*-*-*elf*] then { return; } if [gas_test_old "fixupbug.s" "" "Test cross space jump/call fixup bug (part 1)"] { objdump_start_no_subdir "a.out" "-r" # Make sure GAS generated a fixup/relocation for the cross-space # branch/call while 1 { expect { -re "^00000000\[^\n\]*PCREL_CALL\[^\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==1] then { pass $testname } else { fail $testname } }}proc do_cross_space_fixup_test_2 {} { set testname "fixupbug.s: Test cross space jump/call fixup bug (part 3)" set x 0 # ELF (osf) doesn't really handle extra sections too well... if [istarget hppa*-*-*elf*] then { return; } gas_start "fixupbug.s" "-al" while 1 { expect { -re "^ +\[0-9\]+ 0000 E8000002\[^\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_round_mode_test {} { set testname "roundmode.s: Test switching of rounding modes (part 2)" set x 0 if [gas_test_old "roundmode.s" "" "Test switch of rounding modes(part 1)"] { objdump_start_no_subdir "a.out" "-r" # Make sure GAS generated correct relocations to switch rounding modes. # Also make sure (for SOM) that redundant rounding mode relocations # were eliminated. if [istarget hppa*-*-*elf*] then { while 1 { expect { -re "^00000000\[^\n\]*DIR21L\[^\n\]*\n" { set x [expr $x+1] } -re "^00000004\[^\n\]*DIR14R\[^\n\]*\n" { set x [expr $x+1] } -re "^00000008\[^\n\]*DIR21L\[^\n\]*\n" { set x [expr $x+1] } -re "^0000000c\[^\n\]*DIR14R\[^\n\]*\n" { set x [expr $x+1] } -re "^00000010\[^\n\]*DIR21L\[^\n\]*\n" { set x [expr $x+1] } -re "^00000014\[^\n\]*DIR14R\[^\n\]*\n" { set x [expr $x+1] } -re "^00000018\[^\n\]*DIR21L\[^\n\]*\n" { set x [expr $x+1] } -re "^0000001c\[^\n\]*DIR14R\[^\n\]*\n" { set x [expr $x+1] } -re "\[^\n\]*\n" { } timeout { perror "timeout\n"; break } eof { break } } } } else { while 1 { expect { -re "^00000000\[^\n\]*R_R_MODE\[^\n\]*\n" { set x [expr $x+1] } -re "^00000004\[^\n\]*R_R_MODE\[^\n\]*\n" { fail $testname } -re "^00000008\[^\n\]*R_N_MODE\[^\n\]*\n" { set x [expr $x+1] } -re "^0000000c\[^\n\]*R_N_MODE\[^\n\]*\n" { fail $testname } -re "^00000010\[^\n\]*R_R_MODE\[^\n\]*\n" { set x [expr $x+1] } -re "^00000014\[^\n\]*R_R_MODE\[^\n\]*\n" { fail $testname } -re "^0000001c\[^\n\]*R_R_MODE\[^\n\]*\n" { fail $testname } -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 [istarget hppa*-*-*elf*] then { if [expr $x==8] then { pass $testname } else { fail $testname } } else { if [expr $x==3] then { pass $testname } else { fail $testname } } }}proc do_function_reloc_bug {} { set testname "funcrelocbug.s: Test for reloc bug in non-plabel function reference (part 2)" set x 0 if [gas_test_old "funcrelocbug.s" "" "Test for reloc bug in non-plabel function reference (part 1)"] { objdump_start_no_subdir "a.out" "-r" # Make sure GAS generated a correct relocation for the reference. # branch/call while 1 { expect { -re "^000000cc\[^\n\]*f2___4\[^\n+\]*\n" { set x [expr $x+1] } -re "^000000d0\[^\n\]*f2___4\[^\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 "funcrelocbug.s: Test for reloc bug in non-plabel function reference (part3)" set x 0 objdump_start_no_subdir "a.out" "--prefix-addresses -d" # Make sure we didn't put anything in the instruction itself! while 1 { expect { -re "^000000cc\[^\n\]*ldil 0,r20\[^\n\]*\n" { set x [expr $x+1] } -re "^000000d0\[^\n\]*ldo 0\[\(\]+r20\[\)\]+,r19\[^\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_r_no_reloc {} { set testname "r_no_reloc.s: Test for reloc bug in 4-byte R_NO_RELCOATION fixups (part 2)" set x 0 if [gas_test_old "r_no_reloc.s" "" "Test for reloc bug in 4-byte R_NO_RELOCATION fixups (part 1)"] { objdump_start_no_subdir "a.out" "-r" # Make sure GAS generated a correct relocation for the reference. while 1 { expect { -re "^000c0004\[^\n\]*PLABEL\[^\n]*g\[^\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==1] then { pass $testname } else { fail $testname } }}proc do_pic_relocation_test {} { set testname "picreloc.s: Test for proper PIC relocation (part 2)" set x 0 # ELF (osf) doesn't really handle extra sections too well... if [istarget hppa*-*-*elf*] then { return; } gas_start "picreloc.s" "-al" while 1 { expect { -re "^ +\[0-9\]+ 0000 00000004\[^\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_apply_test {} { set testname "applybug.s: Test for proper fixup appliation (part 2)" set x 0 # ELF (osf) doesn't really handle extra sections too well... if [istarget hppa*-*-*elf*] then { return; } gas_start "applybug.s" "-al" while 1 { expect { -re "^ +\[0-9\]+ 0000 00000000\[^\n\]*\n" { set x [expr $x+1] } -re "^ +\[0-9\]+ 0004 00000000\[^\n\]*\n" { set x [expr $x+1] } -re "^ +\[0-9\]+ 0008 00000000\[^\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==3] then { pass $testname } else { fail $testname }}if [istarget hppa*-*-*] then { # Make sure we put the right relocation entry on a BLE instruction. do_ble_relocation_test # Make sure relocation reductions are not too agressive about # adjusting relocations against some symbols. do_relocation_reduction_tests # Check that mode selectors on a ble instruction actually work. do_ble_mode_selector_test # Check that we take the -8 adjustment into account when zeroing # out the displacement field in a ble instruction with a reloc do_ble_relocation_test # 1.36 simply didn't generate all the plabels it should have. Make # sure gas-2 does. do_plabel_relocation_test # Make sure a field selector only effects the current instruction # or assembler directive. do_selector_scope_test # This should really generate a relocation. It would make life much # easier on the optimizing linker. Until then just make sure the # difference is computed correctly. do_local_label_as_operand_test # GAS2 incorrectly generated R_EXIT relocations when .exit directives # were not in the source code. do_exit_relocation_test # GAS2 incorrectly thought it could apply a fixup for a pc-relative # branch/call which crossed different subspaces. # Also check that the assembled instruction is correct do_cross_space_fixup_test_1 do_cross_space_fixup_test_2 # Make sure we switch rounding modes correctly do_round_mode_test # Test for a bug found when a function was used in a non-branching # instruction *without* a plabel (for portable runtime model) do_function_reloc_bug # Test for an off-by-one bug in the handling of 4-byte R_NO_RELOCATION # fixups. do_r_no_reloc # Test a relocation problem which shows up when building shared # libraries in SOM do_pic_relocation_test # Test a problem with md_apply_fix that was introduced when fixing # the pic relocation test. do_apply_test # Make sure gas doesn't resolve long-calls which are to be fixed # by the linker gas_test "longcall.s" "" "" "Avoid resolving long-calls"}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -