This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] PR gold/18689: Building perf fails with ld: fatal error: No space left on device


On Mon, Jul 20, 2015 at 9:27 AM, Cary Coutant <ccoutant@gmail.com> wrote:
>>>         PR gold/18689
>>>         * layout.cc (Layout::layout): Clear the SHF_COMPRESSED flag bit
>>>         from input group section for relocatable link.
>
> This is OK. Thanks!
>

I added a testcase.  This is what I checked in.

Thanks.

-- 
H.J.
From d0b07300cb88e3190cbcfd08a9052ca28521d60f Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Thu, 16 Jul 2015 15:07:19 -0700
Subject: [PATCH] Clear SHF_COMPRESSED flag bit from input to output

For relocatable link, we should clear the SHF_COMPRESSED flag bit from
input group section.

	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.
---
 gold/layout.cc             |  6 +++++-
 gold/testsuite/Makefile.am | 16 ++++++++++++++++
 gold/testsuite/Makefile.in | 28 ++++++++++++++++++++++------
 gold/testsuite/pr18689.c   |  1 +
 gold/testsuite/pr18689.sh  | 28 ++++++++++++++++++++++++++++
 5 files changed, 72 insertions(+), 7 deletions(-)
 create mode 100644 gold/testsuite/pr18689.c
 create mode 100755 gold/testsuite/pr18689.sh

diff --git a/gold/layout.cc b/gold/layout.cc
index 142fd90..b454c10 100644
--- a/gold/layout.cc
+++ b/gold/layout.cc
@@ -1160,8 +1160,12 @@ Layout::layout(Sized_relobj_file<size, big_endian>* object, unsigned int shndx,
   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
diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am
index cf56c32..4b00273 100644
--- a/gold/testsuite/Makefile.am
+++ b/gold/testsuite/Makefile.am
@@ -1424,6 +1424,22 @@ flagstest_o_specialfile_and_compress_debug_sections: flagstest_debug.o \
 	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
diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in
index fc10639..720558b 100644
--- a/gold/testsuite/Makefile.in
+++ b/gold/testsuite/Makefile.in
@@ -280,8 +280,8 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
 @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 \
@@ -323,10 +323,11 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
 # 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 \
@@ -365,6 +366,7 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
 @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 \
@@ -4414,6 +4416,8 @@ missing_key_func.sh.log: missing_key_func.sh
 	@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
@@ -5675,6 +5679,18 @@ uninstall-am:
 @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
diff --git a/gold/testsuite/pr18689.c b/gold/testsuite/pr18689.c
new file mode 100644
index 0000000..9d841c9
--- /dev/null
+++ b/gold/testsuite/pr18689.c
@@ -0,0 +1 @@
+/* Dummy file.  */
diff --git a/gold/testsuite/pr18689.sh b/gold/testsuite/pr18689.sh
new file mode 100755
index 0000000..822ed11
--- /dev/null
+++ b/gold/testsuite/pr18689.sh
@@ -0,0 +1,28 @@
+#!/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
-- 
2.4.3


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]