Fix earlier ChangeLog entry to give Igor credit, add testcases.
authorIgor Kudrin <ikudrin@accesssoftek.com>
Mon, 12 Dec 2016 04:31:09 +0000 (20:31 -0800)
committerCary Coutant <ccoutant@gmail.com>
Mon, 12 Dec 2016 04:31:09 +0000 (20:31 -0800)
2016-12-01  Cary Coutant  <ccoutant@gmail.com>
    Igor Kudrin  <ikudrin@accesssoftek.com>

PR gold/20717
* script-sections.cc (Script_sections): Set *keep to false when
no match.

2016-12-11  Igor Kudrin  <ikudrin@accesssoftek.com>

PR gold/20717
* testsuite/Makefile.am (pr20717): New test.
* testsuite/Makefile.in: Regenerate.
* testsuite/pr20717.c: New test source file.
* testsuite/pr20717.sh: New test script.
* testsuite/pr20717.t: New test linker script.

gold/ChangeLog
gold/Makefile.in
gold/testsuite/Makefile.am
gold/testsuite/Makefile.in
gold/testsuite/pr20717.c [new file with mode: 0644]
gold/testsuite/pr20717.sh [new file with mode: 0755]
gold/testsuite/pr20717.t [new file with mode: 0644]

index d129ddf09468c60e105e29378e4c98461a1bad7e..29c28f7629b963c1b7fb7e3f1bdde20d495a53a9 100644 (file)
@@ -1,3 +1,12 @@
+2016-12-11  Igor Kudrin  <ikudrin@accesssoftek.com>
+
+       PR gold/20717
+       * testsuite/Makefile.am (pr20717): New test.
+       * testsuite/Makefile.in: Regenerate.
+       * testsuite/pr20717.c: New test source file.
+       * testsuite/pr20717.sh: New test script.
+       * testsuite/pr20717.t: New test linker script.
+
 2016-12-11  Cary Coutant  <ccoutant@gmail.com>
 
        PR gold/16711
@@ -80,6 +89,7 @@
        * testsuite/file_in_many_sections_test.sh: New script.
 
 2016-12-01  Cary Coutant  <ccoutant@gmail.com>
+           Igor Kudrin  <ikudrin@accesssoftek.com>
 
        PR gold/20717
        * script-sections.cc (Script_sections): Set *keep to false when
index 1e0578d8ede4ff24f16b2c1fdd13b49d2a0b6ed6..ebe2824606582422d596a0ca532e1b97332ac0fe 100644 (file)
@@ -87,8 +87,8 @@ subdir = .
 DIST_COMMON = NEWS README ChangeLog $(srcdir)/Makefile.in \
        $(srcdir)/Makefile.am $(top_srcdir)/configure \
        $(am__configure_deps) $(srcdir)/config.in \
-       $(srcdir)/../mkinstalldirs $(top_srcdir)/po/Make-in ffsll.c \
-       pread.c mremap.c ftruncate.c yyscript.h yyscript.c \
+       $(srcdir)/../mkinstalldirs $(top_srcdir)/po/Make-in mremap.c \
+       ffsll.c ftruncate.c pread.c yyscript.h yyscript.c \
        $(srcdir)/../depcomp $(srcdir)/../ylwrap
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \
index 6a0b19d6bf383fe2bbe3719c88e08f1cff938125..25db2b8d09547c85df220d7331d7d6d532fcaba3 100644 (file)
@@ -220,6 +220,16 @@ pr14265: pr14265.o
 pr14265.stdout: pr14265
        $(TEST_NM) --format=bsd --numeric-sort $< > $@
 
+check_SCRIPTS += pr20717.sh
+check_DATA += pr20717.stdout
+MOSTLYCLEANFILES += pr20717
+pr20717.o: pr20717.c
+       $(COMPILE) -O0 -ffunction-sections -c -o $@ $<
+pr20717: pr20717.o gcctestdir/ld $(srcdir)/pr20717.t
+       $(LINK) -Bgcctestdir/ -Wl,--gc-sections -Wl,-T,$(srcdir)/pr20717.t -o $@ $<
+pr20717.stdout: pr20717
+       $(TEST_NM) $< > $@
+
 check_SCRIPTS += gc_dynamic_list_test.sh
 check_DATA += gc_dynamic_list_test.stdout
 MOSTLYCLEANFILES += gc_dynamic_list_test
index a1d8b396ffd903553ef815184379ae4407f2d443..1a535ed7523591080f04a29d887f48700b2dd3f8 100644 (file)
@@ -77,7 +77,7 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_2 = incremental_test.sh \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ gc_comdat_test.sh gc_tls_test.sh \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ gc_orphan_section_test.sh \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ pr14265.sh \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ pr14265.sh pr20717.sh \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ gc_dynamic_list_test.sh \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ icf_test.sh \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ icf_keep_unique_test.sh \
@@ -96,7 +96,7 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ gc_comdat_test.stdout \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ gc_tls_test.stdout \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ gc_orphan_section_test.stdout \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ pr14265.stdout \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ pr14265.stdout pr20717.stdout \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ gc_dynamic_list_test.stdout \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ icf_test.map \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ icf_keep_unique_test.stdout \
@@ -121,8 +121,8 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_test.cmdline \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ gc_comdat_test gc_tls_test \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ gc_orphan_section_test pr14265 \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ gc_dynamic_list_test icf_test \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ icf_test.map \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ pr20717 gc_dynamic_list_test \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ icf_test icf_test.map \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ icf_keep_unique_test \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ icf_safe_test icf_safe_test.map \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ icf_safe_so_test \
@@ -5027,6 +5027,8 @@ gc_orphan_section_test.sh.log: gc_orphan_section_test.sh
        @p='gc_orphan_section_test.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
 pr14265.sh.log: pr14265.sh
        @p='pr14265.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
+pr20717.sh.log: pr20717.sh
+       @p='pr20717.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
 gc_dynamic_list_test.sh.log: gc_dynamic_list_test.sh
        @p='gc_dynamic_list_test.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
 icf_test.sh.log: icf_test.sh
@@ -5802,6 +5804,12 @@ uninstall-am:
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ $(LINK) -Bgcctestdir/ -Wl,--gc-sections -Wl,-T,$(srcdir)/pr14265.t -o $@ $<
 @GCC_TRUE@@NATIVE_LINKER_TRUE@pr14265.stdout: pr14265
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_NM) --format=bsd --numeric-sort $< > $@
+@GCC_TRUE@@NATIVE_LINKER_TRUE@pr20717.o: pr20717.c
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(COMPILE) -O0 -ffunction-sections -c -o $@ $<
+@GCC_TRUE@@NATIVE_LINKER_TRUE@pr20717: pr20717.o gcctestdir/ld $(srcdir)/pr20717.t
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(LINK) -Bgcctestdir/ -Wl,--gc-sections -Wl,-T,$(srcdir)/pr20717.t -o $@ $<
+@GCC_TRUE@@NATIVE_LINKER_TRUE@pr20717.stdout: pr20717
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_NM) $< > $@
 @GCC_TRUE@@NATIVE_LINKER_TRUE@gc_dynamic_list_test.o: gc_dynamic_list_test.c
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ $(COMPILE) -c -ffunction-sections -o $@ $<
 @GCC_TRUE@@NATIVE_LINKER_TRUE@gc_dynamic_list_test: gc_dynamic_list_test.o gcctestdir/ld $(srcdir)/gc_dynamic_list_test.t
diff --git a/gold/testsuite/pr20717.c b/gold/testsuite/pr20717.c
new file mode 100644 (file)
index 0000000..d571916
--- /dev/null
@@ -0,0 +1,3 @@
+void unused(void);
+void unused(void) {}
+int main(void) {return 0;}
diff --git a/gold/testsuite/pr20717.sh b/gold/testsuite/pr20717.sh
new file mode 100755 (executable)
index 0000000..f7ab1a4
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+# pr20717.sh -- test --gc-sections for an unused orphan section
+# when the last section in the linker script has a KEEP statement.
+
+# Copyright (C) 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.
+
+
+check()
+{
+    file=$1
+    pattern=$2
+    if grep -q "$pattern" "$file"
+    then
+        echo "Garbage collection failed to collect :"
+        echo "   $pattern"
+       exit 1
+    fi
+}
+
+check pr20717.stdout "unused"
+
diff --git a/gold/testsuite/pr20717.t b/gold/testsuite/pr20717.t
new file mode 100644 (file)
index 0000000..ddb3500
--- /dev/null
@@ -0,0 +1,4 @@
+SECTIONS
+{
+    .dummy : { KEEP (*(.dummy)) }
+}
This page took 0.03654 seconds and 4 git commands to generate.