From e8dc4a93474f925b612ef57be2d0b92bed80431e Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Sun, 7 Nov 1993 06:46:44 +0000 Subject: [PATCH] * gas/hppa/reloc/selectorbug.s: New test. * gas/hppa/reloc/reloc.exp: Run it. --- gas/testsuite/ChangeLog | 5 + gas/testsuite/gas/hppa/reloc/.Sanitize | 1 + gas/testsuite/gas/hppa/reloc/reloc.exp | 232 +++++++++++++++++++++ gas/testsuite/gas/hppa/reloc/selectorbug.s | 28 +++ 4 files changed, 266 insertions(+) create mode 100755 gas/testsuite/gas/hppa/reloc/reloc.exp create mode 100644 gas/testsuite/gas/hppa/reloc/selectorbug.s diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 23dc42bcd0f..b181860c249 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,8 @@ +Sat Nov 6 22:45:08 1993 Jeffrey A. Law (law@snake.cs.utah.edu) + + * gas/hppa/reloc/selectorbug.s: New test. + * gas/hppa/reloc/reloc.exp: Run it. + Thu Nov 4 17:01:30 1993 Jeffrey A. Law (law@snake.cs.utah.edu) * gas/hppa/unsorted/fragbug.s: New test. diff --git a/gas/testsuite/gas/hppa/reloc/.Sanitize b/gas/testsuite/gas/hppa/reloc/.Sanitize index 05fa4f045a5..1abb9b63922 100644 --- a/gas/testsuite/gas/hppa/reloc/.Sanitize +++ b/gas/testsuite/gas/hppa/reloc/.Sanitize @@ -32,6 +32,7 @@ labelopbug.s plabelbug.s reloc.exp relocreduce.s +selectorbug.s Things-to-lose: diff --git a/gas/testsuite/gas/hppa/reloc/reloc.exp b/gas/testsuite/gas/hppa/reloc/reloc.exp new file mode 100755 index 00000000000..7c75e93a815 --- /dev/null +++ b/gas/testsuite/gas/hppa/reloc/reloc.exp @@ -0,0 +1,232 @@ +# Copyright (C) 1993 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., 675 Mass Ave, Cambridge, MA 02139, 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" + + # 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_R17\[^\n\]*\n" { set x 1 } + -re "\[^\n\]*\n" { } + timeout { error "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 "relocreduce.s: Test relocation reductions (part 2)" + set x 0 + + if [gas_test_old "relocreduce.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 "^00000000\[^\n\]*PLABEL\[^\n\]*foo\[^\n\]*\n" + { set x [expr $x+1] } + -re "^0000001c\[^\n\]*PCREL_CALL\[^\n\]*foo\[^\n\]*\n" + { set x [4xpr $x+1] } + -re "\[^\n\]*\n" { } + timeout { error "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 { error "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_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 { error "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*-*-osf] then { + while 1 { + expect { + -re "^00000014\[^\n\]*HPPA_32\[^\n\]*\n" + { set x 1 } + -re "^00000014\[^\n\]*PLABEL\[^\n\]*foo\[^\n\]*\n" + { set x 0 } + -re "\[^\n\]*\n" { } + timeout { error "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 { error "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 { error "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 } + } +} + +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. + setup_xfail hppa*-*-* + do_ble_mode_selector_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 +} diff --git a/gas/testsuite/gas/hppa/reloc/selectorbug.s b/gas/testsuite/gas/hppa/reloc/selectorbug.s new file mode 100644 index 00000000000..6925d383f51 --- /dev/null +++ b/gas/testsuite/gas/hppa/reloc/selectorbug.s @@ -0,0 +1,28 @@ + .SPACE $PRIVATE$ + .SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31 + .SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82 + .SPACE $TEXT$ + .SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44 + .SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY + .IMPORT $global$,DATA + .IMPORT $$dyncall,MILLICODE +; gcc_compiled.: + .EXPORT intVec_error_handler,DATA + .SPACE $PRIVATE$ + .SUBSPA $DATA$ + +intVec_error_handler: + .word P%default_intVec_error_handler__FPCc + .SPACE $TEXT$ + .SUBSPA $CODE$ + + .align 4 + .EXPORT foo,CODE + .EXPORT foo,ENTRY,PRIV_LEV=3 +foo: + .PROC + .CALLINFO FRAME=0 + .ENTRY + .stabd 68,0,41 + .EXIT + .PROCEND -- 2.30.2