diff options
author | Doug Kwan <dougkwan@google.com> | 2016-09-02 15:51:59 -0700 |
---|---|---|
committer | Doug Kwan <dougkwan@google.com> | 2016-09-02 15:51:59 -0700 |
commit | bc99685c7387acaa9fc20f7e45e9cd477bf0c619 (patch) | |
tree | a84234b0bf1fe0b6eb2a4d9634cbd2cf247b8971 /gold/testsuite | |
parent | 4aa4e28bdcf5f0d733def62b542fea11d5f219d5 (diff) | |
download | gdb-bc99685c7387acaa9fc20f7e45e9cd477bf0c619.zip gdb-bc99685c7387acaa9fc20f7e45e9cd477bf0c619.tar.gz gdb-bc99685c7387acaa9fc20f7e45e9cd477bf0c619.tar.bz2 |
Handle ARM-specific --target1-abs, --target1-rel and --target2 options
Diffstat (limited to 'gold/testsuite')
-rw-r--r-- | gold/testsuite/Makefile.am | 46 | ||||
-rw-r--r-- | gold/testsuite/Makefile.in | 69 | ||||
-rw-r--r-- | gold/testsuite/arm_target1.s | 7 | ||||
-rwxr-xr-x | gold/testsuite/arm_target1_abs.sh | 53 | ||||
-rwxr-xr-x | gold/testsuite/arm_target1_rel.sh | 54 | ||||
-rw-r--r-- | gold/testsuite/arm_target2.s | 10 | ||||
-rwxr-xr-x | gold/testsuite/arm_target2_abs.sh | 56 | ||||
-rwxr-xr-x | gold/testsuite/arm_target2_got_rel.sh | 60 | ||||
-rwxr-xr-x | gold/testsuite/arm_target2_rel.sh | 57 |
9 files changed, 409 insertions, 3 deletions
diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am index 86c01f8..f9f707e 100644 --- a/gold/testsuite/Makefile.am +++ b/gold/testsuite/Makefile.am @@ -3604,6 +3604,52 @@ arm_farcall_thumb_arm_5t.o: arm_farcall_thumb_arm.s MOSTLYCLEANFILES += arm_farcall_thumb_arm arm_farcall_thumb_arm_5t +# Check handling of --target1-abs, --target1-rel and --target2 options + +check_SCRIPTS += arm_target1_abs.sh arm_target1_rel.sh \ + arm_target2_rel.sh arm_target2_abs.sh arm_target2_got_rel.sh +check_DATA += arm_target1_abs.stdout arm_target1_rel.stdout \ + arm_target2_rel.stdout arm_target2_abs.stdout arm_target2_got_rel.stdout + +arm_target1_abs.stdout: arm_target1_abs + $(TEST_OBJDUMP) -s $< > $@ + +arm_target1_abs: arm_target1.o ../ld-new + ../ld-new --target1-abs --section-start .text=0x8000 -o $@ $< + +arm_target1_rel.stdout: arm_target1_rel + $(TEST_OBJDUMP) -s $< > $@ + +arm_target1_rel: arm_target1.o ../ld-new + ../ld-new --target1-rel --section-start .text=0x8000 -o $@ $< + +arm_target1.o: arm_target1.s + $(TEST_AS) -o $@ $< + +arm_target2_rel.stdout: arm_target2_rel + $(TEST_OBJDUMP) -s $< > $@ + +arm_target2_rel: arm_target2.o ../ld-new + ../ld-new --target2=rel --section-start .text=0x8000 -o $@ $< + +arm_target2_abs.stdout: arm_target2_abs + $(TEST_OBJDUMP) -s $< > $@ + +arm_target2_abs: arm_target2.o ../ld-new + ../ld-new --target2=abs --section-start .text=0x8000 -o $@ $< + +arm_target2_got_rel.stdout: arm_target2_got_rel + $(TEST_OBJDUMP) -s $< > $@ + +arm_target2_got_rel: arm_target2.o ../ld-new + ../ld-new --target2=got-rel --section-start .text=0x8000 --section-start .got=0x9000 -o $@ $< + +arm_target2.o: arm_target2.s + $(TEST_AS) -o $@ $< + +MOSTLYCLEANFILES += arm_target1_abs arm_target1_rel \ + arm_target2_rel arm_target2_abs arm_target2_got_rel + endif DEFAULT_TARGET_ARM if DEFAULT_TARGET_AARCH64 diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in index 938d474..d2770a2 100644 --- a/gold/testsuite/Makefile.in +++ b/gold/testsuite/Makefile.in @@ -807,6 +807,8 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ # Check Thumb to Thumb farcall veneers # Check Thumb to ARM farcall veneers + +# Check handling of --target1-abs, --target1-rel and --target2 options @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_91 = arm_abs_global.sh \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_branch_in_range.sh \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_branch_out_of_range.sh \ @@ -820,7 +822,12 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_arm_arm.sh \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_arm_thumb.sh \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_thumb.sh \ -@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_arm.sh +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_arm.sh \ +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_target1_abs.sh \ +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_target1_rel.sh \ +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_target2_rel.sh \ +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_target2_abs.sh \ +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_target2_got_rel.sh @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_92 = arm_abs_global.stdout \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_bl_in_range.stdout \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_bl_out_of_range.stdout \ @@ -865,7 +872,12 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_thumb_7m.stdout \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_thumb_6m.stdout \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_arm.stdout \ -@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_arm_5t.stdout +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_arm_5t.stdout \ +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_target1_abs.stdout \ +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_target1_rel.stdout \ +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_target2_rel.stdout \ +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_target2_abs.stdout \ +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_target2_got_rel.stdout @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_93 = arm_abs_global \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_bl_in_range \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_bl_out_of_range \ @@ -908,7 +920,12 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_thumb_7m \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_thumb_6m \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_arm \ -@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_arm_5t +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_arm_5t \ +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_target1_abs \ +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_target1_rel \ +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_target2_rel \ +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_target2_abs \ +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_target2_got_rel @DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_94 = aarch64_reloc_none.sh \ @DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ aarch64_relocs.sh @DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_95 = aarch64_reloc_none.stdout \ @@ -5149,6 +5166,16 @@ arm_farcall_thumb_thumb.sh.log: arm_farcall_thumb_thumb.sh @p='arm_farcall_thumb_thumb.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) arm_farcall_thumb_arm.sh.log: arm_farcall_thumb_arm.sh @p='arm_farcall_thumb_arm.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) +arm_target1_abs.sh.log: arm_target1_abs.sh + @p='arm_target1_abs.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) +arm_target1_rel.sh.log: arm_target1_rel.sh + @p='arm_target1_rel.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) +arm_target2_rel.sh.log: arm_target2_rel.sh + @p='arm_target2_rel.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) +arm_target2_abs.sh.log: arm_target2_abs.sh + @p='arm_target2_abs.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) +arm_target2_got_rel.sh.log: arm_target2_got_rel.sh + @p='arm_target2_got_rel.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) aarch64_reloc_none.sh.log: aarch64_reloc_none.sh @p='aarch64_reloc_none.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) aarch64_relocs.sh.log: aarch64_relocs.sh @@ -7586,6 +7613,42 @@ uninstall-am: @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_farcall_thumb_arm_5t.o: arm_farcall_thumb_arm.s @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_AS) -march=armv5t -o $@ $< + +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_target1_abs.stdout: arm_target1_abs +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_OBJDUMP) -s $< > $@ + +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_target1_abs: arm_target1.o ../ld-new +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new --target1-abs --section-start .text=0x8000 -o $@ $< + +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_target1_rel.stdout: arm_target1_rel +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_OBJDUMP) -s $< > $@ + +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_target1_rel: arm_target1.o ../ld-new +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new --target1-rel --section-start .text=0x8000 -o $@ $< + +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_target1.o: arm_target1.s +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_AS) -o $@ $< + +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_target2_rel.stdout: arm_target2_rel +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_OBJDUMP) -s $< > $@ + +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_target2_rel: arm_target2.o ../ld-new +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new --target2=rel --section-start .text=0x8000 -o $@ $< + +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_target2_abs.stdout: arm_target2_abs +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_OBJDUMP) -s $< > $@ + +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_target2_abs: arm_target2.o ../ld-new +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new --target2=abs --section-start .text=0x8000 -o $@ $< + +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_target2_got_rel.stdout: arm_target2_got_rel +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_OBJDUMP) -s $< > $@ + +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_target2_got_rel: arm_target2.o ../ld-new +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new --target2=got-rel --section-start .text=0x8000 --section-start .got=0x9000 -o $@ $< + +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_target2.o: arm_target2.s +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_AS) -o $@ $< @DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@aarch64_reloc_none.o: aarch64_reloc_none.s @DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_AS) -o $@ $< @DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@aarch64_reloc_none: aarch64_reloc_none.o ../ld-new diff --git a/gold/testsuite/arm_target1.s b/gold/testsuite/arm_target1.s new file mode 100644 index 0000000..f1d5ab5 --- /dev/null +++ b/gold/testsuite/arm_target1.s @@ -0,0 +1,7 @@ +# Test the R_ARM_TARGET1 relocation +# Copied from ld/testsuite/ld-arm/arm-target1.s + .text + .global _start +_start: + .word foo(target1) +foo: diff --git a/gold/testsuite/arm_target1_abs.sh b/gold/testsuite/arm_target1_abs.sh new file mode 100755 index 0000000..cb68595 --- /dev/null +++ b/gold/testsuite/arm_target1_abs.sh @@ -0,0 +1,53 @@ +#!/bin/sh + +# arm_target1_abs.sh -- test --target1-abs option. +# This test is based on ld/testsuite/ld-arm/arm-target1-abs.d. + +# Copyright (C) 2016 Free Software Foundation, Inc. +# Written by Igor Kudrin <ikudrin@accesssoftek.com>. + +# This file is part of gold. + +# 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 3 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., 51 Franklin Street - Fifth Floor, Boston, +# MA 02110-1301, USA. + +check() +{ + file=$1 + section=$2 + pattern=$3 + found=`fgrep "Contents of section $section:" -A1 $file | tail -n 1` + if test -z "$found"; then + echo "Section \"$section\" not found in file $file" + echo "" + echo "Actual output below:" + cat "$file" + exit 1 + fi + match_pattern=`echo "$found" | grep -e "$pattern"` + if test -z "$match_pattern"; then + echo "Expected pattern was not found in section \"$section\":" + echo " $pattern" + echo "" + echo "Actual output below:" + cat "$file" + exit 1 + fi +} + +# foo = 0x8004 +check "arm_target1_abs.stdout" ".text" "\<8000[[:space:]]\+\(04800000\|00008004\)\b" + +exit 0 diff --git a/gold/testsuite/arm_target1_rel.sh b/gold/testsuite/arm_target1_rel.sh new file mode 100755 index 0000000..54d0a7f --- /dev/null +++ b/gold/testsuite/arm_target1_rel.sh @@ -0,0 +1,54 @@ +#!/bin/sh + +# arm_target1_rel.sh -- test --target1-rel option. +# This test is based on ld/testsuite/ld-arm/arm-target1-rel.d. + +# Copyright (C) 2016 Free Software Foundation, Inc. +# Written by Igor Kudrin <ikudrin@accesssoftek.com>. + +# This file is part of gold. + +# 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 3 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., 51 Franklin Street - Fifth Floor, Boston, +# MA 02110-1301, USA. + +check() +{ + file=$1 + section=$2 + pattern=$3 + found=`fgrep "Contents of section $section:" -A1 $file | tail -n 1` + if test -z "$found"; then + echo "Section \"$section\" not found in file $file" + echo "" + echo "Actual output below:" + cat "$file" + exit 1 + fi + match_pattern=`echo "$found" | grep -e "$pattern"` + if test -z "$match_pattern"; then + echo "Expected pattern was not found in section \"$section\":" + echo " $pattern" + echo "" + echo "Actual output below:" + cat "$file" + exit 1 + fi +} + +# foo = 0x8004 +# foo - 0x8000 = 4 +check "arm_target1_rel.stdout" ".text" "\<8000[[:space:]]\+\(04000000\|00000004\)\b" + +exit 0 diff --git a/gold/testsuite/arm_target2.s b/gold/testsuite/arm_target2.s new file mode 100644 index 0000000..01fcefc --- /dev/null +++ b/gold/testsuite/arm_target2.s @@ -0,0 +1,10 @@ +# Test the R_ARM_TARGET2 relocation +# Copied from ld/testsuite/ld-arm/arm-target2.s + .text + .global _start +_start: + .word foo(target2) + .word foo+0x1234(target2) + .word foo+0xcdef0000(target2) + .word foo+0x76543210(target2) +foo: diff --git a/gold/testsuite/arm_target2_abs.sh b/gold/testsuite/arm_target2_abs.sh new file mode 100755 index 0000000..fca80b1 --- /dev/null +++ b/gold/testsuite/arm_target2_abs.sh @@ -0,0 +1,56 @@ +#!/bin/sh + +# arm_target2_abs.sh -- test --target2=abs option. +# This test is based on ld/testsuite/ld-arm/arm-target2-abs.d. + +# Copyright (C) 2016 Free Software Foundation, Inc. +# Written by Igor Kudrin <ikudrin@accesssoftek.com>. + +# This file is part of gold. + +# 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 3 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., 51 Franklin Street - Fifth Floor, Boston, +# MA 02110-1301, USA. + +check() +{ + file=$1 + section=$2 + pattern=$3 + found=`fgrep "Contents of section $section:" -A1 $file | tail -n 1` + if test -z "$found"; then + echo "Section \"$section\" not found in file $file" + echo "" + echo "Actual output below:" + cat "$file" + exit 1 + fi + match_pattern=`echo "$found" | grep -e "$pattern"` + if test -z "$match_pattern"; then + echo "Expected pattern was not found in section \"$section\":" + echo " $pattern" + echo "" + echo "Actual output below:" + cat "$file" + exit 1 + fi +} + +# foo = 0x8010 +# foo + 0x1234 = 0x9244 +# foo + 0xcdef0000 = 0xcdef8010 +# foo + 0x76543210 = 0x7654b220 +check "arm_target2_abs.stdout" ".text" "\<8000[[:space:]]\+\(10800000\|00008010\)[[:space:]]\+\(44920000\|00009244\)[[:space:]]\+\(1080efcd\|cdef8010\)[[:space:]]\+\(20b25476\|7654b220\)\b" + +exit 0 diff --git a/gold/testsuite/arm_target2_got_rel.sh b/gold/testsuite/arm_target2_got_rel.sh new file mode 100755 index 0000000..2b10316 --- /dev/null +++ b/gold/testsuite/arm_target2_got_rel.sh @@ -0,0 +1,60 @@ +#!/bin/sh + +# arm_target2_got_rel.sh -- test --target2=got-rel options. +# This test is based on ld/testsuite/ld-arm/arm-target2-got-rel.d. + +# Copyright (C) 2016 Free Software Foundation, Inc. +# Written by Igor Kudrin <ikudrin@accesssoftek.com>. + +# This file is part of gold. + +# 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 3 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., 51 Franklin Street - Fifth Floor, Boston, +# MA 02110-1301, USA. + +check() +{ + file=$1 + section=$2 + pattern=$3 + found=`fgrep "Contents of section $section:" -A1 $file | tail -n 1` + if test -z "$found"; then + echo "Section \"$section\" not found in file $file" + echo "" + echo "Actual output below:" + cat "$file" + exit 1 + fi + match_pattern=`echo "$found" | grep -e "$pattern"` + if test -z "$match_pattern"; then + echo "Expected pattern was not found in section \"$section\":" + echo " $pattern" + echo "" + echo "Actual output below:" + cat "$file" + exit 1 + fi +} + +# .got=0x9000 +# .got - 0x8000 = 0x1000 +# .got - 0x8004 + 0x1234 = 0x2230 +# .got - 0x8008 + 0xcdef0000 = 0xcdef0ff8 +# .got - 0x800c + 0x76543210 = 0x76544204 +check "arm_target2_got_rel.stdout" ".text" "\<8000[[:space:]]\+\(00100000\|00001000\)[[:space:]]\+\(30220000\|00002230\)[[:space:]]\+\(f80fefcd\|cdef0ff8\)[[:space:]]\+\(04425476\|76544204\)\b" + +# foo = 0x8010 +check "arm_target2_got_rel.stdout" ".got" "\<9000[[:space:]]\+\(10800000\|00008010\)\b" + +exit 0 diff --git a/gold/testsuite/arm_target2_rel.sh b/gold/testsuite/arm_target2_rel.sh new file mode 100755 index 0000000..c597260 --- /dev/null +++ b/gold/testsuite/arm_target2_rel.sh @@ -0,0 +1,57 @@ +#!/bin/sh + +# arm_target2_rel.sh -- test --target2=rel option. +# This test is based on ld/testsuite/ld-arm/arm-target2-rel.d. + +# Copyright (C) 2016 Free Software Foundation, Inc. +# Written by Igor Kudrin <ikudrin@accesssoftek.com>. + +# This file is part of gold. + +# 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 3 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., 51 Franklin Street - Fifth Floor, Boston, +# MA 02110-1301, USA. + +check() +{ + file=$1 + section=$2 + pattern=$3 + found=`fgrep "Contents of section $section:" -A1 $file | tail -n 1` + if test -z "$found"; then + echo "Section \"$section\" not found in file $file" + echo "" + echo "Actual output below:" + cat "$file" + exit 1 + fi + match_pattern=`echo "$found" | grep -e "$pattern"` + if test -z "$match_pattern"; then + echo "Expected pattern was not found in section \"$section\":" + echo " $pattern" + echo "" + echo "Actual output below:" + cat "$file" + exit 1 + fi +} + +# foo = 0x8010 +# foo - 0x8000 = 0x10 +# foo - 0x8004 + 0x1234 = 0x1240 +# foo - 0x8008 + 0xcdef0000 = 0xcdef0008 +# foo - 0x800c + 0x76543210 = 0x76543214 +check "arm_target2_rel.stdout" ".text" "\<8000[[:space:]]\+\(10000000\|00000010\)[[:space:]]\+\(40120000\|00001240\)[[:space:]]\+\(0800efcd\|cdef0008\)[[:space:]]\+\(14325476\|76543214\)\b" + +exit 0 |