public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [gold patch] Fix incremental linking when input files have compressed debug sections
@ 2011-06-09 18:03 Cary Coutant
  2011-06-09 18:12 ` Ian Lance Taylor
  0 siblings, 1 reply; 2+ messages in thread
From: Cary Coutant @ 2011-06-09 18:03 UTC (permalink / raw)
  To: Binutils, Ian Lance Taylor

With compressed debug sections in the input file, the linker was
storing the compressed size of the section in the incremental info
instead of the uncompressed size. This patch fixes that, and also adds
a check to disallow the use of the linker's --compress-debug-sections
option when doing incremental linking.

OK?

-cary


2011-06-09  Cary Coutant  <ccoutant@google.com>

	* gold/gold.cc (queue_initial_tasks): Warn if --incremental is
	used with --compress-debug-sections.
	* gold/object.cc (Sized_relobj_file::do_layout): Report
	uncompressed size of compressed input sections.
	

commit ceffdcabd8e3803341a09b6ed4205cf23f472bb1
Author: Cary Coutant <ccoutant@google.com>
Date:   Thu Jun 9 10:52:04 2011 -0700

    Fix to record uncompressed sizes of compressed input sections.

diff --git a/gold/gold.cc b/gold/gold.cc
index 95c226c..f68ba3e 100644
--- a/gold/gold.cc
+++ b/gold/gold.cc
@@ -200,6 +200,9 @@ queue_initial_tasks(const General_options& options,
 	gold_error(_("incremental linking is incompatible with --icf"));
       if (options.has_plugins())
 	gold_error(_("incremental linking is incompatible with --plugin"));
+      if (strcmp(options.compress_debug_sections(), "none") != 0)
+	gold_error(_("incremental linking is incompatible with "
+		     "--compress-debug-sections"));

       if (parameters->incremental_update())
 	{
diff --git a/gold/object.cc b/gold/object.cc
index b14c85d..b51cbfe 100644
--- a/gold/object.cc
+++ b/gold/object.cc
@@ -1299,8 +1299,13 @@ Sized_relobj_file<size,
big_endian>::do_layout(Symbol_table* symtab,
 	      && (shdr.get_sh_type() == elfcpp::SHT_PROGBITS
 	          || shdr.get_sh_type() == elfcpp::SHT_NOBITS
 	          || shdr.get_sh_type() == elfcpp::SHT_NOTE))
-	    incremental_inputs->report_input_section(this, i, name,
-						     shdr.get_sh_size());
+	    {
+	      off_t sh_size = shdr.get_sh_size();
+	      section_size_type uncompressed_size;
+	      if (this->section_is_compressed(i, &uncompressed_size))
+		sh_size = uncompressed_size;
+	      incremental_inputs->report_input_section(this, i, name, sh_size);
+	    }

           if (discard)
             {

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [gold patch] Fix incremental linking when input files have compressed debug sections
  2011-06-09 18:03 [gold patch] Fix incremental linking when input files have compressed debug sections Cary Coutant
@ 2011-06-09 18:12 ` Ian Lance Taylor
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Lance Taylor @ 2011-06-09 18:12 UTC (permalink / raw)
  To: Cary Coutant; +Cc: Binutils

Cary Coutant <ccoutant@google.com> writes:

> 2011-06-09  Cary Coutant  <ccoutant@google.com>
>
> 	* gold/gold.cc (queue_initial_tasks): Warn if --incremental is
> 	used with --compress-debug-sections.
> 	* gold/object.cc (Sized_relobj_file::do_layout): Report
> 	uncompressed size of compressed input sections.

This is OK.

Thanks.

Ian

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-06-09 18:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-09 18:03 [gold patch] Fix incremental linking when input files have compressed debug sections Cary Coutant
2011-06-09 18:12 ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).