+const char*
+General_options::object_format_to_string(General_options::Object_format fmt)
+{
+ switch (fmt)
+ {
+ case General_options::OBJECT_FORMAT_ELF:
+ return "elf";
+ case General_options::OBJECT_FORMAT_BINARY:
+ return "binary";
+ default:
+ gold_unreachable();
+ }
+}
+
+void
+General_options::parse_fix_v4bx(const char*, const char*,
+ Command_line*)
+{
+ this->fix_v4bx_ = FIX_V4BX_REPLACE;
+}
+
+void
+General_options::parse_fix_v4bx_interworking(const char*, const char*,
+ Command_line*)
+{
+ this->fix_v4bx_ = FIX_V4BX_INTERWORKING;
+}
+
+void
+General_options::parse_EB(const char*, const char*, Command_line*)
+{
+ this->endianness_ = ENDIANNESS_BIG;
+}
+
+void
+General_options::parse_EL(const char*, const char*, Command_line*)
+{
+ this->endianness_ = ENDIANNESS_LITTLE;
+}
+
+void
+General_options::copy_from_posdep_options(
+ const Position_dependent_options& posdep)
+{
+ this->set_as_needed(posdep.as_needed());
+ this->set_Bdynamic(posdep.Bdynamic());
+ this->set_format(
+ General_options::object_format_to_string(posdep.format_enum()));
+ this->set_whole_archive(posdep.whole_archive());
+ this->set_incremental_disposition(posdep.incremental_disposition());
+}
+
+void
+General_options::parse_push_state(const char*, const char*, Command_line*)
+{
+ Position_dependent_options* posdep = new Position_dependent_options(*this);
+ this->options_stack_.push_back(posdep);
+}
+
+void
+General_options::parse_pop_state(const char*, const char*, Command_line*)
+{
+ if (this->options_stack_.empty())
+ {
+ gold::gold_error(_("unbalanced --push-state/--pop-state"));
+ return;
+ }
+ Position_dependent_options* posdep = this->options_stack_.back();
+ this->options_stack_.pop_back();
+ this->copy_from_posdep_options(*posdep);
+ delete posdep;
+}
+
+} // End namespace gold.
+
+namespace
+{
+
+void
+usage()
+{
+ fprintf(stderr,
+ _("%s: use the --help option for usage information\n"),
+ gold::program_name);
+ ::exit(EXIT_FAILURE);
+}
+
+void
+usage(const char* msg, const char* opt)
+{
+ fprintf(stderr,
+ _("%s: %s: %s\n"),
+ gold::program_name, opt, msg);
+ usage();
+}
+