aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2009-12-31 03:48:46 +0000
committerIan Lance Taylor <ian@airs.com>2009-12-31 03:48:46 +0000
commitd7bb5745008bb111becc3dc87e7ce243f59b7170 (patch)
tree90278a6e9c9daca6652c0e8c90ddfc77ef9accee /gold/script.cc
parent PR 10931 (diff)
downloadbinutils-gdb-d7bb5745008bb111becc3dc87e7ce243f59b7170.tar.gz
binutils-gdb-d7bb5745008bb111becc3dc87e7ce243f59b7170.tar.bz2
binutils-gdb-d7bb5745008bb111becc3dc87e7ce243f59b7170.zip
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.
Diffstat (limited to 'gold/script.cc')
-rw-r--r--gold/script.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/gold/script.cc b/gold/script.cc
index fb1b2e111fd..53919e6b016 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;