forked from Imagelibrary/binutils-gdb
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.
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user