+ static_parameters.set_target(target);
+}
+
+void
+set_parameters_doing_static_link(bool doing_static_link)
+{ static_parameters.set_doing_static_link(doing_static_link); }
+
+// Set the incremental linking mode to INCREMENTAL_FULL. Used when
+// the linker determines that an incremental update is not possible.
+// Returns false if the incremental mode was INCREMENTAL_UPDATE,
+// indicating that the linker should exit if an update is not possible.
+bool
+set_parameters_incremental_full()
+{ return static_parameters.set_incremental_full(); }
+
+// Force the target to be valid by using the default. Use the
+// --oformat option is set; this supports the x86_64 kernel build,
+// which converts a binary file to an object file using -r --format
+// binary --oformat elf32-i386 foo.o. Otherwise use the configured
+// default.
+
+void
+parameters_force_valid_target()
+{
+ if (parameters->target_valid())
+ return;
+
+ gold_assert(parameters->options_valid());
+ if (parameters->options().user_set_oformat())
+ {
+ const char* bfd_name = parameters->options().oformat();
+ Target* target = select_target_by_bfd_name(bfd_name);
+ if (target != NULL)
+ {
+ set_parameters_target(target);
+ return;
+ }
+
+ gold_error(_("unrecognized output format %s"), bfd_name);
+ }
+
+ if (parameters->options().user_set_m())
+ {
+ const char* emulation = parameters->options().m();
+ Target* target = select_target_by_emulation(emulation);
+ if (target != NULL)
+ {
+ set_parameters_target(target);
+ return;
+ }
+
+ gold_error(_("unrecognized emulation %s"), emulation);
+ }
+
+ // The GOLD_DEFAULT_xx macros are defined by the configure script.
+ bool is_big_endian;
+ General_options::Endianness endianness = parameters->options().endianness();
+ if (endianness == General_options::ENDIANNESS_BIG)
+ is_big_endian = true;
+ else if (endianness == General_options::ENDIANNESS_LITTLE)
+ is_big_endian = false;
+ else
+ is_big_endian = GOLD_DEFAULT_BIG_ENDIAN;
+
+ Target* target = select_target(NULL, 0,
+ elfcpp::GOLD_DEFAULT_MACHINE,
+ GOLD_DEFAULT_SIZE,
+ is_big_endian,
+ elfcpp::GOLD_DEFAULT_OSABI,
+ 0);
+
+ if (target == NULL)
+ {
+ gold_assert(is_big_endian != GOLD_DEFAULT_BIG_ENDIAN);
+ gold_fatal(_("no supported target for -EB/-EL option"));
+ }
+
+ set_parameters_target(target);