From f62a3ca73197039811735a77ba091b329cf57d2e Mon Sep 17 00:00:00 2001 From: Doug Kwan Date: Wed, 1 Jun 2011 19:59:42 +0000 Subject: [PATCH] 2011-05-31 Doug Kwan Asier Llano PR gold/12826 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of arch value that equals to elfcpp::MAX_TAG_CPU_ARCH. * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove redundant arm_exidx_test.so. * testsuite/Makefile.in: Regenerate. (check_SCRIPTS): Add pr12826.sh (check_DATA): Add pr12826.stdout (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules. * testsuite/pr12826.sh: New file. * testsuite/pr12826_1.s: Ditto. * testsuite/pr12826_1.s: Ditto. --- gold/ChangeLog | 16 ++++++++++++++ gold/arm.cc | 2 +- gold/testsuite/Makefile.am | 15 ++++++++++++- gold/testsuite/Makefile.in | 23 ++++++++++++++++---- gold/testsuite/pr12826.sh | 44 ++++++++++++++++++++++++++++++++++++++ gold/testsuite/pr12826_1.s | 13 +++++++++++ gold/testsuite/pr12826_2.s | 13 +++++++++++ 7 files changed, 120 insertions(+), 6 deletions(-) create mode 100755 gold/testsuite/pr12826.sh create mode 100644 gold/testsuite/pr12826_1.s create mode 100644 gold/testsuite/pr12826_2.s diff --git a/gold/ChangeLog b/gold/ChangeLog index 08429b72cc4..30f30087529 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,19 @@ +2011-05-31 Doug Kwan + Asier Llano + + PR gold/12826 + * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of + arch value that equals to elfcpp::MAX_TAG_CPU_ARCH. + * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove + redundant arm_exidx_test.so. + * testsuite/Makefile.in: Regenerate. + (check_SCRIPTS): Add pr12826.sh + (check_DATA): Add pr12826.stdout + (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules. + * testsuite/pr12826.sh: New file. + * testsuite/pr12826_1.s: Ditto. + * testsuite/pr12826_1.s: Ditto. + 2011-05-30 Ian Lance Taylor * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc diff --git a/gold/arm.cc b/gold/arm.cc index 9af0e21193a..e36b3ab5d40 100644 --- a/gold/arm.cc +++ b/gold/arm.cc @@ -10202,7 +10202,7 @@ Target_arm::tag_cpu_arch_combine( // Check we've not got a higher architecture than we know about. - if (oldtag >= elfcpp::MAX_TAG_CPU_ARCH || newtag >= elfcpp::MAX_TAG_CPU_ARCH) + if (oldtag > elfcpp::MAX_TAG_CPU_ARCH || newtag > elfcpp::MAX_TAG_CPU_ARCH) { gold_error(_("%s: unknown CPU architecture"), name); return -1; diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am index 426c1004d09..a068fa7a513 100644 --- a/gold/testsuite/Makefile.am +++ b/gold/testsuite/Makefile.am @@ -2214,7 +2214,20 @@ arm_exidx_test.so: arm_exidx_test.o ../ld-new arm_exidx_test.o: arm_exidx_test.s $(TEST_AS) -o $@ $< -MOSTLYCLEANFILES += arm_exidx_test.so +check_SCRIPTS += pr12826.sh +check_DATA += pr12826.stdout + +pr12826.stdout: pr12826.so + $(TEST_READELF) -A $< > $@ + +pr12826.so: pr12826_1.o pr12826_2.o ../ld-new + ../ld-new -shared -o $@ $< + +pr12826_1.o: pr12826_1.s + $(TEST_AS) -o $@ $< + +pr12826_2.o: pr12826_2.s + $(TEST_AS) -o $@ $< endif DEFAULT_TARGET_ARM diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in index 011b44de092..c4b2ea03f52 100644 --- a/gold/testsuite/Makefile.in +++ b/gold/testsuite/Makefile.in @@ -470,7 +470,8 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ @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_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@ arm_exidx_test.sh \ +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ pr12826.sh @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_46 = 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 \ @@ -495,7 +496,8 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_cortex_a8_blx.stdout \ @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@ arm_exidx_test.stdout \ +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ pr12826.stdout @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_47 = 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 \ @@ -519,8 +521,7 @@ 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_exidx_test.so +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_cortex_a8_local_reloc subdir = testsuite DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -3383,6 +3384,8 @@ 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 @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) 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) @@ -4894,6 +4897,18 @@ uninstall-am: @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_exidx_test.o: arm_exidx_test.s @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_AS) -o $@ $< +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@pr12826.stdout: pr12826.so +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_READELF) -A $< > $@ + +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@pr12826.so: pr12826_1.o pr12826_2.o ../ld-new +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new -shared -o $@ $< + +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@pr12826_1.o: pr12826_1.s +@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_AS) -o $@ $< + +@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 $@ $< + # 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/pr12826.sh b/gold/testsuite/pr12826.sh new file mode 100755 index 00000000000..a4fa2e3afc1 --- /dev/null +++ b/gold/testsuite/pr12826.sh @@ -0,0 +1,44 @@ +#!/bin/sh + +# pr12826.sh -- a test case for combining ARM arch attributes. + +# Copyright 2011 Free Software Foundation, Inc. +# 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 pr12826_1.s and pr12826_2.s, two ARM assembly source +# files constructed to test handling of arch attributes. + +check() +{ + if ! grep -q "$2" "$1" + then + echo "Did not find attribute in $1:" + echo " $2" + echo "" + echo "Actual attribute below:" + cat "$1" + exit 1 + fi +} + +# Check that arch is armv7e-m. +check pr12826.stdout "Tag_CPU_arch: v7E-M" + +exit 0 diff --git a/gold/testsuite/pr12826_1.s b/gold/testsuite/pr12826_1.s new file mode 100644 index 00000000000..b4f68418b44 --- /dev/null +++ b/gold/testsuite/pr12826_1.s @@ -0,0 +1,13 @@ + .syntax unified + .arch armv7e-m + .thumb + .text + .align 2 + .global f1 + .thumb + .thumb_func + .type f1, %function +f1: + movs r0, #0 + bx lr + .size f1, .-f1 diff --git a/gold/testsuite/pr12826_2.s b/gold/testsuite/pr12826_2.s new file mode 100644 index 00000000000..2dd7dc99744 --- /dev/null +++ b/gold/testsuite/pr12826_2.s @@ -0,0 +1,13 @@ + .syntax unified + .arch armv7e-m + .thumb + .text + .align 2 + .global f2 + .thumb + .thumb_func + .type f2, %function +f2: + movs r0, #0 + bx lr + .size f2, .-f2 -- 2.30.2