Report linker script errors with line numbers. Ignore OUTPUT_FORMAT

with three arguments, and ignore OUTPUT_ARCH.
This commit is contained in:
Ian Lance Taylor
2008-01-07 05:19:02 +00:00
parent d4e917ea7f
commit 2dd3e587bd
5 changed files with 62 additions and 32 deletions

View File

@@ -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.