From d7bb5745008bb111becc3dc87e7ce243f59b7170 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Thu, 31 Dec 2009 03:48:46 +0000 Subject: 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. --- gold/script.cc | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'gold/script.cc') diff --git a/gold/script.cc b/gold/script.cc index fb1b2e1..53919e6 100644 --- a/gold/script.cc +++ b/gold/script.cc @@ -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; -- cgit v1.1