+2015-07-20 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR gold/18689
+ * layout.cc (Layout::layout): Clear the SHF_COMPRESSED flag bit
+ from input group section for relocatable link.
+ * testsuite/Makefile.am (check_SCRIPTS): Add pr18689.sh.
+ (check_DATA): Add pr18689.stdout.
+ (MOSTLYCLEANFILES): Add pr18689a.o pr18689b.o.
+ (pr18689.stdout): New rule.
+ (pr18689a.o): Likewise.
+ (pr18689b.o): Likewise.
+ (pr18689.o): Likewise.
+ * testsuite/pr18689.c: New file.
+ * testsuite/pr18689.sh: Likewise.
+ * testsuite/Makefile.in: Regenerated.
+
2015-07-20 Yiran Wang <yiran@google.com>
Cary Coutant <ccoutant@gmail.com>
if (parameters->options().relocatable()
&& (shdr.get_sh_flags() & elfcpp::SHF_GROUP) != 0)
{
+ // Some flags in the input section should not be automatically
+ // copied to the output section.
+ elfcpp::Elf_Xword flags = (shdr.get_sh_flags()
+ & ~ elfcpp::SHF_COMPRESSED);
name = this->namepool_.add(name, true, NULL);
- os = this->make_output_section(name, sh_type, shdr.get_sh_flags(),
+ os = this->make_output_section(name, sh_type, flags,
ORDER_INVALID, false);
}
else
chmod a+x $@
test -s $@
+check_SCRIPTS += pr18689.sh
+check_DATA += pr18689.stdout
+MOSTLYCLEANFILES += pr18689a.o pr18689b.o
+
+pr18689.stdout: pr18689b.o
+ $(TEST_READELF) -SW $< > $@
+
+pr18689a.o: pr18689.o ../ld-new
+ ../ld-new -r -o $@ $<
+
+pr18689b.o: pr18689a.o ../ld-new
+ ../ld-new -r -o $@ $<
+
+pr18689.o: pr18689.c gcctestdir/as
+ $(COMPILE) -Bgcctestdir/ -ggdb3 -g -Wa,--compress-debug-sections=zlib-gabi -c -w -o $@ $(srcdir)/pr18689.c
+
# Test -TText and -Tdata.
check_PROGRAMS += flagstest_o_ttext_1
flagstest_o_ttext_1: flagstest_debug.o gcctestdir/ld
@GCC_TRUE@@NATIVE_LINKER_TRUE@ debug_msg_cdebug_gabi.err \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ debug_msg_so.err \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ debug_msg_ndebug.err \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ undef_symbol.err \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ flagstest_o_ttext_2 \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ undef_symbol.err pr18689a.o \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ pr18689b.o flagstest_o_ttext_2 \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_11.a protected_3.err \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ justsyms_lib binary.txt \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_matching_test.stdout \
# and --dynamic-list-cpp-typeinfo
@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_35 = debug_msg.sh \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ missing_key_func.sh \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ undef_symbol.sh ver_test_1.sh \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_2.sh ver_test_4.sh \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_5.sh ver_test_7.sh \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_10.sh relro_test.sh \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ undef_symbol.sh pr18689.sh \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_1.sh ver_test_2.sh \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_4.sh ver_test_5.sh \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_7.sh ver_test_10.sh \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ relro_test.sh \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_matching_test.sh \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_3.sh \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_4.sh \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ flagstest_compress_debug_sections_gabi.stdout \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ flagstest_compress_debug_sections_gabi.cmp \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ flagstest_compress_debug_sections_gabi.check \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ pr18689.stdout \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ flagstest_o_ttext_2 \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_1.syms ver_test_2.syms \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_4.syms ver_test_5.syms \
@p='missing_key_func.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
undef_symbol.sh.log: undef_symbol.sh
@p='undef_symbol.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
+pr18689.sh.log: pr18689.sh
+ @p='pr18689.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
ver_test_1.sh.log: ver_test_1.sh
@p='ver_test_1.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
ver_test_2.sh.log: ver_test_2.sh
@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Bgcctestdir/ -o /dev/stdout $< -Wl,--compress-debug-sections=zlib 2>&1 | cat > $@
@GCC_TRUE@@NATIVE_LINKER_TRUE@ chmod a+x $@
@GCC_TRUE@@NATIVE_LINKER_TRUE@ test -s $@
+
+@GCC_TRUE@@NATIVE_LINKER_TRUE@pr18689.stdout: pr18689b.o
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_READELF) -SW $< > $@
+
+@GCC_TRUE@@NATIVE_LINKER_TRUE@pr18689a.o: pr18689.o ../ld-new
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ ../ld-new -r -o $@ $<
+
+@GCC_TRUE@@NATIVE_LINKER_TRUE@pr18689b.o: pr18689a.o ../ld-new
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ ../ld-new -r -o $@ $<
+
+@GCC_TRUE@@NATIVE_LINKER_TRUE@pr18689.o: pr18689.c gcctestdir/as
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(COMPILE) -Bgcctestdir/ -ggdb3 -g -Wa,--compress-debug-sections=zlib-gabi -c -w -o $@ $(srcdir)/pr18689.c
@GCC_TRUE@@NATIVE_LINKER_TRUE@flagstest_o_ttext_1: flagstest_debug.o gcctestdir/ld
@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,-Ttext,0x400000 -Wl,-Tdata,0x800000
@GCC_TRUE@@NATIVE_LINKER_TRUE@flagstest_o_ttext_2: flagstest_debug.o gcctestdir/ld
--- /dev/null
+#!/bin/sh
+
+# pr18689.sh -- a test case for compressed .debug_macro sections.
+
+# Copyright (C) 2015 Free Software Foundation, Inc.
+
+# 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.
+
+set -e
+
+egrep -q "..debug_macro[ ]+*" pr18689.stdout
+
+exit 0