2011-05-31 Doug Kwan <dougkwan@google.com>
authorDoug Kwan <dougkwan@google.com>
Wed, 1 Jun 2011 19:59:42 +0000 (19:59 +0000)
committerDoug Kwan <dougkwan@google.com>
Wed, 1 Jun 2011 19:59:42 +0000 (19:59 +0000)
            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
gold/arm.cc
gold/testsuite/Makefile.am
gold/testsuite/Makefile.in
gold/testsuite/pr12826.sh [new file with mode: 0755]
gold/testsuite/pr12826_1.s [new file with mode: 0644]
gold/testsuite/pr12826_2.s [new file with mode: 0644]

index 08429b72cc4b9fd6d421cac348091f824b34ab58..30f30087529d02d3102632e32be7bc5614510751 100644 (file)
@@ -1,3 +1,19 @@
+2011-05-31  Doug Kwan  <dougkwan@google.com>
+            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  <iant@google.com>
 
        * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
index 9af0e21193a0a8d119eabd3880a6b37286905f58..e36b3ab5d40c71660ed72b62fe07e178a1aafc8c 100644 (file)
@@ -10202,7 +10202,7 @@ Target_arm<big_endian>::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;
index 426c1004d09c86141655ed63fd813a6b94a335b7..a068fa7a513280fa7f9997935f15282a00d71ea6 100644 (file)
@@ -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
 
index 011b44de092612a8fceb12768b51ec6504ac7bea..c4b2ea03f52cd0272cf530fbef00dbf4505034dd 100644 (file)
@@ -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 (executable)
index 0000000..a4fa2e3
--- /dev/null
@@ -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 <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 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 (file)
index 0000000..b4f6841
--- /dev/null
@@ -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 (file)
index 0000000..2dd7dc9
--- /dev/null
@@ -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