aboutsummaryrefslogtreecommitdiff
path: root/gold/script.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2008-01-07 05:19:02 +0000
committerIan Lance Taylor <iant@google.com>2008-01-07 05:19:02 +0000
commit2dd3e587bdab39d73086c35be60399e096d48b46 (patch)
treee2b7630d5eceec2576855673cf33948b62a18caf /gold/script.cc
parentd4e917ea7f50bef2b4f15c1c83aac2a7f58e42e7 (diff)
downloadgdb-2dd3e587bdab39d73086c35be60399e096d48b46.zip
gdb-2dd3e587bdab39d73086c35be60399e096d48b46.tar.gz
gdb-2dd3e587bdab39d73086c35be60399e096d48b46.tar.bz2
Report linker script errors with line numbers. Ignore OUTPUT_FORMAT
with three arguments, and ignore OUTPUT_ARCH.
Diffstat (limited to 'gold/script.cc')
-rw-r--r--gold/script.cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/gold/script.cc b/gold/script.cc
index 775aedf..2b14e3f 100644
--- a/gold/script.cc
+++ b/gold/script.cc
@@ -881,7 +881,7 @@ class Parser_closure
at_eof() const
{ return this->next_token_index_ >= this->tokens_->size(); }
- // Return the next token.
+ // Return the next token, and advance.
const Token*
next_token()
{
@@ -890,6 +890,14 @@ class Parser_closure
return ret;
}
+ // Return the previous token.
+ const Token*
+ last_token() const
+ {
+ gold_assert(this->next_token_index_ > 0);
+ return &(*this->tokens_)[this->next_token_index_ - 1];
+ }
+
// Return the list of input files, creating it if necessary. This
// is a space leak--we never free the INPUTS_ pointer.
Input_arguments*
@@ -1240,7 +1248,9 @@ yyerror(void* closurev, const char* message)
{
Parser_closure* closure = static_cast<Parser_closure*>(closurev);
- gold_error(_("%s: %s"), closure->filename(), message);
+ const Token* token = closure->last_token();
+ gold_error(_("%s:%d:%d: %s"), closure->filename(), token->lineno(),
+ token->charpos(), message);
}
// Called by the bison parser to add a file to the link.