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]

gold patch committed: Don't crash on duplicate --section-start


PR 13204 points out that using a duplicate --section-start causes an
assertion failure in gold.  This patch fixes the problem.  The test case
now fails with an error rather than a crash.  Committed to mainline.

Ian



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.
	* options.h (General_options::any_section_start): New function.
Index: layout.cc
===================================================================
RCS file: /cvs/src/src/gold/layout.cc,v
retrieving revision 1.221
diff -u -u -p -r1.221 layout.cc
--- layout.cc	29 Sep 2011 23:45:57 -0000	1.221
+++ layout.cc	19 Oct 2011 15:04:03 -0000
@@ -2976,8 +2976,9 @@ Layout::segment_precedes(const Output_se
 
   // We shouldn't get here--we shouldn't create segments which we
   // can't distinguish.  Unless of course we are using a weird linker
-  // script.
-  gold_assert(this->script_options_->saw_phdrs_clause());
+  // script or overlapping --section-start options.
+  gold_assert(this->script_options_->saw_phdrs_clause()
+	      || parameters->options().any_section_start());
   return false;
 }
 
Index: options.h
===================================================================
RCS file: /cvs/src/src/gold/options.h,v
retrieving revision 1.169
diff -u -u -p -r1.169 options.h
--- options.h	15 Jul 2011 21:43:08 -0000	1.169
+++ options.h	19 Oct 2011 15:04:03 -0000
@@ -1381,6 +1381,11 @@ class General_options
   bool
   section_start(const char* secname, uint64_t* paddr) const;
 
+  // Return whether any --section-start option was used.
+  bool
+  any_section_start() const
+  { return !this->section_starts_.empty(); }
+
   enum Fix_v4bx
   {
     // Leave original instruction.

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