aboutsummaryrefslogtreecommitdiff
path: root/gold/options.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gold/options.cc')
-rw-r--r--gold/options.cc71
1 files changed, 68 insertions, 3 deletions
diff --git a/gold/options.cc b/gold/options.cc
index 671f3d5..6c0fa04 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;