aboutsummaryrefslogtreecommitdiff
path: root/gold
diff options
context:
space:
mode:
authorDoug Kwan <dougkwan@google.com>2011-04-22 21:50:03 +0000
committerDoug Kwan <dougkwan@google.com>2011-04-22 21:50:03 +0000
commitc87e430233549c1670ff335b0d4614f1ea1d7edb (patch)
tree26e7cb53ea81d78cf09f94c1ac88b7e3968e0750 /gold
parent4161fbb015e3216b864fa502a22552d4b999eaf1 (diff)
downloadgdb-c87e430233549c1670ff335b0d4614f1ea1d7edb.zip
gdb-c87e430233549c1670ff335b0d4614f1ea1d7edb.tar.gz
gdb-c87e430233549c1670ff335b0d4614f1ea1d7edb.tar.bz2
2011-04-22 Doug Kwan <dougkwan@google.com>
* arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER flag of a SHT_ARM_EXIDX section. * testsuite/Makefile.am (arm_exidx_test): New test rules. * testsuite/Makefile.in: Regenerate. * testsuite/arm_exidx_test.s: New file. * testsuite/arm_exidx_test.sh: Same.
Diffstat (limited to 'gold')
-rw-r--r--gold/ChangeLog9
-rw-r--r--gold/arm.cc6
-rw-r--r--gold/testsuite/Makefile.am14
-rw-r--r--gold/testsuite/Makefile.in20
-rw-r--r--gold/testsuite/arm_exidx_test.s12
-rwxr-xr-xgold/testsuite/arm_exidx_test.sh45
6 files changed, 102 insertions, 4 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index 3567034..865573e 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,12 @@
+2011-04-22 Doug Kwan <dougkwan@google.com>
+
+ * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
+ flag of a SHT_ARM_EXIDX section.
+ * testsuite/Makefile.am (arm_exidx_test): New test rules.
+ * testsuite/Makefile.in: Regenerate.
+ * testsuite/arm_exidx_test.s: New file.
+ * testsuite/arm_exidx_test.sh: Same.
+
2011-04-20 Cary Coutant <ccoutant@google.com>
PR gold/12689
diff --git a/gold/arm.cc b/gold/arm.cc
index 6c81d30..541ff59 100644
--- a/gold/arm.cc
+++ b/gold/arm.cc
@@ -1342,9 +1342,13 @@ class Arm_output_section : public Output_section
public:
typedef std::vector<std::pair<Relobj*, unsigned int> > Text_section_list;
+ // We need to force SHF_LINK_ORDER in a SHT_ARM_EXIDX section.
Arm_output_section(const char* name, elfcpp::Elf_Word type,
elfcpp::Elf_Xword flags)
- : Output_section(name, type, flags)
+ : Output_section(name, type,
+ (type == elfcpp::SHT_ARM_EXIDX
+ ? flags | elfcpp::SHF_LINK_ORDER
+ : flags))
{
if (type == elfcpp::SHT_ARM_EXIDX)
this->set_always_keeps_input_sections();
diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am
index 2675763..f2af492 100644
--- a/gold/testsuite/Makefile.am
+++ b/gold/testsuite/Makefile.am
@@ -2164,6 +2164,20 @@ arm_cortex_a8_local_reloc.o: arm_cortex_a8_local_reloc.s
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
+check_SCRIPTS += arm_exidx_test.sh
+check_DATA += arm_exidx_test.stdout
+
+arm_exidx_test.stdout: arm_exidx_test.so
+ $(TEST_READELF) -S $< > $@
+
+arm_exidx_test.so: arm_exidx_test.o ../ld-new
+ ../ld-new -shared -o $@ $<
+
+arm_exidx_test.o: arm_exidx_test.s
+ $(TEST_AS) -o $@ $<
+
+MOSTLYCLEANFILES += arm_exidx_test.so
+
endif DEFAULT_TARGET_ARM
endif NATIVE_OR_CROSS_LINKER
diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in
index 226816b..f00534e 100644
--- a/gold/testsuite/Makefile.in
+++ b/gold/testsuite/Makefile.in
@@ -459,7 +459,8 @@ 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_cortex_a8.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@am__append_44 = 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 \
@@ -483,7 +484,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.stdout \
@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_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@am__append_45 = 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 \
@@ -507,7 +509,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_exidx_test.so
subdir = testsuite
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -3316,6 +3319,8 @@ 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)
+arm_exidx_test.sh.log: arm_exidx_test.sh
+ @p='arm_exidx_test.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)
@@ -4790,6 +4795,15 @@ uninstall-am:
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_cortex_a8_local_reloc.o: arm_cortex_a8_local_reloc.s
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_AS) -o $@ $<
+@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_exidx_test.stdout: arm_exidx_test.so
+@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_READELF) -S $< > $@
+
+@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_exidx_test.so: arm_exidx_test.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@arm_exidx_test.o: arm_exidx_test.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_exidx_test.s b/gold/testsuite/arm_exidx_test.s
new file mode 100644
index 0000000..e4f8c8b
--- /dev/null
+++ b/gold/testsuite/arm_exidx_test.s
@@ -0,0 +1,12 @@
+ .syntax unified
+ .arch armv5te
+ .text
+ .align 2
+ .global answer
+ .type answer, %function
+answer:
+ .fnstart
+ mov r0, #42
+ bx lr
+ .fnend
+ .size answer, .-answer
diff --git a/gold/testsuite/arm_exidx_test.sh b/gold/testsuite/arm_exidx_test.sh
new file mode 100755
index 0000000..f732a68
--- /dev/null
+++ b/gold/testsuite/arm_exidx_test.sh
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+# arm_exidx_test.sh -- a test case for .ARM.exidx section.
+
+# 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 arm_exidx_test.s, an ARM assembly source file constructed
+# to test handling of .ARM.exidx and .ARM.extab sections.
+
+check()
+{
+ if ! grep -q "$2" "$1"
+ then
+ echo "Did not find section header in $1:"
+ echo " $2"
+ echo ""
+ echo "Actual headers below:"
+ cat "$1"
+ exit 1
+ fi
+}
+
+# Check that SHF_LINK_ORDER is set.
+check arm_exidx_test.stdout ".* .ARM.exidx .* ARM_EXIDX .* AL .*"
+check arm_exidx_test.stdout ".* .ARM.extab .* PROGBITS .* A .*"
+
+exit 0