aboutsummaryrefslogtreecommitdiff
path: root/gold/testsuite
diff options
context:
space:
mode:
authorDoug Kwan <dougkwan@google.com>2010-09-08 23:54:51 +0000
committerDoug Kwan <dougkwan@google.com>2010-09-08 23:54:51 +0000
commitaa98ff75dd6197c120e5c962048a71d9c9626e08 (patch)
tree2aad2bdf3900143fcfe75bd413a0d0462a9dd76d /gold/testsuite
parent5e1617b13f13c2de52e23a947ef85bcdb99a5b05 (diff)
downloadgdb-aa98ff75dd6197c120e5c962048a71d9c9626e08.zip
gdb-aa98ff75dd6197c120e5c962048a71d9c9626e08.tar.gz
gdb-aa98ff75dd6197c120e5c962048a71d9c9626e08.tar.bz2
2010-09-08 Doug Kwan <dougkwan@google.com>
* arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method. (Arm_relobj::do_relocate_sections): Add new parameter for output file to match the parent. (Target_arm::scan_reloc_section_for_stubs): Use would-be final values of local symbols instead of input values. Update code to track changes in gold::relocate_section. * object.cc (Sized_relobj::compute_final_local_value): New methods. (Sized_relobj::compute_final_local_value_internal): New methods. (Sized_relobj::do_finalize_local_symbols): Move code from loop body into private version of Sized_relobj::compute_final_local_value. Call the inline method. * object.h (Symbol_value::Symbol_value): Define destructor. Free merged symbol value if there is one. (Symbol_value::has_output_value): New method defintiion. (Sized_relobj::Compute_final_local_value_status): New enum type. (Sized_relobj::compute_final_local_value): New methods. (Sized_relobj::compute_final_local_value_internal): New methods. * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh and arm_cortex_a8.sh. (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl, arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc): New tests. * Makefile.in: Regenerate. * testsuite/arm_bl_out_of_range.s: Update test. * testsuite/thumb_bl_out_of_range.s: Ditto. * testsuite/thumb_blx_out_of_range.s: Ditto. * testsuite/arm_branch_out_of_range.sh: New file. * testsuite/arm_cortex_a8.sh: Ditto. * testsuite/arm_cortex_a8_b.s: Ditto. * testsuite/arm_cortex_a8_b_cond.s: Ditto. * testsuite/arm_cortex_a8_b_local.s: Ditto. * testsuite/arm_cortex_a8_bl.s: Ditto. * testsuite/arm_cortex_a8_blx.s: Ditto. * testsuite/arm_cortex_a8_local.s: Ditto. * testsuite/arm_cortex_a8_local_reloc.s: Ditto. * testsuite/thumb_bl_out_of_range_local.s: Ditto.
Diffstat (limited to 'gold/testsuite')
-rw-r--r--gold/testsuite/Makefile.am80
-rw-r--r--gold/testsuite/Makefile.in92
-rw-r--r--gold/testsuite/arm_bl_out_of_range.s3
-rwxr-xr-xgold/testsuite/arm_branch_out_of_range.sh123
-rwxr-xr-xgold/testsuite/arm_cortex_a8.sh65
-rw-r--r--gold/testsuite/arm_cortex_a8_b.s30
-rw-r--r--gold/testsuite/arm_cortex_a8_b_cond.s30
-rw-r--r--gold/testsuite/arm_cortex_a8_b_local.s52
-rw-r--r--gold/testsuite/arm_cortex_a8_bl.s30
-rw-r--r--gold/testsuite/arm_cortex_a8_blx.s33
-rw-r--r--gold/testsuite/arm_cortex_a8_local.s29
-rw-r--r--gold/testsuite/arm_cortex_a8_local_reloc.s31
-rw-r--r--gold/testsuite/thumb_bl_out_of_range.s6
-rw-r--r--gold/testsuite/thumb_bl_out_of_range_local.s61
-rw-r--r--gold/testsuite/thumb_blx_out_of_range.s5
15 files changed, 662 insertions, 8 deletions
diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am
index eab0557..c79c856 100644
--- a/gold/testsuite/Makefile.am
+++ b/gold/testsuite/Makefile.am
@@ -1885,12 +1885,13 @@ arm_abs_global.stdout: arm_abs_global
MOSTLYCLEANFILES += arm_abs_global
-check_SCRIPTS += arm_branch_in_range.sh
+check_SCRIPTS += arm_branch_in_range.sh arm_branch_out_of_range.sh
check_DATA += arm_bl_in_range.stdout arm_bl_out_of_range.stdout \
thumb_bl_in_range.stdout thumb_bl_out_of_range.stdout \
thumb2_bl_in_range.stdout thumb2_bl_out_of_range.stdout \
thumb_blx_in_range.stdout thumb_blx_out_of_range.stdout \
- thumb2_blx_in_range.stdout thumb2_blx_out_of_range.stdout
+ thumb2_blx_in_range.stdout thumb2_blx_out_of_range.stdout \
+ thumb_bl_out_of_range_local.stdout
arm_bl_in_range.stdout: arm_bl_in_range
$(TEST_OBJDUMP) -D $< > $@
@@ -1982,10 +1983,19 @@ thumb2_blx_out_of_range: thumb2_blx_out_of_range.o ../ld-new
thumb2_blx_out_of_range.o: thumb_blx_out_of_range.s
$(TEST_AS) -o $@ -march=armv7-a $<
+thumb_bl_out_of_range_local.stdout: thumb_bl_out_of_range_local
+ $(TEST_OBJDUMP) -D $< > $@
+
+thumb_bl_out_of_range_local: thumb_bl_out_of_range_local.o ../ld-new
+ ../ld-new -T $(srcdir)/thumb_branch_range.t -o $@ $<
+
+thumb_bl_out_of_range_local.o: thumb_bl_out_of_range_local.s
+ $(TEST_AS) -o $@ -march=armv5te $<
+
MOSTLYCLEANFILES += arm_bl_in_range arm_bl_out_of_range thumb_bl_in_range \
thumb_bl_out_of_range thumb2_bl_in_range thumb2_bl_out_of_range \
thumb_blx_in_range thumb_blx_out_of_range thumb2_blx_in_range \
- thumb2_blx_out_of_range
+ thumb2_blx_out_of_range thumb_bl_out_of_range_local
check_SCRIPTS += arm_fix_v4bx.sh
check_DATA += arm_fix_v4bx.stdout arm_fix_v4bx_interworking.stdout \
@@ -2050,4 +2060,68 @@ arm_attr_merge_7b.o: arm_attr_merge_7b.s
MOSTLYCLEANFILES += arm_attr_merge_6 arm_attr_merge_6r arm_attr_merge_7
+# Cortex-A8 workaround test.
+
+check_SCRIPTS += arm_cortex_a8.sh
+check_DATA += arm_cortex_a8_b_cond.stdout arm_cortex_a8_b.stdout \
+ arm_cortex_a8_bl.stdout arm_cortex_a8_blx.stdout \
+ arm_cortex_a8_local.stdout arm_cortex_a8_local_reloc.stdout
+
+arm_cortex_a8_b_cond.stdout: arm_cortex_a8_b_cond
+ $(TEST_OBJDUMP) -D -j.text $< > $@
+
+arm_cortex_a8_b_cond: arm_cortex_a8_b_cond.o ../ld-new
+ ../ld-new -o $@ $<
+
+arm_cortex_a8_b_cond.o: arm_cortex_a8_b_cond.s
+ $(TEST_AS) -o $@ $<
+
+arm_cortex_a8_b.stdout: arm_cortex_a8_b
+ $(TEST_OBJDUMP) -D -j.text $< > $@
+
+arm_cortex_a8_b: arm_cortex_a8_b.o ../ld-new
+ ../ld-new --fix-cortex-a8 -o $@ $<
+
+arm_cortex_a8_b.o: arm_cortex_a8_b.s
+ $(TEST_AS) -o $@ $<
+
+arm_cortex_a8_bl.stdout: arm_cortex_a8_bl
+ $(TEST_OBJDUMP) -D -j.text $< > $@
+
+arm_cortex_a8_bl: arm_cortex_a8_bl.o ../ld-new
+ ../ld-new -o $@ $<
+
+arm_cortex_a8_bl.o: arm_cortex_a8_bl.s
+ $(TEST_AS) -o $@ $<
+
+arm_cortex_a8_blx.stdout: arm_cortex_a8_blx
+ $(TEST_OBJDUMP) -D -j.text $< > $@
+
+arm_cortex_a8_blx: arm_cortex_a8_blx.o ../ld-new
+ ../ld-new -o $@ $<
+
+arm_cortex_a8_blx.o: arm_cortex_a8_blx.s
+ $(TEST_AS) -o $@ $<
+
+arm_cortex_a8_local.stdout: arm_cortex_a8_local
+ $(TEST_OBJDUMP) -D -j.text $< > $@
+
+arm_cortex_a8_local: arm_cortex_a8_local.o ../ld-new
+ ../ld-new -o $@ $<
+
+arm_cortex_a8_local.o: arm_cortex_a8_local.s
+ $(TEST_AS) -o $@ $<
+
+arm_cortex_a8_local_reloc.stdout: arm_cortex_a8_local_reloc
+ $(TEST_OBJDUMP) -D -j.text $< > $@
+
+arm_cortex_a8_local_reloc: arm_cortex_a8_local_reloc.o ../ld-new
+ ../ld-new -o $@ $<
+
+arm_cortex_a8_local_reloc.o: arm_cortex_a8_local_reloc.s
+ $(TEST_AS) -o $@ $<
+
+MOSTLYCLEANFILES += arm_cortex_a8_b_cond arm_cortex_a8_b arm_cortex_a8_bl \
+ arm_cortex_a8_blx arm_cortex_a8_local arm_cortex_a8_local_reloc
+
endif DEFAULT_TARGET_ARM
diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in
index e40caa6..cc591ef 100644
--- a/gold/testsuite/Makefile.in
+++ b/gold/testsuite/Makefile.in
@@ -492,9 +492,13 @@ check_PROGRAMS = object_unittest$(EXEEXT) binary_unittest$(EXEEXT) \
@DEFAULT_TARGET_X86_64_TRUE@am__append_39 = split_x86_64_1 split_x86_64_2 split_x86_64_3 \
@DEFAULT_TARGET_X86_64_TRUE@ split_x86_64_4 split_x86_64_r
+
+# Cortex-A8 workaround test.
@DEFAULT_TARGET_ARM_TRUE@am__append_40 = arm_abs_global.sh \
@DEFAULT_TARGET_ARM_TRUE@ arm_branch_in_range.sh \
-@DEFAULT_TARGET_ARM_TRUE@ arm_fix_v4bx.sh arm_attr_merge.sh
+@DEFAULT_TARGET_ARM_TRUE@ arm_branch_out_of_range.sh \
+@DEFAULT_TARGET_ARM_TRUE@ arm_fix_v4bx.sh arm_attr_merge.sh \
+@DEFAULT_TARGET_ARM_TRUE@ arm_cortex_a8.sh
@DEFAULT_TARGET_ARM_TRUE@am__append_41 = arm_abs_global.stdout \
@DEFAULT_TARGET_ARM_TRUE@ arm_bl_in_range.stdout \
@DEFAULT_TARGET_ARM_TRUE@ arm_bl_out_of_range.stdout \
@@ -506,12 +510,19 @@ check_PROGRAMS = object_unittest$(EXEEXT) binary_unittest$(EXEEXT) \
@DEFAULT_TARGET_ARM_TRUE@ thumb_blx_out_of_range.stdout \
@DEFAULT_TARGET_ARM_TRUE@ thumb2_blx_in_range.stdout \
@DEFAULT_TARGET_ARM_TRUE@ thumb2_blx_out_of_range.stdout \
+@DEFAULT_TARGET_ARM_TRUE@ thumb_bl_out_of_range_local.stdout \
@DEFAULT_TARGET_ARM_TRUE@ arm_fix_v4bx.stdout \
@DEFAULT_TARGET_ARM_TRUE@ arm_fix_v4bx_interworking.stdout \
@DEFAULT_TARGET_ARM_TRUE@ arm_no_fix_v4bx.stdout \
@DEFAULT_TARGET_ARM_TRUE@ arm_attr_merge_6.stdout \
@DEFAULT_TARGET_ARM_TRUE@ arm_attr_merge_6r.stdout \
-@DEFAULT_TARGET_ARM_TRUE@ arm_attr_merge_7.stdout
+@DEFAULT_TARGET_ARM_TRUE@ arm_attr_merge_7.stdout \
+@DEFAULT_TARGET_ARM_TRUE@ arm_cortex_a8_b_cond.stdout \
+@DEFAULT_TARGET_ARM_TRUE@ arm_cortex_a8_b.stdout \
+@DEFAULT_TARGET_ARM_TRUE@ arm_cortex_a8_bl.stdout \
+@DEFAULT_TARGET_ARM_TRUE@ arm_cortex_a8_blx.stdout \
+@DEFAULT_TARGET_ARM_TRUE@ arm_cortex_a8_local.stdout \
+@DEFAULT_TARGET_ARM_TRUE@ arm_cortex_a8_local_reloc.stdout
@DEFAULT_TARGET_ARM_TRUE@am__append_42 = arm_abs_global \
@DEFAULT_TARGET_ARM_TRUE@ arm_bl_in_range arm_bl_out_of_range \
@DEFAULT_TARGET_ARM_TRUE@ thumb_bl_in_range \
@@ -521,10 +532,16 @@ check_PROGRAMS = object_unittest$(EXEEXT) binary_unittest$(EXEEXT) \
@DEFAULT_TARGET_ARM_TRUE@ thumb_blx_in_range \
@DEFAULT_TARGET_ARM_TRUE@ thumb_blx_out_of_range \
@DEFAULT_TARGET_ARM_TRUE@ thumb2_blx_in_range \
-@DEFAULT_TARGET_ARM_TRUE@ thumb2_blx_out_of_range arm_fix_v4bx \
+@DEFAULT_TARGET_ARM_TRUE@ thumb2_blx_out_of_range \
+@DEFAULT_TARGET_ARM_TRUE@ thumb_bl_out_of_range_local \
+@DEFAULT_TARGET_ARM_TRUE@ arm_fix_v4bx \
@DEFAULT_TARGET_ARM_TRUE@ arm_fix_v4bx_interworking \
@DEFAULT_TARGET_ARM_TRUE@ arm_no_fix_v4bx arm_attr_merge_6 \
-@DEFAULT_TARGET_ARM_TRUE@ arm_attr_merge_6r arm_attr_merge_7
+@DEFAULT_TARGET_ARM_TRUE@ arm_attr_merge_6r arm_attr_merge_7 \
+@DEFAULT_TARGET_ARM_TRUE@ arm_cortex_a8_b_cond arm_cortex_a8_b \
+@DEFAULT_TARGET_ARM_TRUE@ arm_cortex_a8_bl arm_cortex_a8_blx \
+@DEFAULT_TARGET_ARM_TRUE@ arm_cortex_a8_local \
+@DEFAULT_TARGET_ARM_TRUE@ arm_cortex_a8_local_reloc
subdir = testsuite
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -3297,10 +3314,14 @@ arm_abs_global.sh.log: arm_abs_global.sh
@p='arm_abs_global.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
arm_branch_in_range.sh.log: arm_branch_in_range.sh
@p='arm_branch_in_range.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
+arm_branch_out_of_range.sh.log: arm_branch_out_of_range.sh
+ @p='arm_branch_out_of_range.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
arm_fix_v4bx.sh.log: arm_fix_v4bx.sh
@p='arm_fix_v4bx.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
arm_attr_merge.sh.log: arm_attr_merge.sh
@p='arm_attr_merge.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
+arm_cortex_a8.sh.log: arm_cortex_a8.sh
+ @p='arm_cortex_a8.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)
@@ -4641,6 +4662,15 @@ uninstall-am:
@DEFAULT_TARGET_ARM_TRUE@thumb2_blx_out_of_range.o: thumb_blx_out_of_range.s
@DEFAULT_TARGET_ARM_TRUE@ $(TEST_AS) -o $@ -march=armv7-a $<
+@DEFAULT_TARGET_ARM_TRUE@thumb_bl_out_of_range_local.stdout: thumb_bl_out_of_range_local
+@DEFAULT_TARGET_ARM_TRUE@ $(TEST_OBJDUMP) -D $< > $@
+
+@DEFAULT_TARGET_ARM_TRUE@thumb_bl_out_of_range_local: thumb_bl_out_of_range_local.o ../ld-new
+@DEFAULT_TARGET_ARM_TRUE@ ../ld-new -T $(srcdir)/thumb_branch_range.t -o $@ $<
+
+@DEFAULT_TARGET_ARM_TRUE@thumb_bl_out_of_range_local.o: thumb_bl_out_of_range_local.s
+@DEFAULT_TARGET_ARM_TRUE@ $(TEST_AS) -o $@ -march=armv5te $<
+
@DEFAULT_TARGET_ARM_TRUE@arm_fix_v4bx.stdout: arm_fix_v4bx
@DEFAULT_TARGET_ARM_TRUE@ $(TEST_OBJDUMP) -D -j.text $< > $@
@@ -4692,6 +4722,60 @@ uninstall-am:
@DEFAULT_TARGET_ARM_TRUE@arm_attr_merge_7b.o: arm_attr_merge_7b.s
@DEFAULT_TARGET_ARM_TRUE@ $(TEST_AS) -o $@ $<
+@DEFAULT_TARGET_ARM_TRUE@arm_cortex_a8_b_cond.stdout: arm_cortex_a8_b_cond
+@DEFAULT_TARGET_ARM_TRUE@ $(TEST_OBJDUMP) -D -j.text $< > $@
+
+@DEFAULT_TARGET_ARM_TRUE@arm_cortex_a8_b_cond: arm_cortex_a8_b_cond.o ../ld-new
+@DEFAULT_TARGET_ARM_TRUE@ ../ld-new -o $@ $<
+
+@DEFAULT_TARGET_ARM_TRUE@arm_cortex_a8_b_cond.o: arm_cortex_a8_b_cond.s
+@DEFAULT_TARGET_ARM_TRUE@ $(TEST_AS) -o $@ $<
+
+@DEFAULT_TARGET_ARM_TRUE@arm_cortex_a8_b.stdout: arm_cortex_a8_b
+@DEFAULT_TARGET_ARM_TRUE@ $(TEST_OBJDUMP) -D -j.text $< > $@
+
+@DEFAULT_TARGET_ARM_TRUE@arm_cortex_a8_b: arm_cortex_a8_b.o ../ld-new
+@DEFAULT_TARGET_ARM_TRUE@ ../ld-new --fix-cortex-a8 -o $@ $<
+
+@DEFAULT_TARGET_ARM_TRUE@arm_cortex_a8_b.o: arm_cortex_a8_b.s
+@DEFAULT_TARGET_ARM_TRUE@ $(TEST_AS) -o $@ $<
+
+@DEFAULT_TARGET_ARM_TRUE@arm_cortex_a8_bl.stdout: arm_cortex_a8_bl
+@DEFAULT_TARGET_ARM_TRUE@ $(TEST_OBJDUMP) -D -j.text $< > $@
+
+@DEFAULT_TARGET_ARM_TRUE@arm_cortex_a8_bl: arm_cortex_a8_bl.o ../ld-new
+@DEFAULT_TARGET_ARM_TRUE@ ../ld-new -o $@ $<
+
+@DEFAULT_TARGET_ARM_TRUE@arm_cortex_a8_bl.o: arm_cortex_a8_bl.s
+@DEFAULT_TARGET_ARM_TRUE@ $(TEST_AS) -o $@ $<
+
+@DEFAULT_TARGET_ARM_TRUE@arm_cortex_a8_blx.stdout: arm_cortex_a8_blx
+@DEFAULT_TARGET_ARM_TRUE@ $(TEST_OBJDUMP) -D -j.text $< > $@
+
+@DEFAULT_TARGET_ARM_TRUE@arm_cortex_a8_blx: arm_cortex_a8_blx.o ../ld-new
+@DEFAULT_TARGET_ARM_TRUE@ ../ld-new -o $@ $<
+
+@DEFAULT_TARGET_ARM_TRUE@arm_cortex_a8_blx.o: arm_cortex_a8_blx.s
+@DEFAULT_TARGET_ARM_TRUE@ $(TEST_AS) -o $@ $<
+
+@DEFAULT_TARGET_ARM_TRUE@arm_cortex_a8_local.stdout: arm_cortex_a8_local
+@DEFAULT_TARGET_ARM_TRUE@ $(TEST_OBJDUMP) -D -j.text $< > $@
+
+@DEFAULT_TARGET_ARM_TRUE@arm_cortex_a8_local: arm_cortex_a8_local.o ../ld-new
+@DEFAULT_TARGET_ARM_TRUE@ ../ld-new -o $@ $<
+
+@DEFAULT_TARGET_ARM_TRUE@arm_cortex_a8_local.o: arm_cortex_a8_local.s
+@DEFAULT_TARGET_ARM_TRUE@ $(TEST_AS) -o $@ $<
+
+@DEFAULT_TARGET_ARM_TRUE@arm_cortex_a8_local_reloc.stdout: arm_cortex_a8_local_reloc
+@DEFAULT_TARGET_ARM_TRUE@ $(TEST_OBJDUMP) -D -j.text $< > $@
+
+@DEFAULT_TARGET_ARM_TRUE@arm_cortex_a8_local_reloc: arm_cortex_a8_local_reloc.o ../ld-new
+@DEFAULT_TARGET_ARM_TRUE@ ../ld-new -o $@ $<
+
+@DEFAULT_TARGET_ARM_TRUE@arm_cortex_a8_local_reloc.o: arm_cortex_a8_local_reloc.s
+@DEFAULT_TARGET_ARM_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_bl_out_of_range.s b/gold/testsuite/arm_bl_out_of_range.s
index 786d9aa..cb5ff53 100644
--- a/gold/testsuite/arm_bl_out_of_range.s
+++ b/gold/testsuite/arm_bl_out_of_range.s
@@ -15,7 +15,8 @@ _backward_target:
.size _backward_target, .-_backward_target
.text
- .align 2
+# Use 256-byte alignment so that we know where the stubs start.
+ .align 8
# Define _start so that linker does not complain.
.global _start
diff --git a/gold/testsuite/arm_branch_out_of_range.sh b/gold/testsuite/arm_branch_out_of_range.sh
new file mode 100755
index 0000000..b59b442
--- /dev/null
+++ b/gold/testsuite/arm_branch_out_of_range.sh
@@ -0,0 +1,123 @@
+#!/bin/sh
+
+# arm_branch_out_of_range.sh -- test ARM/THUMB/THUMB branch instructions whose
+# targets are just out of the branch range limits.
+
+# Copyright 2010 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 files arm_bl_out_of_range.s,
+# thumb_bl_out_of_range.s and thumb_bl_out_of_range_local.s that are assembled
+# and linked to check that branches whose target are just out of the branch
+# range limits are handle correctly.
+
+check()
+{
+ file=$1
+ pattern=$2
+
+ found=`grep "$pattern" $file`
+ if test -z "$found"; then
+ echo "pattern \"$pattern\" not found in file $file."
+ exit 1
+ fi
+}
+
+# This is a bit crude. Also, there are tabs in the grep patterns.
+
+check arm_bl_out_of_range.stdout \
+ " 4000004: eb00003d bl 4000100 <.*>"
+check arm_bl_out_of_range.stdout \
+ " 4000008: eb00003e bl 4000108 <.*>"
+check arm_bl_out_of_range.stdout \
+ " 4000100: e51ff004 ldr pc, \[pc, #-4\]"
+check arm_bl_out_of_range.stdout \
+ " 4000104: 02000008 "
+check arm_bl_out_of_range.stdout \
+ " 4000108: e51ff004 ldr pc, \[pc, #-4\]"
+check arm_bl_out_of_range.stdout \
+ " 400010c: 06000010 "
+
+check thumb_bl_out_of_range.stdout \
+ " 800004: f000 e87c blx 800100 <.*>"
+check thumb_bl_out_of_range.stdout \
+ " 800008: f000 e87e blx 800108 <.*>"
+check thumb_bl_out_of_range.stdout \
+ " 800100: e51ff004 ldr pc, \[pc, #-4\]"
+check thumb_bl_out_of_range.stdout \
+ " 800104: 00400007 "
+check thumb_bl_out_of_range.stdout \
+ " 800108: e51ff004 ldr pc, \[pc, #-4\]"
+check thumb_bl_out_of_range.stdout \
+ " 80010c: 00c0000d "
+
+check thumb_blx_out_of_range.stdout \
+ " 800004: f000 e87c blx 800100 <.*>"
+check thumb_blx_out_of_range.stdout \
+ " 80000a: f000 e87e blx 800108 <.*>"
+check thumb_blx_out_of_range.stdout \
+ " 800100: e51ff004 ldr pc, \[pc, #-4\]"
+check thumb_blx_out_of_range.stdout \
+ " 800104: 00400006 "
+check thumb_blx_out_of_range.stdout \
+ " 800108: e51ff004 ldr pc, \[pc, #-4\]"
+check thumb_blx_out_of_range.stdout \
+ " 80010c: 00c0000c "
+
+check thumb_bl_out_of_range_local.stdout \
+ " 800004: f000 e87c blx 800100 <.*>"
+check thumb_bl_out_of_range_local.stdout \
+ " 800008: f000 e87e blx 800108 <.*>"
+check thumb_bl_out_of_range_local.stdout \
+ " 800100: e51ff004 ldr pc, \[pc, #-4\]"
+check thumb_bl_out_of_range_local.stdout \
+ " 800104: 00400007 "
+check thumb_bl_out_of_range_local.stdout \
+ " 800108: e51ff004 ldr pc, \[pc, #-4\]"
+check thumb_bl_out_of_range_local.stdout \
+ " 80010c: 00c0000d "
+
+check thumb2_bl_out_of_range.stdout \
+ " 2000004: f000 e87c blx 2000100 <.*>"
+check thumb2_bl_out_of_range.stdout \
+ " 2000008: f000 e87e blx 2000108 <.*>"
+check thumb2_bl_out_of_range.stdout \
+ " 2000100: e51ff004 ldr pc, \[pc, #-4\]"
+check thumb2_bl_out_of_range.stdout \
+ " 2000104: 01000007 "
+check thumb2_bl_out_of_range.stdout \
+ " 2000108: e51ff004 ldr pc, \[pc, #-4\]"
+check thumb2_bl_out_of_range.stdout \
+ " 200010c: 0300000d "
+
+check thumb2_blx_out_of_range.stdout \
+ " 2000004: f000 e87c blx 2000100 <.*>"
+check thumb2_blx_out_of_range.stdout \
+ " 200000a: f000 e87e blx 2000108 <.*>"
+check thumb2_blx_out_of_range.stdout \
+ " 2000100: e51ff004 ldr pc, \[pc, #-4\]"
+check thumb2_blx_out_of_range.stdout \
+ " 2000104: 01000006 "
+check thumb2_blx_out_of_range.stdout \
+ " 2000108: e51ff004 ldr pc, \[pc, #-4\]"
+check thumb2_blx_out_of_range.stdout \
+ " 200010c: 0300000c "
+
+exit 0
diff --git a/gold/testsuite/arm_cortex_a8.sh b/gold/testsuite/arm_cortex_a8.sh
new file mode 100755
index 0000000..5e25c25
--- /dev/null
+++ b/gold/testsuite/arm_cortex_a8.sh
@@ -0,0 +1,65 @@
+#!/bin/sh
+
+# arm_cortex_a8.sh -- a test case for the Cortex-A8 workaround.
+
+# Copyright 2010 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 arm_v4bx.s, an ARM assembly source file constructed to
+# have test the handling of R_ARM_V4BX relocation.
+
+check()
+{
+ if ! grep -q "$2" "$1"
+ then
+ echo "Did not find expected instruction in $1:"
+ echo " $2"
+ echo ""
+ echo "Actual instructions below:"
+ cat "$1"
+ exit 1
+ fi
+}
+
+# Test branch.
+check arm_cortex_a8_b.stdout ".*ffe: .* b.w .*000 <.*>"
+check arm_cortex_a8_b.stdout ".000: .* b.w .*100 <_func>"
+
+# Test conditional branch.
+check arm_cortex_a8_b_cond.stdout ".*ffe: .* b.w .*000 <.*>"
+check arm_cortex_a8_b_cond.stdout ".000: .* beq.n .*006 <.*>"
+check arm_cortex_a8_b_cond.stdout ".002: .* b.w .*002 <.*>"
+check arm_cortex_a8_b_cond.stdout ".006: .* b.w .*100 <_func>"
+
+# Test branch and link.
+check arm_cortex_a8_bl.stdout ".*ffe: .* bl .*000 <.*>"
+check arm_cortex_a8_bl.stdout ".000: .* b.w .*100 <_func>"
+
+# Test blx
+check arm_cortex_a8_blx.stdout ".*ffe: .* blx .*000 <.*>"
+check arm_cortex_a8_blx.stdout ".000: .* b .*100 <_func>"
+
+# Test a local branch without relocation.
+check arm_cortex_a8_local.stdout ".*ffe: .* b.w .*000 <.*>"
+check arm_cortex_a8_local.stdout ".000: .* bpl.n .*006 <.*>"
+check arm_cortex_a8_local.stdout ".002: .* b.w .*002 <.*>"
+check arm_cortex_a8_local.stdout ".006: .* b.w .*100 <.*>"
+
+exit 0
diff --git a/gold/testsuite/arm_cortex_a8_b.s b/gold/testsuite/arm_cortex_a8_b.s
new file mode 100644
index 0000000..d2316a0
--- /dev/null
+++ b/gold/testsuite/arm_cortex_a8_b.s
@@ -0,0 +1,30 @@
+ .syntax unified
+ .cpu cortex-a8
+
+ .text
+ .align 12
+
+_start:
+ .type _start,%function
+ bx lr
+ .size _start,.-_start
+
+ .align 8
+ .thumb
+ .global _func
+ .type _func,%function
+_func:
+ bx lr
+ .size _func,.-_func
+
+ .align 11
+ .space 2042
+
+ .align 1
+ .thumb
+ .global _test
+ .type _test,%function
+_test:
+ add.w r0, r0, 0
+ b.w _func
+ .size _test,.-_test
diff --git a/gold/testsuite/arm_cortex_a8_b_cond.s b/gold/testsuite/arm_cortex_a8_b_cond.s
new file mode 100644
index 0000000..a244aa7
--- /dev/null
+++ b/gold/testsuite/arm_cortex_a8_b_cond.s
@@ -0,0 +1,30 @@
+ .syntax unified
+ .cpu cortex-a8
+
+ .text
+ .align 12
+
+_start:
+ .type _start,%function
+ bx lr
+ .size _start,.-_start
+
+ .align 8
+ .thumb
+ .global _func
+ .type _func,%function
+_func:
+ bx lr
+ .size _func,.-_func
+
+ .align 11
+ .space 2042
+
+ .align 1
+ .thumb
+ .global _test
+ .type _test,%function
+_test:
+ add.w r0, r0, 0
+ beq.w _func
+ .size _test,.-_test
diff --git a/gold/testsuite/arm_cortex_a8_b_local.s b/gold/testsuite/arm_cortex_a8_b_local.s
new file mode 100644
index 0000000..2432d91
--- /dev/null
+++ b/gold/testsuite/arm_cortex_a8_b_local.s
@@ -0,0 +1,52 @@
+ .syntax unified
+ .cpu cortex-a8
+
+ .section .text.0, "x"
+ .align 12
+
+_start:
+ .type _start,%function
+ bx lr
+ .size _start,.-_start
+
+ .section .text.1, "x"
+ .align 11
+ .thumb
+ .type .Lfunc1,%function
+.Lfunc1:
+ bx lr
+ .size .Lfunc1,.-.Lfunc1
+
+ .section .text.2, "x"
+ .align 11
+ .space 2042
+
+ .align 1
+ .thumb
+ .global _test1
+ .type _test1,%function
+_test1:
+ add.w r0, r0, 0
+ b.w .Lfunc1
+ .size _test1,.-_test1
+
+ .align 8
+ .thumb
+ .type .Lfunc2,%function
+.Lfunc2:
+ bx lr
+ .size .Lfunc2,.-.Lfunc1
+
+ .align 11
+ .space 2042
+
+ .align 1
+ .thumb
+ .global _test2
+ .type _test2,%function
+_test2:
+ add.w r0, r0, 0
+ b.w .Lfunc2
+ .size _test2,.-_test2
+
+
diff --git a/gold/testsuite/arm_cortex_a8_bl.s b/gold/testsuite/arm_cortex_a8_bl.s
new file mode 100644
index 0000000..c78fa8d
--- /dev/null
+++ b/gold/testsuite/arm_cortex_a8_bl.s
@@ -0,0 +1,30 @@
+ .syntax unified
+ .cpu cortex-a8
+
+ .text
+ .align 12
+
+_start:
+ .type _start,%function
+ bx lr
+ .size _start,.-_start
+
+ .align 8
+ .thumb
+ .global _func
+ .type _func,%function
+_func:
+ bx lr
+ .size _func,.-_func
+
+ .align 11
+ .space 2042
+
+ .align 1
+ .thumb
+ .global _test
+ .type _test,%function
+_test:
+ add.w r0, r0, 0
+ bl _func
+ .size _test,.-_test
diff --git a/gold/testsuite/arm_cortex_a8_blx.s b/gold/testsuite/arm_cortex_a8_blx.s
new file mode 100644
index 0000000..c323d25
--- /dev/null
+++ b/gold/testsuite/arm_cortex_a8_blx.s
@@ -0,0 +1,33 @@
+ .syntax unified
+ .cpu cortex-a8
+
+ .text
+ .align 12
+
+_start:
+ .type _start,%function
+ bx lr
+ .size _start,.-_start
+
+ .align 8
+ .global _func
+ .type _func,%function
+_func:
+ bx lr
+ .size _func,.-_func
+
+ .align 11
+ .space 2042
+
+ .align 1
+ .thumb
+ .global _test
+ .type _test,%function
+_test:
+ add.w r0, r0, 0
+ blx _func
+ .size _test,.-_test
+
+# We have no mapping symbols for stubs. This make the disassembler
+# list the stub correctly in ARM mode.
+ .arm
diff --git a/gold/testsuite/arm_cortex_a8_local.s b/gold/testsuite/arm_cortex_a8_local.s
new file mode 100644
index 0000000..462aa18
--- /dev/null
+++ b/gold/testsuite/arm_cortex_a8_local.s
@@ -0,0 +1,29 @@
+ .syntax unified
+ .cpu cortex-a8
+
+ .text
+ .align 12
+
+_start:
+ .type _start,%function
+ bx lr
+ .size _start,.-_start
+
+ .align 8
+ .thumb
+ .type .Lfunc,%function
+.Lfunc:
+ bx lr
+ .size .Lfunc,.-.Lfunc
+
+ .align 11
+ .space 2042
+
+ .align 1
+ .thumb
+ .global _test
+ .type _test,%function
+_test:
+ add.w r0, r0, 0
+ bpl.w .Lfunc
+ .size _test,.-_test
diff --git a/gold/testsuite/arm_cortex_a8_local_reloc.s b/gold/testsuite/arm_cortex_a8_local_reloc.s
new file mode 100644
index 0000000..2b49184
--- /dev/null
+++ b/gold/testsuite/arm_cortex_a8_local_reloc.s
@@ -0,0 +1,31 @@
+ .syntax unified
+ .cpu cortex-a8
+
+ .section .text.0, "x"
+ .align 12
+
+_start:
+ .type _start,%function
+ bx lr
+ .size _start,.-_start
+
+ .section .text.1, "x"
+ .align 11
+ .thumb
+ .type .Lfunc,%function
+.Lfunc:
+ bx lr
+ .size .Lfunc,.-.Lfunc
+
+ .section .text.2, "x"
+ .align 11
+ .space 2042
+
+ .align 1
+ .thumb
+ .global _test
+ .type _test,%function
+_test:
+ add.w r0, r0, 0
+ b.w .Lfunc
+ .size _test,.-_test
diff --git a/gold/testsuite/thumb_bl_out_of_range.s b/gold/testsuite/thumb_bl_out_of_range.s
index 6629d74..d0906d9 100644
--- a/gold/testsuite/thumb_bl_out_of_range.s
+++ b/gold/testsuite/thumb_bl_out_of_range.s
@@ -16,6 +16,8 @@ _backward_target:
.size _backward_target, .-_backward_target
.text
+# Use 256-byte alignment so that we know where the stubs start.
+ .align 8
# Define _start so that linker does not complain.
.global _start
@@ -42,6 +44,10 @@ _forward_test:
bl _forward_target
.size _forward_test, .-_forward_test
+# switch back to ARM mode so that stubs are disassembled correctly.
+ .code 32
+ nop
+
.section .text.post,"x"
# Add padding so that target is just out of branch range.
diff --git a/gold/testsuite/thumb_bl_out_of_range_local.s b/gold/testsuite/thumb_bl_out_of_range_local.s
new file mode 100644
index 0000000..48de1e1
--- /dev/null
+++ b/gold/testsuite/thumb_bl_out_of_range_local.s
@@ -0,0 +1,61 @@
+# thumb_bl_out_of_range_local.s
+# Test THUMB/THUMB-2 bl instructions just out of the branch range limits
+# and with local branch targets.
+ .syntax unified
+
+ .section .text.pre,"x"
+
+# Add padding so that target is just output of branch range.
+ .space 6
+
+ .code 16
+ .thumb_func
+ .type .Lbackward_target, %function
+.Lbackward_target:
+ bx lr
+ .size .Lbackward_target, .-.Lbackward_target
+
+ .text
+# Use 256-byte alignment so that we know where the stubs start.
+ .align 8
+
+# Define _start so that linker does not complain.
+ .global _start
+ .code 32
+ .align 2
+ .type _start, %function
+_start:
+ bx lr
+ .size _start, .-_start
+
+ .global _backward_test
+ .code 16
+ .thumb_func
+ .type _backward_test, %function
+_backward_test:
+ bl .Lbackward_target
+ .size _backward_test, .-_backward_test
+
+ .global _forward_test
+ .code 16
+ .thumb_func
+ .type _forward_test, %function
+_forward_test:
+ bl .Lforward_target
+ .size _forward_test, .-_forward_test
+
+# Switch back to ARM mode so that we can see stubs
+ .code 32
+ nop
+
+ .section .text.post,"x"
+
+# Add padding so that target is just out of branch range.
+ .space 12
+
+ .code 16
+ .thumb_func
+ .type .Lforward_target, %function
+.Lforward_target:
+ bx lr
+ .size .Lforward_target, .-.Lforward_target
diff --git a/gold/testsuite/thumb_blx_out_of_range.s b/gold/testsuite/thumb_blx_out_of_range.s
index fc5beb5..5689e27 100644
--- a/gold/testsuite/thumb_blx_out_of_range.s
+++ b/gold/testsuite/thumb_blx_out_of_range.s
@@ -15,6 +15,8 @@ _backward_target:
.size _backward_target, .-_backward_target
.text
+# Use 256-byte alignment so that we know where the stubs start.
+ .align 8
# Define _start so that linker does not complain.
.align 2
@@ -46,7 +48,10 @@ _forward_test:
nop.n
bl _forward_target
.size _forward_test, .-_forward_test
+
+# switch back to ARM mode so that stubs are disassembled correctly.
.code 32
+ nop
.section .text.post,"x"