* 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.
This commit is contained in:
Ian Lance Taylor
2009-12-31 03:48:46 +00:00
parent fc59c57250
commit d7bb574500
4 changed files with 31 additions and 0 deletions

View File

@@ -1398,6 +1398,9 @@ read_input_script(Workqueue* workqueue, Symbol_table* symtab, Layout* layout,
&lex,
input_file->will_search_for());
bool old_saw_sections_clause =
layout->script_options()->saw_sections_clause();
if (yyparse(&closure) != 0)
{
if (closure.found_incompatible_target())
@@ -1411,6 +1414,12 @@ read_input_script(Workqueue* workqueue, Symbol_table* symtab, Layout* layout,
return false;
}
if (!old_saw_sections_clause
&& layout->script_options()->saw_sections_clause()
&& layout->have_added_input_section())
gold_error(_("%s: SECTIONS seen after other input files; try -T/--script"),
input_file->filename().c_str());
if (!closure.saw_inputs())
return true;