From a8e2273bba9b658132165d70edb8b47023193e82 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Thu, 3 Nov 2011 03:38:34 +0000 Subject: [PATCH] * arm.cc (Target_arm::may_use_v5t_interworking): Check whether we are working around the ARM1176 Erratum. * options.h (General_options::fix_arm1176): Add option. * testsuite/Makefile.am: Add testcases, and keep current ones working. * testsuite/Makefile.in: Regenerate. * testsuite/arm_fix_1176.s: New file. * testsuite/arm_fix_1176.sh: Likewise. --- gold/ChangeLog | 11 ++++ gold/arm.cc | 13 +++-- gold/options.h | 4 ++ gold/testsuite/Makefile.am | 87 ++++++++++++++++++++++++++----- gold/testsuite/Makefile.in | 95 +++++++++++++++++++++++++++++----- gold/testsuite/arm_fix_1176.s | 15 ++++++ gold/testsuite/arm_fix_1176.sh | 61 ++++++++++++++++++++++ 7 files changed, 259 insertions(+), 27 deletions(-) create mode 100644 gold/testsuite/arm_fix_1176.s create mode 100755 gold/testsuite/arm_fix_1176.sh diff --git a/gold/ChangeLog b/gold/ChangeLog index f75da8e074..eb87996d1f 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,14 @@ +2011-11-02 Matthew Gretton-Dann + + * arm.cc (Target_arm::may_use_v5t_interworking): Check whether + we are working around the ARM1176 Erratum. + * options.h (General_options::fix_arm1176): Add option. + * testsuite/Makefile.am: Add testcases, and keep current ones + working. + * testsuite/Makefile.in: Regenerate. + * testsuite/arm_fix_1176.s: New file. + * testsuite/arm_fix_1176.sh: Likewise. + 2011-11-02 Matthew Gretton-Dann * arm.cc (Target_arm::Target_arm): Remove initialisation of diff --git a/gold/arm.cc b/gold/arm.cc index c0a20491f3..200c371310 100644 --- a/gold/arm.cc +++ b/gold/arm.cc @@ -2262,9 +2262,16 @@ class Target_arm : public Sized_target<32, big_endian> Object_attribute* attr = this->get_aeabi_object_attribute(elfcpp::Tag_CPU_arch); int arch = attr->int_value(); - return (arch != elfcpp::TAG_CPU_ARCH_PRE_V4 - && arch != elfcpp::TAG_CPU_ARCH_V4 - && arch != elfcpp::TAG_CPU_ARCH_V4T); + if (parameters->options().fix_arm1176()) + return (arch == elfcpp::TAG_CPU_ARCH_V6T2 + || arch == elfcpp::TAG_CPU_ARCH_V7 + || arch == elfcpp::TAG_CPU_ARCH_V6_M + || arch == elfcpp::TAG_CPU_ARCH_V6S_M + || arch == elfcpp::TAG_CPU_ARCH_V7E_M); + else + return (arch != elfcpp::TAG_CPU_ARCH_PRE_V4 + && arch != elfcpp::TAG_CPU_ARCH_V4 + && arch != elfcpp::TAG_CPU_ARCH_V4T); } // Process the relocations to determine unreferenced sections for diff --git a/gold/options.h b/gold/options.h index 99094830a5..8876a1eedd 100644 --- a/gold/options.h +++ b/gold/options.h @@ -771,6 +771,10 @@ class General_options N_("(ARM only) Fix binaries for Cortex-A8 erratum."), N_("(ARM only) Do not fix binaries for Cortex-A8 erratum.")); + DEFINE_bool(fix_arm1176, options::TWO_DASHES, '\0', true, + N_("(ARM only) Fix binaries for ARM1176 erratum."), + N_("(ARM only) Do not fix binaries for ARM1176 erratum.")); + DEFINE_bool(merge_exidx_entries, options::TWO_DASHES, '\0', true, N_("(ARM only) Merge exidx entries in debuginfo."), N_("(ARM only) Do not merge exidx entries in debuginfo.")); diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am index 8666935982..47058e92a2 100644 --- a/gold/testsuite/Makefile.am +++ b/gold/testsuite/Makefile.am @@ -2202,7 +2202,7 @@ thumb_bl_in_range.stdout: thumb_bl_in_range $(TEST_OBJDUMP) -D $< > $@ thumb_bl_in_range: thumb_bl_in_range.o ../ld-new - ../ld-new -T $(srcdir)/thumb_branch_range.t -o $@ $< + ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $< thumb_bl_in_range.o: thumb_bl_in_range.s $(TEST_AS) -o $@ -march=armv5te $< @@ -2211,7 +2211,7 @@ thumb_bl_out_of_range.stdout: thumb_bl_out_of_range $(TEST_OBJDUMP) -D $< > $@ thumb_bl_out_of_range: thumb_bl_out_of_range.o ../ld-new - ../ld-new -T $(srcdir)/thumb_branch_range.t -o $@ $< + ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $< thumb_bl_out_of_range.o: thumb_bl_out_of_range.s $(TEST_AS) -o $@ -march=armv5te $< @@ -2238,7 +2238,7 @@ thumb_blx_in_range.stdout: thumb_blx_in_range $(TEST_OBJDUMP) -D $< > $@ thumb_blx_in_range: thumb_blx_in_range.o ../ld-new - ../ld-new -T $(srcdir)/thumb_branch_range.t -o $@ $< + ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $< thumb_blx_in_range.o: thumb_blx_in_range.s $(TEST_AS) -o $@ -march=armv5te $< @@ -2247,7 +2247,7 @@ thumb_blx_out_of_range.stdout: thumb_blx_out_of_range $(TEST_OBJDUMP) -D $< > $@ thumb_blx_out_of_range: thumb_blx_out_of_range.o ../ld-new - ../ld-new -T $(srcdir)/thumb_branch_range.t -o $@ $< + ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $< thumb_blx_out_of_range.o: thumb_blx_out_of_range.s $(TEST_AS) -o $@ -march=armv5te $< @@ -2274,7 +2274,7 @@ 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 $@ $< + ../ld-new --no-fix-arm1176 -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 $< @@ -2311,7 +2311,7 @@ arm_fix_v4bx.stdout: arm_fix_v4bx $(TEST_OBJDUMP) -D -j.text $< > $@ arm_fix_v4bx: arm_fix_v4bx.o ../ld-new - ../ld-new --fix-v4bx -o $@ $< + ../ld-new --no-fix-arm1176 --fix-v4bx -o $@ $< arm_fix_v4bx.o: arm_fix_v4bx.s $(TEST_AS) -o $@ $< @@ -2320,13 +2320,13 @@ arm_fix_v4bx_interworking.stdout: arm_fix_v4bx_interworking $(TEST_OBJDUMP) -D -j.text $< > $@ arm_fix_v4bx_interworking: arm_fix_v4bx.o ../ld-new - ../ld-new --fix-v4bx-interworking -o $@ $< + ../ld-new --no-fix-arm1176 --fix-v4bx-interworking -o $@ $< arm_no_fix_v4bx.stdout: arm_no_fix_v4bx $(TEST_OBJDUMP) -D -j.text $< > $@ arm_no_fix_v4bx: arm_fix_v4bx.o ../ld-new - ../ld-new -o $@ $< + ../ld-new --no-fix-arm1176 -o $@ $< MOSTLYCLEANFILES += arm_fix_v4bx arm_fix_v4bx_interworking arm_no_fix_v4bx @@ -2366,6 +2366,69 @@ arm_attr_merge_7b.o: arm_attr_merge_7b.s MOSTLYCLEANFILES += arm_attr_merge_6 arm_attr_merge_6r arm_attr_merge_7 +# ARM1176 workaround test. +check_SCRIPTS += arm_fix_1176.sh +check_DATA += arm_fix_1176_default_v6z.stdout arm_fix_1176_on_v6z.stdout \ + arm_fix_1176_off_v6z.stdout arm_fix_1176_default_v5te.stdout \ + arm_fix_1176_default_v7a.stdout arm_fix_1176_default_1156t2f_s.stdout + +arm_fix_1176_default_v6z.stdout: arm_fix_1176_default_v6z + $(TEST_OBJDUMP) -D -j.foo $< > $@ + +arm_fix_1176_default_v6z: arm_fix_1176_default_v6z.o ../ld-new + ../ld-new --section-start=.foo=0x2001014 -o $@ $< + +arm_fix_1176_default_v6z.o: arm_fix_1176.s + $(TEST_AS) -march=armv6z -o $@ $< + +arm_fix_1176_on_v6z.stdout: arm_fix_1176_on_v6z + $(TEST_OBJDUMP) -D -j.foo $< > $@ + +arm_fix_1176_on_v6z: arm_fix_1176_on_v6z.o ../ld-new + ../ld-new --section-start=.foo=0x2001014 --fix-arm1176 -o $@ $< + +arm_fix_1176_on_v6z.o: arm_fix_1176.s + $(TEST_AS) -march=armv6z -o $@ $< + +arm_fix_1176_off_v6z.stdout: arm_fix_1176_off_v6z + $(TEST_OBJDUMP) -D -j.foo $< > $@ + +arm_fix_1176_off_v6z: arm_fix_1176_off_v6z.o ../ld-new + ../ld-new --section-start=.foo=0x2001014 --no-fix-arm1176 -o $@ $< + +arm_fix_1176_off_v6z.o: arm_fix_1176.s + $(TEST_AS) -march=armv6z -o $@ $< + +arm_fix_1176_default_v5te.stdout: arm_fix_1176_default_v5te + $(TEST_OBJDUMP) -D -j.foo $< > $@ + +arm_fix_1176_default_v5te: arm_fix_1176_default_v5te.o ../ld-new + ../ld-new --section-start=.foo=0x2001014 -o $@ $< + +arm_fix_1176_default_v5te.o: arm_fix_1176.s + $(TEST_AS) -march=armv5te -o $@ $< + +arm_fix_1176_default_v7a.stdout: arm_fix_1176_default_v7a + $(TEST_OBJDUMP) -D -j.foo $< > $@ + +arm_fix_1176_default_v7a: arm_fix_1176_default_v7a.o ../ld-new + ../ld-new --section-start=.foo=0x2001014 -o $@ $< + +arm_fix_1176_default_v7a.o: arm_fix_1176.s + $(TEST_AS) -march=armv7-a -o $@ $< + +arm_fix_1176_default_1156t2f_s.stdout: arm_fix_1176_default_1156t2f_s + $(TEST_OBJDUMP) -D -j.foo $< > $@ + +arm_fix_1176_default_1156t2f_s: arm_fix_1176_default_1156t2f_s.o ../ld-new + ../ld-new --section-start=.foo=0x2001014 -o $@ $< + +arm_fix_1176_default_1156t2f_s.o: arm_fix_1176.s + $(TEST_AS) -mcpu=arm1156t2f-s -o $@ $< + +MOSTLYCLEANFILES += arm_fix_1176_default_v6z arm_fix_1176_on_v6z arm_fix_1176_off_v6z \ + arm_fix_1176_default_v5te arm_fix_1176_default_v7a arm_fix_1176_default_1156t2f_s + # Cortex-A8 workaround test. check_SCRIPTS += arm_cortex_a8.sh @@ -2480,7 +2543,7 @@ arm_farcall_arm_arm.stdout: arm_farcall_arm_arm $(TEST_OBJDUMP) -d $< > $@ arm_farcall_arm_arm: arm_farcall_arm_arm.o ../ld-new - ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001020 -o $@ $< + ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001020 -o $@ $< arm_farcall_arm_arm.o: arm_farcall_arm_arm.s $(TEST_AS) -o $@ $< @@ -2505,7 +2568,7 @@ arm_farcall_arm_thumb_5t.stdout: arm_farcall_arm_thumb_5t $(TEST_OBJDUMP) -D $< > $@ arm_farcall_arm_thumb_5t: arm_farcall_arm_thumb_5t.o ../ld-new - ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $< + ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $< arm_farcall_arm_thumb_5t.o: arm_farcall_arm_thumb.s $(TEST_AS) -march=armv5t -o $@ $< @@ -2533,7 +2596,7 @@ arm_farcall_thumb_thumb_5t.stdout: arm_farcall_thumb_thumb_5t $(TEST_OBJDUMP) -D $< > $@ arm_farcall_thumb_thumb_5t: arm_farcall_thumb_thumb_5t.o ../ld-new - ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $< + ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $< arm_farcall_thumb_thumb_5t.o: arm_farcall_thumb_thumb.s $(TEST_AS) -march=armv5t -o $@ $< @@ -2578,7 +2641,7 @@ arm_farcall_thumb_arm_5t.stdout: arm_farcall_thumb_arm_5t $(TEST_OBJDUMP) -D $< > $@ arm_farcall_thumb_arm_5t: arm_farcall_thumb_arm_5t.o ../ld-new - ../ld-new --section-start .text=0x1c01010 --section-start .foo=0x2001014 -o $@ $< + ../ld-new --no-fix-arm1176 --section-start .text=0x1c01010 --section-start .foo=0x2001014 -o $@ $< arm_farcall_thumb_arm_5t.o: arm_farcall_thumb_arm.s $(TEST_AS) -march=armv5t -o $@ $< diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in index 09c28d24f0..f66fb8a77d 100644 --- a/gold/testsuite/Makefile.in +++ b/gold/testsuite/Makefile.in @@ -508,6 +508,8 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ @DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_x86_64_4 split_x86_64_r +# ARM1176 workaround test. + # Cortex-A8 workaround test. # Check ARM to ARM farcall veneers @@ -522,6 +524,7 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_branch_out_of_range.sh \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_fix_v4bx.sh \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_attr_merge.sh \ +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_fix_1176.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 \ @@ -550,6 +553,12 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_attr_merge_6.stdout \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_attr_merge_6r.stdout \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_attr_merge_7.stdout \ +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_fix_1176_default_v6z.stdout \ +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_fix_1176_on_v6z.stdout \ +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_fix_1176_off_v6z.stdout \ +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_fix_1176_default_v5te.stdout \ +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_fix_1176_default_v7a.stdout \ +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_fix_1176_default_1156t2f_s.stdout \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_cortex_a8_b_cond.stdout \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_cortex_a8_b.stdout \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_cortex_a8_bl.stdout \ @@ -588,6 +597,12 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_attr_merge_6 \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_attr_merge_6r \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_attr_merge_7 \ +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_fix_1176_default_v6z \ +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_fix_1176_on_v6z \ +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_fix_1176_off_v6z \ +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_fix_1176_default_v5te \ +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_fix_1176_default_v7a \ +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_fix_1176_default_1156t2f_s \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_cortex_a8_b_cond \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_cortex_a8_b \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_cortex_a8_bl \ @@ -3710,6 +3725,8 @@ 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_fix_1176.sh.log: arm_fix_1176.sh + @p='arm_fix_1176.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) arm_exidx_test.sh.log: arm_exidx_test.sh @@ -5179,7 +5196,7 @@ uninstall-am: @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_OBJDUMP) -D $< > $@ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@thumb_bl_in_range: thumb_bl_in_range.o ../ld-new -@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new -T $(srcdir)/thumb_branch_range.t -o $@ $< +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $< @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@thumb_bl_in_range.o: thumb_bl_in_range.s @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_AS) -o $@ -march=armv5te $< @@ -5188,7 +5205,7 @@ uninstall-am: @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_OBJDUMP) -D $< > $@ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@thumb_bl_out_of_range: thumb_bl_out_of_range.o ../ld-new -@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new -T $(srcdir)/thumb_branch_range.t -o $@ $< +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $< @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@thumb_bl_out_of_range.o: thumb_bl_out_of_range.s @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_AS) -o $@ -march=armv5te $< @@ -5215,7 +5232,7 @@ uninstall-am: @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_OBJDUMP) -D $< > $@ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@thumb_blx_in_range: thumb_blx_in_range.o ../ld-new -@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new -T $(srcdir)/thumb_branch_range.t -o $@ $< +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $< @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@thumb_blx_in_range.o: thumb_blx_in_range.s @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_AS) -o $@ -march=armv5te $< @@ -5224,7 +5241,7 @@ uninstall-am: @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_OBJDUMP) -D $< > $@ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@thumb_blx_out_of_range: thumb_blx_out_of_range.o ../ld-new -@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new -T $(srcdir)/thumb_branch_range.t -o $@ $< +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $< @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@thumb_blx_out_of_range.o: thumb_blx_out_of_range.s @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_AS) -o $@ -march=armv5te $< @@ -5251,7 +5268,7 @@ uninstall-am: @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_OBJDUMP) -D $< > $@ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@thumb_bl_out_of_range_local: thumb_bl_out_of_range_local.o ../ld-new -@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new -T $(srcdir)/thumb_branch_range.t -o $@ $< +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $< @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@thumb_bl_out_of_range_local.o: thumb_bl_out_of_range_local.s @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_AS) -o $@ -march=armv5te $< @@ -5278,7 +5295,7 @@ uninstall-am: @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_OBJDUMP) -D -j.text $< > $@ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_fix_v4bx: arm_fix_v4bx.o ../ld-new -@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new --fix-v4bx -o $@ $< +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new --no-fix-arm1176 --fix-v4bx -o $@ $< @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_fix_v4bx.o: arm_fix_v4bx.s @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_AS) -o $@ $< @@ -5287,13 +5304,13 @@ uninstall-am: @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_OBJDUMP) -D -j.text $< > $@ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_fix_v4bx_interworking: arm_fix_v4bx.o ../ld-new -@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new --fix-v4bx-interworking -o $@ $< +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new --no-fix-arm1176 --fix-v4bx-interworking -o $@ $< @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_no_fix_v4bx.stdout: arm_no_fix_v4bx @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_OBJDUMP) -D -j.text $< > $@ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_no_fix_v4bx: arm_fix_v4bx.o ../ld-new -@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new -o $@ $< +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new --no-fix-arm1176 -o $@ $< @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_attr_merge_6.stdout: arm_attr_merge_6 @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_READELF) -A $< > $@ @@ -5325,6 +5342,60 @@ uninstall-am: @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_attr_merge_7b.o: arm_attr_merge_7b.s @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_AS) -o $@ $< +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_fix_1176_default_v6z.stdout: arm_fix_1176_default_v6z +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_OBJDUMP) -D -j.foo $< > $@ + +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_fix_1176_default_v6z: arm_fix_1176_default_v6z.o ../ld-new +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new --section-start=.foo=0x2001014 -o $@ $< + +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_fix_1176_default_v6z.o: arm_fix_1176.s +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_AS) -march=armv6z -o $@ $< + +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_fix_1176_on_v6z.stdout: arm_fix_1176_on_v6z +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_OBJDUMP) -D -j.foo $< > $@ + +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_fix_1176_on_v6z: arm_fix_1176_on_v6z.o ../ld-new +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new --section-start=.foo=0x2001014 --fix-arm1176 -o $@ $< + +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_fix_1176_on_v6z.o: arm_fix_1176.s +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_AS) -march=armv6z -o $@ $< + +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_fix_1176_off_v6z.stdout: arm_fix_1176_off_v6z +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_OBJDUMP) -D -j.foo $< > $@ + +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_fix_1176_off_v6z: arm_fix_1176_off_v6z.o ../ld-new +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new --section-start=.foo=0x2001014 --no-fix-arm1176 -o $@ $< + +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_fix_1176_off_v6z.o: arm_fix_1176.s +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_AS) -march=armv6z -o $@ $< + +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_fix_1176_default_v5te.stdout: arm_fix_1176_default_v5te +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_OBJDUMP) -D -j.foo $< > $@ + +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_fix_1176_default_v5te: arm_fix_1176_default_v5te.o ../ld-new +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new --section-start=.foo=0x2001014 -o $@ $< + +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_fix_1176_default_v5te.o: arm_fix_1176.s +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_AS) -march=armv5te -o $@ $< + +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_fix_1176_default_v7a.stdout: arm_fix_1176_default_v7a +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_OBJDUMP) -D -j.foo $< > $@ + +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_fix_1176_default_v7a: arm_fix_1176_default_v7a.o ../ld-new +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new --section-start=.foo=0x2001014 -o $@ $< + +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_fix_1176_default_v7a.o: arm_fix_1176.s +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_AS) -march=armv7-a -o $@ $< + +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_fix_1176_default_1156t2f_s.stdout: arm_fix_1176_default_1156t2f_s +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_OBJDUMP) -D -j.foo $< > $@ + +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_fix_1176_default_1156t2f_s: arm_fix_1176_default_1156t2f_s.o ../ld-new +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new --section-start=.foo=0x2001014 -o $@ $< + +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_fix_1176_default_1156t2f_s.o: arm_fix_1176.s +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_AS) -mcpu=arm1156t2f-s -o $@ $< + @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_cortex_a8_b_cond.stdout: arm_cortex_a8_b_cond @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_OBJDUMP) -D -j.text $< > $@ @@ -5413,7 +5484,7 @@ uninstall-am: @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_OBJDUMP) -d $< > $@ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_farcall_arm_arm: arm_farcall_arm_arm.o ../ld-new -@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001020 -o $@ $< +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001020 -o $@ $< @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_farcall_arm_arm.o: arm_farcall_arm_arm.s @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_AS) -o $@ $< @@ -5431,7 +5502,7 @@ uninstall-am: @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_OBJDUMP) -D $< > $@ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_farcall_arm_thumb_5t: arm_farcall_arm_thumb_5t.o ../ld-new -@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $< +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $< @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_farcall_arm_thumb_5t.o: arm_farcall_arm_thumb.s @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_AS) -march=armv5t -o $@ $< @@ -5449,7 +5520,7 @@ uninstall-am: @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_OBJDUMP) -D $< > $@ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_farcall_thumb_thumb_5t: arm_farcall_thumb_thumb_5t.o ../ld-new -@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $< +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $< @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_farcall_thumb_thumb_5t.o: arm_farcall_thumb_thumb.s @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_AS) -march=armv5t -o $@ $< @@ -5485,7 +5556,7 @@ uninstall-am: @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_OBJDUMP) -D $< > $@ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_farcall_thumb_arm_5t: arm_farcall_thumb_arm_5t.o ../ld-new -@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new --section-start .text=0x1c01010 --section-start .foo=0x2001014 -o $@ $< +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new --no-fix-arm1176 --section-start .text=0x1c01010 --section-start .foo=0x2001014 -o $@ $< @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 $@ $< diff --git a/gold/testsuite/arm_fix_1176.s b/gold/testsuite/arm_fix_1176.s new file mode 100644 index 0000000000..96e03284ac --- /dev/null +++ b/gold/testsuite/arm_fix_1176.s @@ -0,0 +1,15 @@ + .syntax unified + .globl _start + .globl func_to_branch_to + + .arm + .text +func_to_branch_to: + bx lr + + .thumb + .section .foo, "xa" + .thumb_func +_start: + bl func_to_branch_to + diff --git a/gold/testsuite/arm_fix_1176.sh b/gold/testsuite/arm_fix_1176.sh new file mode 100755 index 0000000000..152b0a3223 --- /dev/null +++ b/gold/testsuite/arm_fix_1176.sh @@ -0,0 +1,61 @@ +#!/bin/sh + +# arm_fix_1176.sh -- a test case for the ARM1176 workaround. + +# Copyright 2010, 2011, Free Software Foundation, Inc. +# Written by Matthew Gretton-Dann +# Based upon arm_cortex_a8.sh +# Written by Doug Kwan . + +# 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 +} + +# Check for fix default state on v6Z. +check arm_fix_1176_default_v6z.stdout "2001014: .* bl 2001018 <.*>" + +# Check for fix explicitly on on v6Z. +check arm_fix_1176_on_v6z.stdout "2001014: .* bl 2001018 <.*>" + +# Check for explicitly off on v6Z +check arm_fix_1176_off_v6z.stdout "2001014: .* blx 2001018 <.*>" + +# Check for fix default state on v5TE +check arm_fix_1176_default_v5te.stdout "2001014: .* bl 2001018 <.*>" + +# Check for fix default state on v7A +check arm_fix_1176_default_v7a.stdout "2001014: .* blx 2001018 <.*>" + +# Check for fix default state on ARM1156T2F-S +check arm_fix_1176_default_1156t2f_s.stdout "2001014: .* blx 2001018 <.*>" + +exit 0 -- 2.34.1