OBJECT_FORMAT_BINARY
};
- General_options(Script_options*);
+ General_options();
// -e: set entry address.
const char*
entry() const
- { return this->script_options_->entry(); }
+ { return this->entry_; }
// -E: export dynamic symbols.
bool
// -O: optimization level (0: don't try to optimize output size).
int
- optimization_level() const
+ optimize() const
{ return this->optimization_level_; }
// -o: Output file name.
// --oformat: Output format.
Object_format
- output_format() const
- { return this->output_format_; }
+ oformat() const
+ { return this->oformat_; }
// Return the default target.
Target*
// -r: Whether we are doing a relocatable link.
bool
- is_relocatable() const
+ relocatable() const
{ return this->is_relocatable_; }
// -s: Strip all symbols.
// -Bsymbolic: bind defined symbols locally.
bool
- symbolic() const
+ Bsymbolic() const
{ return this->symbolic_; }
// --compress-debug-sections: compress .debug_* sections in the
// --eh-frame-hdr: Whether to generate an exception frame header.
bool
- create_eh_frame_hdr() const
+ eh_frame_hdr() const
{ return this->create_eh_frame_hdr_; }
// --rpath: The runtime search path.
// --shared: Whether generating a shared object.
bool
- is_shared() const
+ shared() const
{ return this->is_shared_; }
// --static: Whether doing a static link.
sysroot() const
{ return this->sysroot_; }
- // --version-script: The version script to apply if --shared is true.
- const Version_script_info&
- version_script() const
- { return *this->script_options_->version_script_info(); }
+ // -Tbss: The address of the BSS segment
+ uint64_t
+ Tbss() const
+ { return this->bss_segment_address_; }
+
+ // Whether -Tbss was used.
+ bool
+ user_set_Tbss() const
+ { return this->bss_segment_address_ != -1U; }
+
+ // -Tdata: The address of the data segment
+ uint64_t
+ Tdata() const
+ { return this->data_segment_address_; }
+
+ // Whether -Tdata was used.
+ bool
+ user_set_Tdata() const
+ { return this->data_segment_address_ != -1U; }
// -Ttext: The address of the .text section
uint64_t
- text_segment_address() const
+ Ttext() const
{ return this->text_segment_address_; }
// Whether -Ttext was used.
bool
- user_set_text_segment_address() const
+ user_set_Ttext() const
{ return this->text_segment_address_ != -1U; }
// --threads: Whether to use threads.
is_stack_executable() const
{ return this->execstack_ == EXECSTACK_YES; }
+ // -z max-page-size
+ uint64_t
+ max_page_size() const
+ { return this->max_page_size_; }
+
+ // -z common-page-size
+ uint64_t
+ common_page_size() const
+ { return this->common_page_size_; }
+
// --debug
unsigned int
debug() const
{ return this->debug_; }
- // Return the options which may be set from a linker script.
- Script_options*
- script_options()
- { return this->script_options_; }
-
- const Script_options*
- script_options() const
- { return this->script_options_; }
-
private:
// Don't copy this structure.
General_options(const General_options&);
void
set_entry(const char* arg)
- { this->script_options_->set_entry(arg, strlen(arg)); }
+ { this->entry_ = arg; }
void
- set_export_dynamic()
- { this->export_dynamic_ = true; }
+ set_export_dynamic(bool value)
+ { this->export_dynamic_ = value; }
void
set_soname(const char* arg)
{ this->search_path_.push_back(Search_directory(arg, true)); }
void
- set_optimization_level(const char* arg)
+ set_optimize(const char* arg)
{
char* endptr;
this->optimization_level_ = strtol(arg, &endptr, 0);
}
void
- set_output_file_name(const char* arg)
+ set_output(const char* arg)
{ this->output_file_name_ = arg; }
void
- set_output_format(const char*);
+ set_oformat(const char*);
void
- set_relocatable()
- { this->is_relocatable_ = true; }
+ set_relocatable(bool value)
+ { this->is_relocatable_ = value; }
void
- set_strip_all()
+ set_strip_all(bool)
{ this->strip_ = STRIP_ALL; }
// Note: normalize_options() depends on the fact that this turns off
// STRIP_ALL if it were already set.
void
- set_strip_debug()
+ set_strip_debug(bool)
{ this->strip_ = STRIP_DEBUG; }
void
- set_strip_debug_gdb()
+ set_strip_debug_gdb(bool)
{ this->strip_ = STRIP_DEBUG_UNUSED_BY_GDB; }
void
- set_allow_shlib_undefined()
- { this->allow_shlib_undefined_ = true; }
+ set_allow_shlib_undefined(bool value)
+ { this->allow_shlib_undefined_ = value; }
void
- set_no_allow_shlib_undefined()
- { this->allow_shlib_undefined_ = false; }
+ set_no_allow_shlib_undefined(bool value)
+ { this->set_allow_shlib_undefined(!value); }
void
- set_symbolic()
- { this->symbolic_ = true; }
+ set_Bsymbolic(bool value)
+ { this->symbolic_ = value; }
void set_compress_debug_sections(const char* arg)
{
}
void
- define_symbol(const char* arg);
+ add_to_defsym(const char* arg);
void
- set_demangle()
- { this->demangle_ = true; }
+ set_demangle(bool value)
+ { this->demangle_ = value; }
void
- clear_demangle()
- { this->demangle_ = false; }
+ set_no_demangle(bool value)
+ { this->set_demangle(!value); }
void
- set_detect_odr_violations()
- { this->detect_odr_violations_ = true; }
+ set_detect_odr_violations(bool value)
+ { this->detect_odr_violations_ = value; }
void
- set_create_eh_frame_hdr()
- { this->create_eh_frame_hdr_ = true; }
+ set_eh_frame_hdr(bool value)
+ { this->create_eh_frame_hdr_ = value; }
void
add_to_rpath(const char* arg)
{ this->rpath_link_.push_back(Search_directory(arg, false)); }
void
- set_shared()
- { this->is_shared_ = true; }
+ set_shared(bool value)
+ { this->is_shared_ = value; }
void
- set_static()
- { this->is_static_ = true; }
+ set_static(bool value)
+ { this->is_static_ = value; }
void
- set_stats()
- { this->print_stats_ = true; }
+ set_stats(bool value)
+ { this->print_stats_ = value; }
void
set_sysroot(const char* arg)
{ this->sysroot_ = arg; }
void
- set_text_segment_address(const char* arg)
+ set_segment_address(const char* name, const char* arg, uint64_t* val)
{
char* endptr;
- this->text_segment_address_ = strtoull(arg, &endptr, 0);
- if (*endptr != '\0'
- || this->text_segment_address_ == -1U)
- gold_fatal(_("invalid argument to -Ttext: %s"), arg);
+ *val = strtoull(arg, &endptr, 0);
+ if (*endptr != '\0' || *val == -1U)
+ gold_fatal(_("invalid argument to %s: %s"), name, arg);
}
+ void
+ set_Tbss(const char* arg)
+ { this->set_segment_address("-Tbss", arg, &this->bss_segment_address_); }
+
+ void
+ set_Tdata(const char* arg)
+ { this->set_segment_address("-Tdata", arg, &this->data_segment_address_); }
+
+ void
+ set_Ttext(const char* arg)
+ { this->set_segment_address("-Ttext", arg, &this->text_segment_address_); }
+
int
parse_thread_count(const char* arg)
{
}
void
- set_threads()
+ set_threads(bool value)
{
#ifndef ENABLE_THREADS
- gold_fatal(_("--threads not supported"));
+ if (value)
+ gold_fatal(_("--threads not supported"));
#endif
- this->threads_ = true;
+ this->threads_ = value;
}
void
- clear_threads()
- { this->threads_ = false; }
+ set_no_threads(bool value)
+ { this->set_threads(!value); }
void
set_thread_count(const char* arg)
{ }
void
- set_execstack()
+ set_execstack(bool)
{ this->execstack_ = EXECSTACK_YES; }
void
- set_noexecstack()
+ set_noexecstack(bool)
{ this->execstack_ = EXECSTACK_NO; }
+ void
+ set_max_page_size(const char* arg)
+ {
+ char* endptr;
+ this->max_page_size_ = strtoull(arg, &endptr, 0);
+ if (*endptr != '\0' || this->max_page_size_ == 0)
+ gold_fatal(_("invalid max-page-size: %s"), arg);
+ }
+
+ void
+ set_common_page_size(const char* arg)
+ {
+ char* endptr;
+ this->common_page_size_ = strtoull(arg, &endptr, 0);
+ if (*endptr != '\0' || this->common_page_size_ == 0)
+ gold_fatal(_("invalid common-page-size: %s"), arg);
+ }
+
void
set_debug(unsigned int flags)
{ this->debug_ = flags; }
void
add_sysroot();
+ const char* entry_;
bool export_dynamic_;
const char* soname_;
const char* dynamic_linker_;
Dir_list search_path_;
int optimization_level_;
const char* output_file_name_;
- Object_format output_format_;
- const char* output_format_string_;
+ Object_format oformat_;
+ const char* oformat_string_;
bool is_relocatable_;
Strip strip_;
bool allow_shlib_undefined_;
bool is_static_;
bool print_stats_;
std::string sysroot_;
+ uint64_t bss_segment_address_;
+ uint64_t data_segment_address_;
uint64_t text_segment_address_;
bool threads_;
int thread_count_initial_;
int thread_count_middle_;
int thread_count_final_;
Execstack execstack_;
+ uint64_t max_page_size_;
+ uint64_t common_page_size_;
unsigned int debug_;
- // Some options can also be set from linker scripts. Those are
- // stored here.
- Script_options* script_options_;
};
// The current state of the position dependent options.
// -Bdynamic/-Bstatic: Whether we are searching for a static archive
// -rather than a shared object.
bool
- do_static_search() const
+ Bstatic() const
{ return this->do_static_search_; }
// --as-needed: Whether to add a DT_NEEDED argument only if the
// --whole-archive: Whether to include the entire contents of an
// --archive.
bool
- include_whole_archive() const
+ whole_archive() const
{ return this->include_whole_archive_; }
// --format: The format of the input file.
Object_format
- input_format() const
+ format() const
{ return this->input_format_; }
void
- set_static_search()
- { this->do_static_search_ = true; }
+ set_Bstatic(bool value)
+ { this->do_static_search_ = value; }
void
- set_dynamic_search()
- { this->do_static_search_ = false; }
+ set_Bdynamic(bool value)
+ { this->set_Bstatic(!value); }
void
- set_as_needed()
- { this->as_needed_ = true; }
+ set_as_needed(bool value)
+ { this->as_needed_ = value; }
void
- clear_as_needed()
- { this->as_needed_ = false; }
+ set_no_as_needed(bool value)
+ { this->set_as_needed(!value); }
void
- set_whole_archive()
- { this->include_whole_archive_ = true; }
+ set_whole_archive(bool value)
+ { this->include_whole_archive_ = value; }
void
- clear_whole_archive()
- { this->include_whole_archive_ = false; }
+ set_no_whole_archive(bool value)
+ { this->set_whole_archive(!value); }
void
- set_input_format(const char*);
+ set_format(const char*);
private:
bool do_static_search_;
public:
typedef Input_arguments::const_iterator const_iterator;
- Command_line(Script_options*);
+ Command_line();
// Process the command line options. This will exit with an
// appropriate error message if an unrecognized option is seen.
position_dependent_options() const
{ return this->position_options_; }
- // Get the options which may be set from a linker script.
- Script_options*
+ // Get the linker-script options.
+ Script_options&
script_options()
- { return this->options_.script_options(); }
+ { return this->script_options_; }
- const Script_options*
- script_options() const
- { return this->options_.script_options(); }
+ // Get the version-script options: a convenience routine.
+ const Version_script_info&
+ version_script() const
+ { return *this->script_options_.version_script_info(); }
// The number of input files.
int
General_options options_;
Position_dependent_options position_options_;
+ Script_options script_options_;
Input_arguments inputs_;
};