diff options
author | Ian Lance Taylor <ian@airs.com> | 2010-01-06 22:37:18 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 2010-01-06 22:37:18 +0000 |
commit | a192ba05083cb72a218e7c7722f30eadb9973833 (patch) | |
tree | fd02bf5a6447fb6c1ec2ba8655779f583ee8892e /gold/options.cc | |
parent | Support disconnected tracing. (diff) | |
download | binutils-gdb-a192ba05083cb72a218e7c7722f30eadb9973833.tar.gz binutils-gdb-a192ba05083cb72a218e7c7722f30eadb9973833.tar.bz2 binutils-gdb-a192ba05083cb72a218e7c7722f30eadb9973833.zip |
PR 10980
* options.cc (General_options::parse_section_start): New function.
(General_options::section_start): New function.
(General_options::General_options): Initialize all members.
* options.h: Include <map>
(class General_options): Add --section-start. Add section_starts_
member.
* layout.cc (Layout::attach_allocated_section_to_segment): If
--section-start was used, set the address of the segment. Remove
local sort_sections.
(Layout::relaxation_loop_body): If the address of the load segment
has been set by --section-start, don't use it.
* output.h (Output_segment::update_flags_for_output_section): New
function.
* output.cc (Output_segment::add_output_section): Call
update_flags_for_output_section.
Diffstat (limited to 'gold/options.cc')
-rw-r--r-- | gold/options.cc | 71 |
1 files changed, 68 insertions, 3 deletions
diff --git a/gold/options.cc b/gold/options.cc index 671f3d5db08..6c0fa041ec7 100644 --- a/gold/options.cc +++ b/gold/options.cc @@ -398,6 +398,63 @@ General_options::parse_just_symbols(const char*, const char* arg, cmdline->inputs().add_file(file); } +// Handle --section-start. + +void +General_options::parse_section_start(const char*, const char* arg, + Command_line*) +{ + const char* eq = strchr(arg, '='); + if (eq == NULL) + { + gold_error(_("invalid argument to --section-start; " + "must be SECTION=ADDRESS")); + return; + } + + std::string section_name(arg, eq - arg); + + ++eq; + const char* val_start = eq; + if (eq[0] == '0' && (eq[1] == 'x' || eq[1] == 'X')) + eq += 2; + if (*eq == '\0') + { + gold_error(_("--section-start address missing")); + return; + } + uint64_t addr = 0; + hex_init(); + for (; *eq != '\0'; ++eq) + { + if (!hex_p(*eq)) + { + gold_error(_("--section-start argument %s is not a valid hex number"), + val_start); + return; + } + addr <<= 4; + addr += hex_value(*eq); + } + + this->section_starts_[section_name] = addr; +} + +// Look up a --section-start value. + +bool +General_options::section_start(const char* secname, uint64_t* paddr) const +{ + if (this->section_starts_.empty()) + return false; + std::map<std::string, uint64_t>::const_iterator p = + this->section_starts_.find(secname); + if (p == this->section_starts_.end()) + return false; + *paddr = p->second; + return true; +} + void General_options::parse_static(const char*, const char*, Command_line*) { @@ -749,9 +806,17 @@ namespace gold General_options::General_options() : printed_version_(false), - execstack_status_(General_options::EXECSTACK_FROM_INPUT), static_(false), - do_demangle_(false), plugins_(), - incremental_disposition_(INCREMENTAL_CHECK), implicit_incremental_(false) + execstack_status_(EXECSTACK_FROM_INPUT), + icf_status_(ICF_NONE), + static_(false), + do_demangle_(false), + plugins_(NULL), + dynamic_list_(), + incremental_disposition_(INCREMENTAL_CHECK), + implicit_incremental_(false), + excluded_libs_(), + symbols_to_retain_(), + section_starts_() { // Turn off option registration once construction is complete. gold::options::ready_to_register = false; |