diff options
author | Nick Clifton <nickc@redhat.com> | 2010-06-09 14:14:18 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2010-06-09 14:14:18 +0000 |
commit | e1df38aad4ef1b435dd84ca885523d3014a09e62 (patch) | |
tree | c78fb34890de33e3dea0541b6d8ed8ce41cc32e7 /gold/script.cc | |
parent | f0b3dbfc47e96c4c0dfabb010e34923dedfaae87 (diff) | |
download | binutils-gdb-e1df38aad4ef1b435dd84ca885523d3014a09e62.tar.gz |
* yyscript.y (input_list_element): Allow strings prefixed with
the '-' character. Treat these as libraries.
* script.cc (script_add_library): New function. Adds a library
specified by "-l<name>" found in an input script.
* script-c.h: Add prototype for script_add_library.
Diffstat (limited to 'gold/script.cc')
-rw-r--r-- | gold/script.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gold/script.cc b/gold/script.cc index fc036bbdaed..2cdaae6384e 100644 --- a/gold/script.cc +++ b/gold/script.cc @@ -2593,6 +2593,24 @@ script_add_file(void* closurev, const char* name, size_t length) closure->inputs()->add_file(file); } +// Called by the bison parser to add a library to the link. + +extern "C" void +script_add_library(void* closurev, const char* name, size_t length) +{ + Parser_closure* closure = static_cast<Parser_closure*>(closurev); + std::string name_string(name, length); + + if (name_string[0] != 'l') + gold_error(_("library name must be prefixed with -l")); + + Input_file_argument file(name_string.c_str() + 1, + Input_file_argument::INPUT_FILE_TYPE_LIBRARY, + "", false, + closure->position_dependent_options()); + closure->inputs()->add_file(file); +} + // Called by the bison parser to start a group. If we are already in // a group, that means that this script was invoked within a // --start-group --end-group sequence on the command line, or that |