From Craig Silverstein: Add -O option.

This commit is contained in:
Ian Lance Taylor 2007-09-21 05:43:33 +00:00
parent c51e6221b8
commit ca3a67a5cf
2 changed files with 15 additions and 0 deletions

View File

@ -244,6 +244,9 @@ options::Command_line_options::options[] =
&General_options::add_to_search_path),
GENERAL_ARG('m', NULL, N_("Ignored for compatibility"), NULL, ONE_DASH,
&General_options::ignore),
GENERAL_ARG('O', NULL, N_("Optimize output file size"),
N_("-O level"), ONE_DASH,
&General_options::set_optimization_level),
GENERAL_ARG('o', "output", N_("Set output file name"),
N_("-o FILE, --output FILE"), TWO_DASHES,
&General_options::set_output_file_name),
@ -289,6 +292,7 @@ General_options::General_options()
: export_dynamic_(false),
dynamic_linker_(NULL),
search_path_(),
optimization_level_(0),
output_file_name_("a.out"),
is_relocatable_(false),
create_eh_frame_hdr_(false),

View File

@ -12,6 +12,7 @@
#ifndef GOLD_OPTIONS_H
#define GOLD_OPTIONS_H
#include <cstdlib>
#include <list>
#include <string>
#include <vector>
@ -54,6 +55,11 @@ class General_options
search_path() const
{ return this->search_path_; }
// -O: optimization level (0: don't try to optimize output size).
int
optimization_level() const
{ return this->optimization_level_; }
// -o: Output file name.
const char*
output_file_name() const
@ -109,6 +115,10 @@ class General_options
add_to_search_path(const char* arg)
{ this->search_path_.push_back(arg); }
void
set_optimization_level(const char* arg)
{ this->optimization_level_ = atoi(arg); }
void
set_output_file_name(const char* arg)
{ this->output_file_name_ = arg; }
@ -144,6 +154,7 @@ class General_options
bool export_dynamic_;
const char* dynamic_linker_;
Dir_list search_path_;
int optimization_level_;
const char* output_file_name_;
bool is_relocatable_;
bool create_eh_frame_hdr_;