diff options
author | Igor Kudrin <ikudrin@accesssoftek.com> | 2016-12-11 20:31:09 -0800 |
---|---|---|
committer | Cary Coutant <ccoutant@gmail.com> | 2016-12-11 20:31:09 -0800 |
commit | cc90de49738ad220bd1d3d001b492679fc488fe1 (patch) | |
tree | a2518c2bb1abfe62b44f393eeb96e0d94799f898 | |
parent | 5d9f66cb84b9f228c1082d3a1037355edceddded (diff) | |
download | fsf-binutils-gdb-cc90de49738ad220bd1d3d001b492679fc488fe1.zip fsf-binutils-gdb-cc90de49738ad220bd1d3d001b492679fc488fe1.tar.gz fsf-binutils-gdb-cc90de49738ad220bd1d3d001b492679fc488fe1.tar.bz2 |
Fix earlier ChangeLog entry to give Igor credit, add testcases.
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.
-rw-r--r-- | gold/ChangeLog | 10 | ||||
-rw-r--r-- | gold/Makefile.in | 4 | ||||
-rw-r--r-- | gold/testsuite/Makefile.am | 10 | ||||
-rw-r--r-- | gold/testsuite/Makefile.in | 16 | ||||
-rw-r--r-- | gold/testsuite/pr20717.c | 3 | ||||
-rwxr-xr-x | gold/testsuite/pr20717.sh | 40 | ||||
-rw-r--r-- | gold/testsuite/pr20717.t | 4 |
7 files changed, 81 insertions, 6 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog index d129ddf..29c28f7 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -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 diff --git a/gold/Makefile.in b/gold/Makefile.in index 1e0578d..ebe2824 100644 --- a/gold/Makefile.in +++ b/gold/Makefile.in @@ -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 \ diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am index 6a0b19d..25db2b8 100644 --- a/gold/testsuite/Makefile.am +++ b/gold/testsuite/Makefile.am @@ -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 diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in index a1d8b39..1a535ed 100644 --- a/gold/testsuite/Makefile.in +++ b/gold/testsuite/Makefile.in @@ -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 index 0000000..d571916 --- /dev/null +++ b/gold/testsuite/pr20717.c @@ -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 index 0000000..f7ab1a4 --- /dev/null +++ b/gold/testsuite/pr20717.sh @@ -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 index 0000000..ddb3500 --- /dev/null +++ b/gold/testsuite/pr20717.t @@ -0,0 +1,4 @@ +SECTIONS +{ + .dummy : { KEEP (*(.dummy)) } +} |