Index: gold/script-c.h =================================================================== RCS file: /cvs/src/src/gold/script-c.h,v retrieving revision 1.17 diff -c -3 -p -r1.17 script-c.h *** gold/script-c.h 9 Apr 2010 17:32:58 -0000 1.17 --- gold/script-c.h 8 Jun 2010 11:46:22 -0000 *************** script_add_extern(void* closure, const c *** 236,241 **** --- 236,246 ---- extern void script_add_file(void* closure, const char*, size_t); + /* Called by the bison parser to add a library to the link. */ + + extern void + script_add_library(void* closure, const char*, size_t); + /* Called by the bison parser to start and stop a group. */ extern void Index: gold/script.cc =================================================================== RCS file: /cvs/src/src/gold/script.cc,v retrieving revision 1.72 diff -c -3 -p -r1.72 script.cc *** gold/script.cc 18 May 2010 18:08:03 -0000 1.72 --- gold/script.cc 8 Jun 2010 11:46:22 -0000 *************** script_add_file(void* closurev, const ch *** 2593,2598 **** --- 2593,2616 ---- 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(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 Index: gold/yyscript.y =================================================================== RCS file: /cvs/src/src/gold/yyscript.y,v retrieving revision 1.23 diff -c -3 -p -r1.23 yyscript.y *** gold/yyscript.y 9 Apr 2010 17:32:58 -0000 1.23 --- gold/yyscript.y 8 Jun 2010 11:46:22 -0000 *************** input_list: *** 320,325 **** --- 320,327 ---- input_list_element: string { script_add_file(closure, $1.value, $1.length); } + | '-' STRING + { script_add_library(closure, $2.value, $2.length); } | AS_NEEDED { script_start_as_needed(closure); } '(' input_list ')'