From ca3a67a5cf313a093f28624258b1fd2201d1835e Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 21 Sep 2007 05:43:33 +0000 Subject: [PATCH] From Craig Silverstein: Add -O option. --- gold/options.cc | 4 ++++ gold/options.h | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/gold/options.cc b/gold/options.cc index fc3d7c66b23..2f83e10c339 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 f1f21e041fd..1d0232e3684 100644 --- a/gold/options.h +++ b/gold/options.h @@ -12,6 +12,7 @@ #ifndef GOLD_OPTIONS_H #define GOLD_OPTIONS_H +#include #include #include #include @@ -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_; -- 2.30.2