gold patch committed: Don't try to handle a late SECTIONS clause

Ian Lance Taylor iant@google.com
Thu Dec 31 03:51:00 GMT 2009


PR 10979 shows a gold error building arj.  It turns out that arj
passes in a linker script as an input file.  The linker script
is just

SECTIONS
{
 /DISCARD/ : { *(.comment) *(.note) *(.stab) *(.stabstr) }
}

The problem is that once gold sees a SECTIONS clause, it more or less
has to go through the linker script processing.  When it sees a
SECTIONS clause in an input file, it has already handled crt1.o and
friends.  That fails, because they require special handling when using
a linker script.

I thought about different ways to tackle this, but I finally decided
to simply forbid it.  I committed this patch to give a sensible error
for this case, rather than simply crashing.

Ian


2009-12-30  Ian Lance Taylor  <iant@google.com>

	PR 10979
	* script.cc (read_input_script): If we see a new SECTIONS clause,
	and we have added an input section, give an error.
	* layout.h (class Layout): Add have_added_input_section function.
	Add have_added_input_section_ field.
	* layout.cc (Layout::Layout): Initialize
	have_added_input_section_.
	(Layout::layout): Set have_added_input_section_.
	(Layout::layout_eh_frame): Likewise.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo.patch
Type: text/x-diff
Size: 3160 bytes
Desc: SECTIONS
URL: <https://sourceware.org/pipermail/binutils/attachments/20091231/95a9381b/attachment.bin>


More information about the Binutils mailing list