This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
gold patch committed: Create output section if script assigns to dot
- From: Ian Lance Taylor <iant at google dot com>
- To: Binutils <binutils at sourceware dot org>
- Date: Wed, 19 Oct 2011 08:53:00 -0700
- Subject: gold patch committed: Create output section if script assigns to dot
PR 13163 is about a test case in which a linker script creates a section which
contains nothing but an assignment to dot. That is enough to cause the GNU
linker to create the output section, but gold was not doing so. This
later led to
a crash in gold. This patch fixes the problem by creating an output
section which
does an assignment to dot. Committed to mainline.
Ian
2011-10-19 Ian Lance Taylor <iant@google.com>
PR gold/13163
* script-sections.cc
(Output_section_element_dot_assignment::needs_output_section): New
function.
Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/gold/ChangeLog,v
retrieving revision 1.843
diff -u -u -p -r1.843 ChangeLog
--- ChangeLog 19 Oct 2011 15:05:58 -0000 1.843
+++ ChangeLog 19 Oct 2011 15:50:07 -0000
@@ -1,5 +1,12 @@
2011-10-19 Ian Lance Taylor <iant@google.com>
+ PR gold/13163
+ * script-sections.cc
+ (Output_section_element_dot_assignment::needs_output_section): New
+ function.
+
+2011-10-19 Ian Lance Taylor <iant@google.com>
+
PR gold/13204
* layout.cc (Layout::segment_precedes): Don't assert failure if a
--section-start option was seen.
Index: script-sections.cc
===================================================================
RCS file: /cvs/src/src/gold/script-sections.cc,v
retrieving revision 1.53
diff -u -u -p -r1.53 script-sections.cc
--- script-sections.cc 29 Jun 2011 00:39:54 -0000 1.53
+++ script-sections.cc 19 Oct 2011 15:50:07 -0000
@@ -892,6 +892,12 @@ class Output_section_element_dot_assignm
: val_(val)
{ }
+ // An assignment to dot within an output section is enough to force
+ // the output section to exist.
+ bool
+ needs_output_section() const
+ { return true; }
+
// Finalize the symbol.
void
finalize_symbols(Symbol_table* symtab, const Layout* layout,