This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
gold patch committed: Don't crash if script has no room for headers
- From: Ian Lance Taylor <iant at google dot com>
- To: binutils at sourceware dot org
- Date: Thu, 15 Oct 2009 22:17:20 -0700
- Subject: gold patch committed: Don't crash if script has no room for headers
If a linker script has no room for the program headers for the first
section, gold would crash in an assertion. The assertion is correct
when not using a linker script, but with a script all bets are off. I
committed this patch to adjust the assertion.
Ian
2009-10-15 Ian Lance Taylor <iant@google.com>
* layout.cc (Layout::relaxation_loop_body): Don't crash if we see
program headers with no load segment if there is a linker script.
Index: layout.cc
===================================================================
RCS file: /cvs/src/src/gold/layout.cc,v
retrieving revision 1.141
diff -p -u -r1.141 layout.cc
--- layout.cc 16 Oct 2009 05:00:28 -0000 1.141
+++ layout.cc 16 Oct 2009 05:15:04 -0000
@@ -1421,7 +1421,9 @@ Layout::relaxation_loop_body(
!= General_options::OBJECT_FORMAT_ELF)
load_seg = NULL;
- gold_assert(phdr_seg == NULL || load_seg != NULL);
+ gold_assert(phdr_seg == NULL
+ || load_seg != NULL
+ || this->script_options_->saw_sections_clause());
// Lay out the segment headers.
if (!parameters->options().relocatable())