[GOLD] assertion on more than one PT_NOTE
Alan Modra
amodra@gmail.com
Sun Apr 21 23:24:00 GMT 2013
On Mon, Apr 15, 2013 at 11:20:56PM -0700, Ian Lance Taylor wrote:
> On Sun, Apr 14, 2013 at 11:30 PM, Alan Modra <amodra@gmail.com> wrote:
> > I see no reason why an executable should be limited to one PT_NOTE
> > header. This patch removes that limitation in gold.
> >
> > As far as I can see there is no code in gold that needs segments to be
> > unique like this. OK to apply?
> >
> > PR gold/15355
> > * layout.cc (Layout::segment_precedes): Allow more than one
> > segment with the same type and flags.
>
> This should only happen when using a linker script. Otherwise
> something is wrong. So I would rather see something like this:
> gold_assert(flags1 != flags2 ||
> this->script_options_->saw_phdrs_clause());
>
> That patch is OK if it works.
Committed.
Index: gold/layout.cc
===================================================================
RCS file: /cvs/src/src/gold/layout.cc,v
retrieving revision 1.249
diff -u -p -r1.249 layout.cc
--- gold/layout.cc 15 Apr 2013 16:40:59 -0000 1.249
+++ gold/layout.cc 21 Apr 2013 23:17:17 -0000
@@ -3175,12 +3175,14 @@ Layout::segment_precedes(const Output_se
// The order of non-PT_LOAD segments is unimportant. We simply sort
// by the numeric segment type and flags values. There should not
- // be more than one segment with the same type and flags.
+ // be more than one segment with the same type and flags, except
+ // when a linker script specifies such.
if (type1 != elfcpp::PT_LOAD)
{
if (type1 != type2)
return type1 < type2;
- gold_assert(flags1 != flags2);
+ gold_assert(flags1 != flags2
+ || this->script_options_->saw_phdrs_clause());
return flags1 < flags2;
}
--
Alan Modra
Australia Development Lab, IBM
More information about the Binutils
mailing list