aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2007-09-21 05:43:33 +0000
committerIan Lance Taylor <iant@google.com>2007-09-21 05:43:33 +0000
commitca3a67a5cf313a093f28624258b1fd2201d1835e (patch)
tree9440662bfedcd3f321dd8928a24bafd1e344ee7c
parentc51e6221b8abc026554349b0e8aa59477753b57b (diff)
downloadgdb-ca3a67a5cf313a093f28624258b1fd2201d1835e.zip
gdb-ca3a67a5cf313a093f28624258b1fd2201d1835e.tar.gz
gdb-ca3a67a5cf313a093f28624258b1fd2201d1835e.tar.bz2
From Craig Silverstein: Add -O option.
-rw-r--r--gold/options.cc4
-rw-r--r--gold/options.h11
2 files changed, 15 insertions, 0 deletions
diff --git a/gold/options.cc b/gold/options.cc
index fc3d7c6..2f83e10 100644
--- a/gold/options.cc
+++ b/gold/options.cc
@@ -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),
diff --git a/gold/options.h b/gold/options.h
index f1f21e0..1d0232e 100644
--- a/gold/options.h
+++ b/gold/options.h
@@ -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
@@ -110,6 +116,10 @@ class General_options
{ 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_;