diff options
author | Ian Lance Taylor <iant@google.com> | 2008-02-26 22:48:08 +0000 |
---|---|---|
committer | Ian Lance Taylor <iant@google.com> | 2008-02-26 22:48:08 +0000 |
commit | a5dc07065554d074ae0452b388cd9c80b2bc6504 (patch) | |
tree | ce2d8d5be0590dbf264053db8996e684b2fd26db /gold/script.cc | |
parent | 5daa78cc6fc04e0367c11459bb2ae0531c8732ac (diff) | |
download | gdb-a5dc07065554d074ae0452b388cd9c80b2bc6504.zip gdb-a5dc07065554d074ae0452b388cd9c80b2bc6504.tar.gz gdb-a5dc07065554d074ae0452b388cd9c80b2bc6504.tar.bz2 |
From Craig Silverstein: rework handling of Script_options.
Diffstat (limited to 'gold/script.cc')
-rw-r--r-- | gold/script.cc | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/gold/script.cc b/gold/script.cc index faa1cda..c7b26ef 100644 --- a/gold/script.cc +++ b/gold/script.cc @@ -1437,7 +1437,7 @@ read_script_file(const char* filename, Command_line* cmdline, false, input_file.is_in_sysroot(), cmdline, - cmdline->script_options(), + &cmdline->script_options(), &lex); if (yyparse(&closure) != 0) { @@ -2111,8 +2111,11 @@ script_end_as_needed(void* closurev) extern "C" void script_set_entry(void* closurev, const char* entry, size_t length) { - Parser_closure* closure = static_cast<Parser_closure*>(closurev); - closure->script_options()->set_entry(entry, length); + // We'll parse this exactly the same as --entry=ENTRY on the commandline + // TODO(csilvers): FIXME -- call set_entry directly. + std::string arg("entry="); + arg.append(entry, length); + script_parse_option(closurev, arg.c_str(), arg.size()); } // Called by the bison parser to define a symbol. @@ -2161,7 +2164,9 @@ script_parse_option(void* closurev, const char* option, size_t length) gold_assert(mutable_option != NULL); closure->command_line()->process_one_option(1, &mutable_option, 0, &past_a_double_dash_option); - free(mutable_option); + // The General_options class will quite possibly store a pointer + // into mutable_option, so we can't free it. In cases the class + // does not store such a pointer, this is a memory leak. Alas. :( } } |