// options.c -- handle command line options for gold
-// Copyright (C) 2006-2016 Free Software Foundation, Inc.
+// Copyright (C) 2006-2019 Free Software Foundation, Inc.
// Written by Ian Lance Taylor <iant@google.com>.
// This file is part of gold.
cmdline->inputs().add_file(file);
}
-#ifdef ENABLE_PLUGINS
void
General_options::parse_plugin(const char*, const char* arg,
Command_line*)
{
this->add_plugin_option(arg);
}
-#endif // ENABLE_PLUGINS
void
General_options::parse_R(const char* option, const char* arg,
section_starts_(),
fix_v4bx_(FIX_V4BX_NONE),
endianness_(ENDIANNESS_NOT_SET),
- discard_locals_(DISCARD_SEC_MERGE)
+ discard_locals_(DISCARD_SEC_MERGE),
+ orphan_handling_enum_(ORPHAN_PLACE)
{
// Turn off option registration once construction is complete.
gold::options::ready_to_register = false;
this->set_do_demangle(getenv("COLLECT_NO_DEMANGLE") == NULL);
}
+ // Parse the --orphan-handling argument.
+ if (this->user_set_orphan_handling())
+ {
+ if (strcmp(this->orphan_handling(), "place") == 0)
+ this->set_orphan_handling_enum(ORPHAN_PLACE);
+ else if (strcmp(this->orphan_handling(), "discard") == 0)
+ this->set_orphan_handling_enum(ORPHAN_DISCARD);
+ else if (strcmp(this->orphan_handling(), "warn") == 0)
+ this->set_orphan_handling_enum(ORPHAN_WARN);
+ else if (strcmp(this->orphan_handling(), "error") == 0)
+ this->set_orphan_handling_enum(ORPHAN_ERROR);
+ }
+
// -M is equivalent to "-Map -".
if (this->print_map() && !this->user_set_Map())
{
program_name);
#endif
+#ifndef ENABLE_PLUGINS
+ if (this->has_plugins())
+ gold_fatal(_("cannot use --plugin: "
+ "%s was compiled without plugin support"),
+ program_name);
+#endif
+
std::string libpath;
if (this->user_set_Y())
{
gold_fatal(_("incremental linking is not compatible with --plugin"));
if (this->relro())
gold_fatal(_("incremental linking is not compatible with -z relro"));
+ if (this->pie())
+ gold_fatal(_("incremental linking is not compatible with -pie"));
if (this->gc_sections())
{
gold_warning(_("ignoring --gc-sections for an incremental link"));
usage();
}
+ if (this->inputs_.in_lib())
+ {
+ fprintf(stderr, _("%s: missing lib end\n"), program_name);
+ usage();
+ }
+
// Normalize the options and ensure they don't contradict each other.
this->options_.finalize();
}