+2016-06-28 Igor Kudrin <ikudrin@accesssoftek.com>
+
+ * aarch64-reloc.def (NONE): New relocation.
+ * aarch64.cc (Target_aarch64::Scan::local): Handle R_AARCH64_NONE.
+ (Target_aarch64::Scan::global): Likewise.
+ * testsuite/Makefile.am (aarch64_reloc_none): New test.
+ * testsuite/Makefile.in: Regenerate.
+ * testsuite/aarch64_reloc_none.s: New test source file.
+ * testsuite/aarch64_reloc_none.sh: New test script.
+
2016-06-28 Sriraman Tallam <tmsriram@google.com>
* x86_64.cc (Lazy_view): New class.
// Type----------------------------+ | | | | | | |
// Name | | | | | | | |
// | | | | | | | | |
+ARD(NONE , STATIC , NONE , Y, -1, 0,0 , 0,0 , 0 , DATA )
+// Above is from Table 4-5, Null relocation codes
+
ARD(ABS64 , STATIC , DATA , Y, -1, 0,0 , 0,0 , Symbol::ABSOLUTE_REF , DATA )
ARD(ABS32 , STATIC , DATA , Y, -1, 31,32 , 0,0 , Symbol::ABSOLUTE_REF , DATA )
ARD(ABS16 , STATIC , DATA , Y, -1, 15,16 , 0,0 , Symbol::ABSOLUTE_REF , DATA )
switch (r_type)
{
+ case elfcpp::R_AARCH64_NONE:
+ break;
+
case elfcpp::R_AARCH64_ABS32:
case elfcpp::R_AARCH64_ABS16:
if (parameters->options().output_is_position_independent())
switch (r_type)
{
+ case elfcpp::R_AARCH64_NONE:
+ break;
+
case elfcpp::R_AARCH64_ABS16:
case elfcpp::R_AARCH64_ABS32:
case elfcpp::R_AARCH64_ABS64:
endif DEFAULT_TARGET_ARM
+if DEFAULT_TARGET_AARCH64
+
+check_SCRIPTS += aarch64_reloc_none.sh
+check_DATA += aarch64_reloc_none.stdout
+aarch64_reloc_none.o: aarch64_reloc_none.s
+ $(TEST_AS) -o $@ $<
+aarch64_reloc_none: aarch64_reloc_none.o ../ld-new
+ ../ld-new -o $@ aarch64_reloc_none.o --gc-sections
+aarch64_reloc_none.stdout: aarch64_reloc_none
+ $(TEST_NM) $< > $@
+
+MOSTLYCLEANFILES += aarch64_reloc_none
+
+endif DEFAULT_TARGET_AARCH64
+
if DEFAULT_TARGET_S390
check_SCRIPTS += split_s390.sh
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_thumb_6m \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_arm \
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_arm_5t
-@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_89 = split_s390.sh
-@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_90 = split_s390_z1.stdout split_s390_z2.stdout split_s390_z3.stdout \
+@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_89 = aarch64_reloc_none.sh
+@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_90 = aarch64_reloc_none.stdout
+@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_91 = aarch64_reloc_none
+@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_92 = split_s390.sh
+@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_93 = split_s390_z1.stdout split_s390_z2.stdout split_s390_z3.stdout \
@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_s390_z4.stdout split_s390_n1.stdout split_s390_n2.stdout \
@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_s390_a1.stdout split_s390_a2.stdout split_s390_z1_ns.stdout \
@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_s390_z2_ns.stdout split_s390_z3_ns.stdout split_s390_z4_ns.stdout \
@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_s390x_z4_ns.stdout split_s390x_n1_ns.stdout \
@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_s390x_n2_ns.stdout split_s390x_r.stdout
-@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_91 = split_s390_z1 split_s390_z2 split_s390_z3 \
+@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_94 = split_s390_z1 split_s390_z2 split_s390_z3 \
@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_s390_z4 split_s390_n1 split_s390_n2 split_s390_a1 \
@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_s390_a2 split_s390_z1_ns split_s390_z2_ns split_s390_z3_ns \
@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_s390_z4_ns split_s390_n1_ns split_s390_n2_ns split_s390_r \
@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_s390x_z1_ns split_s390x_z2_ns split_s390x_z3_ns \
@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ split_s390x_z4_ns split_s390x_n1_ns split_s390x_n2_ns split_s390x_r
-@DEFAULT_TARGET_X86_64_TRUE@am__append_92 = *.dwo *.dwp
-@DEFAULT_TARGET_X86_64_TRUE@am__append_93 = dwp_test_1.sh \
+@DEFAULT_TARGET_X86_64_TRUE@am__append_95 = *.dwo *.dwp
+@DEFAULT_TARGET_X86_64_TRUE@am__append_96 = dwp_test_1.sh \
@DEFAULT_TARGET_X86_64_TRUE@ dwp_test_2.sh
-@DEFAULT_TARGET_X86_64_TRUE@am__append_94 = dwp_test_1.stdout \
+@DEFAULT_TARGET_X86_64_TRUE@am__append_97 = dwp_test_1.stdout \
@DEFAULT_TARGET_X86_64_TRUE@ dwp_test_2.stdout
subdir = testsuite
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
$(am__append_68) $(am__append_71) $(am__append_73) \
$(am__append_76) $(am__append_79) $(am__append_82) \
$(am__append_85) $(am__append_88) $(am__append_91) \
- $(am__append_92)
+ $(am__append_94) $(am__append_95)
# We will add to these later, for each individual test. Note
# that we add each test under check_SCRIPTS or check_PROGRAMS;
$(am__append_43) $(am__append_47) $(am__append_50) \
$(am__append_66) $(am__append_69) $(am__append_74) \
$(am__append_77) $(am__append_80) $(am__append_83) \
- $(am__append_86) $(am__append_89) $(am__append_93)
+ $(am__append_86) $(am__append_89) $(am__append_92) \
+ $(am__append_96)
check_DATA = $(am__append_3) $(am__append_22) $(am__append_28) \
$(am__append_31) $(am__append_37) $(am__append_40) \
$(am__append_44) $(am__append_48) $(am__append_51) \
$(am__append_67) $(am__append_70) $(am__append_75) \
$(am__append_78) $(am__append_81) $(am__append_84) \
- $(am__append_87) $(am__append_90) $(am__append_94)
+ $(am__append_87) $(am__append_90) $(am__append_93) \
+ $(am__append_97)
BUILT_SOURCES = $(am__append_34)
TESTS = $(check_SCRIPTS) $(check_PROGRAMS)
@p='arm_farcall_thumb_thumb.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
arm_farcall_thumb_arm.sh.log: arm_farcall_thumb_arm.sh
@p='arm_farcall_thumb_arm.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
+aarch64_reloc_none.sh.log: aarch64_reloc_none.sh
+ @p='aarch64_reloc_none.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
split_s390.sh.log: split_s390.sh
@p='split_s390.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
dwp_test_1.sh.log: dwp_test_1.sh
@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 $@ $<
+@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@aarch64_reloc_none.o: aarch64_reloc_none.s
+@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_AS) -o $@ $<
+@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@aarch64_reloc_none: aarch64_reloc_none.o ../ld-new
+@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ ../ld-new -o $@ aarch64_reloc_none.o --gc-sections
+@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@aarch64_reloc_none.stdout: aarch64_reloc_none
+@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_NM) $< > $@
@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@split_s390_1_z1.o: split_s390_1_z1.s
@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_AS) -m31 -o $@ $<
@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@split_s390_1_z2.o: split_s390_1_z2.s
--- /dev/null
+.text\r
+.global _start\r
+.type _start, %function\r
+_start:\r
+ nop\r
+.reloc 0, R_AARCH64_NONE, foo\r
+\r
+.section .foo,"ax"\r
+.global foo\r
+foo:\r
+ nop\r
+\r
+.section .bar,"ax"\r
+.global bar\r
+bar:\r
+ nop\r
--- /dev/null
+#!/bin/sh
+
+# aarch64_reloc_none.sh -- test that R_AARCH64_NONE can be used
+# to prevent garbage collecting a section.
+
+# Copyright (C) 2010-2016 Free Software Foundation, Inc.
+# Written by Igor Kudrin <ikudrin@accesssoftek.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.
+
+# The goal of this test is to verify that support for the R_AARCH64_NONE
+# relocation is implemented and it can be used to inform a linker that
+# a section should be preserved during garbage collecting.
+# File aarch64_reloc_none.s describes two similar sections, .foo and .bar,
+# but .foo is referenced from .text using R_AARCH64_NONE against symbol foo.
+# When flag --gc-sections is used, .foo and its symbol foo have to be
+# preserved, whereas .bar and its symbol bar have to be discarded.
+
+check()
+{
+ file=$1
+
+ found_bar=`grep -e "\<bar\b" "$file"`
+ if test -n "$found_bar"; then
+ echo "Garbage collection failed to collect bar"
+ echo ""
+ echo "Actual output below:"
+ cat "$file"
+ exit 1
+ fi
+
+ found_foo=`grep -e "\<foo\b" "$file"`
+ if test -z "$found_foo"; then
+ echo "Garbage collection should not discard foo"
+ echo ""
+ echo "Actual output below:"
+ cat "$file"
+ exit 1
+ fi
+}
+
+check aarch64_reloc_none.stdout