From bba037e0aef1f3b17cc6cf6fd041ed6110cc375a Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Thu, 22 Oct 2015 12:17:43 -0700 Subject: Always keep sections marked with SEC_KEEP SEC_KEEP check in elf_gc_sweep was missing in commit: commit bde6f3eb6dff94cea1d471e15c6154d55d49820f Author: H.J. Lu Date: Fri Jan 8 01:43:23 2010 +0000 Set SEC_KEEP on section XXX for undefined __start_XXX/__stop_XXX bfd/ 2010-01-07 H.J. Lu PR ld/11133 * elflink.c (_bfd_elf_gc_mark_hook): Check section XXX for undefined __start_XXX/__stop_XXX in all input files and set SEC_KEEP. This patch adds SEC_KEEP check to elf_gc_sweep. bfd/ PR ld/19161 * elflink.c (elf_gc_sweep): Always keep sections marked with SEC_KEEP. ld/testsuite/ PR ld/19161 * ld-gc/gc.exp: Run pr19161 test. * ld-gc/pr19161-1.c: New file. * ld-gc/pr19161-2.c: Likewise. * ld-gc/pr19161.d: Likewise. --- ld/testsuite/ld-gc/gc.exp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'ld/testsuite/ld-gc/gc.exp') diff --git a/ld/testsuite/ld-gc/gc.exp b/ld/testsuite/ld-gc/gc.exp index b2a3450..f7438d4 100644 --- a/ld/testsuite/ld-gc/gc.exp +++ b/ld/testsuite/ld-gc/gc.exp @@ -139,3 +139,9 @@ if { [is_remote host] || [which $CC] != 0 } { ld_compile "$CC $CFLAGS $cflags" $srcdir/$subdir/pr14265.c tmpdir/pr14265.o run_dump_test "pr14265" } + +if { [is_remote host] || [which $CC] != 0 } { + ld_compile "$CC $CFLAGS $cflags -O0" $srcdir/$subdir/pr19161-1.c tmpdir/pr19161-1.o + ld_compile "$CC $CFLAGS $cflags -O0" $srcdir/$subdir/pr19161-2.c tmpdir/pr19161-2.o + run_dump_test "pr19161" +} -- cgit v1.1