diff options
author | Doug Kwan <dougkwan@google.com> | 2011-07-06 17:58:42 +0000 |
---|---|---|
committer | Doug Kwan <dougkwan@google.com> | 2011-07-06 17:58:42 +0000 |
commit | f6cccc2cd840baa795beb501a7afc4453000095e (patch) | |
tree | 29709b33db15ea8718ef9f63aea98fa909c0c919 /gold/testsuite | |
parent | 8f7ae686826051abd08d0e72a8bf66b39d3ff9ce (diff) | |
download | gdb-f6cccc2cd840baa795beb501a7afc4453000095e.zip gdb-f6cccc2cd840baa795beb501a7afc4453000095e.tar.gz gdb-f6cccc2cd840baa795beb501a7afc4453000095e.tar.bz2 |
2011-07-05 Doug Kwan <dougkwan@google.com>
PR gold/12771
* arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
Arm_Address type for relocation result.
(Arm_relocate_functions::abs16): Use unaligned access. Also fix
overflow check.
(Arm_relocate_functions::abs32): Use unaligned access.
(Arm_relocate_functions::rel32): Ditto.
(Arm_relocate_functions::prel31): Ditto.
(Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
* testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
static data relocations.
* testsuite/Makefile.in: Regnerate.
* testsuite/arm_unaligned_reloc.{s,sh}: New files.
Diffstat (limited to 'gold/testsuite')
-rw-r--r-- | gold/testsuite/Makefile.am | 14 | ||||
-rw-r--r-- | gold/testsuite/Makefile.in | 20 | ||||
-rw-r--r-- | gold/testsuite/arm_unaligned_reloc.s | 44 | ||||
-rwxr-xr-x | gold/testsuite/arm_unaligned_reloc.sh | 50 |
4 files changed, 125 insertions, 3 deletions
diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am index 2b90057..9792400 100644 --- a/gold/testsuite/Makefile.am +++ b/gold/testsuite/Makefile.am @@ -2343,6 +2343,20 @@ pr12826_1.o: pr12826_1.s pr12826_2.o: pr12826_2.s $(TEST_AS) -o $@ $< +check_SCRIPTS += arm_unaligned_reloc.sh +check_DATA += arm_unaligned_reloc.stdout + +arm_unaligned_reloc.stdout: arm_unaligned_reloc + $(TEST_OBJDUMP) -D $< > $@ + +arm_unaligned_reloc: arm_unaligned_reloc.o ../ld-new + ../ld-new -o $@ $< + +arm_unaligned_reloc.o: arm_unaligned_reloc.s + $(TEST_AS) -o $@ $< + +MOSTLYCLEANFILES += arm_unaligned_reloc + endif DEFAULT_TARGET_ARM endif NATIVE_OR_CROSS_LINKER diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in index 2dab4c3..5295c52 100644 --- a/gold/testsuite/Makefile.in +++ b/gold/testsuite/Makefile.in @@ -492,7 +492,8 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_attr_merge.sh \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_cortex_a8.sh \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_exidx_test.sh \ -@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ pr12826.sh +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ pr12826.sh \ +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_unaligned_reloc.sh @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_65 = 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 \ @@ -520,7 +521,8 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_cortex_a8_local.stdout \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_cortex_a8_local_reloc.stdout \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_exidx_test.stdout \ -@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ pr12826.stdout +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ pr12826.stdout \ +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_unaligned_reloc.stdout @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_66 = 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 \ @@ -546,7 +548,8 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_cortex_a8_bl \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_cortex_a8_blx \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_cortex_a8_local \ -@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_cortex_a8_local_reloc +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_cortex_a8_local_reloc \ +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_unaligned_reloc subdir = testsuite DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -3529,6 +3532,8 @@ arm_exidx_test.sh.log: arm_exidx_test.sh @p='arm_exidx_test.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) pr12826.sh.log: pr12826.sh @p='pr12826.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) +arm_unaligned_reloc.sh.log: arm_unaligned_reloc.sh + @p='arm_unaligned_reloc.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) object_unittest.log: object_unittest$(EXEEXT) @p='object_unittest$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) binary_unittest.log: binary_unittest$(EXEEXT) @@ -5121,6 +5126,15 @@ uninstall-am: @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@pr12826_2.o: pr12826_2.s @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_AS) -o $@ $< +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_unaligned_reloc.stdout: arm_unaligned_reloc +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_OBJDUMP) -D $< > $@ + +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_unaligned_reloc: arm_unaligned_reloc.o ../ld-new +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new -o $@ $< + +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_unaligned_reloc.o: arm_unaligned_reloc.s +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_AS) -o $@ $< + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/gold/testsuite/arm_unaligned_reloc.s b/gold/testsuite/arm_unaligned_reloc.s new file mode 100644 index 0000000..7677bff --- /dev/null +++ b/gold/testsuite/arm_unaligned_reloc.s @@ -0,0 +1,44 @@ + .syntax unified + + .global _start + .type _start, %function + .text +_start: + bx lr + .size _start,.-_start + + .section .data.0,"aw",%progbits + .align 12 + .type x, %object + .size x, 4 +x: + .word 1 + + .section .data.1,"aw",%progbits + .align 2 + +# This causes following relocations to be unaligned. + .global padding + .type padding, %object + .size padding, 1 +padding: + .byte 0 + + .global abs32 + .type abs32, %object + .size abs32, 4 +abs32: + .word x + + .global rel32 + .type rel32, %object + .size rel32, 4 +rel32: + .word x - . + + .global abs16 + .type abs16, %object + .size abs16, 2 +abs16: + .short x + .short 0 diff --git a/gold/testsuite/arm_unaligned_reloc.sh b/gold/testsuite/arm_unaligned_reloc.sh new file mode 100755 index 0000000..496ee28 --- /dev/null +++ b/gold/testsuite/arm_unaligned_reloc.sh @@ -0,0 +1,50 @@ +#!/bin/sh + +# arm_unaligned_reloc.sh -- test ARM unaligned static data relocations. + +# Copyright 2011 Free Software Foundation, Inc. +# Written by Doug Kwan <dougkwan@google.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. + +# This file goes with the assembler source file arm_unaligned_reloc.s, +# that is assembled and linked as a dummy executable. We want to check +# it is okay to do unaligned static data relocations. + +check() +{ + if ! grep -q -e "$2" "$1" + then + echo "Did not find pattern \"$2\" in $1:" + echo " $2" + echo "" + echo "Actual disassembly below:" + cat "$1" + exit 1 + fi +} + +check arm_unaligned_reloc.stdout "^00009000 <x>:$" +check arm_unaligned_reloc.stdout "^0000a001 <abs32>:$" +check arm_unaligned_reloc.stdout "^ a001: 00009000 .*$" +check arm_unaligned_reloc.stdout "^0000a005 <rel32>:" +check arm_unaligned_reloc.stdout "^ a005: ffffeffb .*$" +check arm_unaligned_reloc.stdout "^0000a009 <abs16>:" +check arm_unaligned_reloc.stdout "^ a009: 00009000 .*$" + +exit 0 |