// options.h -- handle command line options for gold -*- C++ -*-
-// Copyright (C) 2006-2018 Free Software Foundation, Inc.
+// Copyright (C) 2006-2021 Free Software Foundation, Inc.
// Written by Ian Lance Taylor <iant@google.com>.
// This file is part of gold.
options::String_set::const_iterator \
varname__##_end() const \
{ return this->varname__##_.value.end(); } \
- \
+ \
options::String_set::size_type \
varname__##_size() const \
{ return this->varname__##_.value.size(); } \
// After helparg__ should come an initializer list, like
// {"foo", "bar", "baz"}
#define DEFINE_enum(varname__, dashes__, shortname__, default_value__, \
- helpstring__, helparg__, ...) \
+ helpstring__, helparg__, optional_arg__, ...) \
DEFINE_var(varname__, dashes__, shortname__, default_value__, \
- default_value__, helpstring__, helparg__, false, \
+ default_value__, helpstring__, helparg__, optional_arg__, \
const char*, const char*, parse_choices_##varname__, false) \
private: \
static void parse_choices_##varname__(const char* option_name, \
N_("Use DT_NEEDED for all shared libraries"));
DEFINE_enum(assert, options::ONE_DASH, '\0', NULL,
- N_("Ignored"), N_("[ignored]"),
+ N_("Ignored"), N_("[ignored]"), false,
{"definitions", "nodefinitions", "nosymbolic", "pure-text"});
// b
DEFINE_enum(compress_debug_sections, options::TWO_DASHES, '\0', "none",
N_("Compress .debug_* sections in the output file"),
- ("[none,zlib,zlib-gnu,zlib-gabi]"),
+ ("[none,zlib,zlib-gnu,zlib-gabi]"), false,
{"none", "zlib", "zlib-gnu", "zlib-gabi"});
DEFINE_bool(copy_dt_needed_entries, options::TWO_DASHES, '\0', false,
N_("Do not demangle C++ symbols in log messages"),
NULL);
+ DEFINE_string(dependency_file, options::TWO_DASHES, '\0', NULL,
+ N_("Write a dependency file listing all files read"),
+ N_("FILE"));
+
DEFINE_bool(detect_odr_violations, options::TWO_DASHES, '\0', false,
N_("Look for violations of the C++ One Definition Rule"),
N_("Do not look for violations of the C++ One Definition Rule"));
N_("FRACTION"));
DEFINE_enum(hash_style, options::TWO_DASHES, '\0', DEFAULT_HASH_STYLE,
- N_("Dynamic hash style"), N_("[sysv,gnu,both]"),
+ N_("Dynamic hash style"), N_("[sysv,gnu,both]"), false,
{"sysv", "gnu", "both"});
// i
N_("Identical Code Folding. "
"\'--icf=safe\' Folds ctors, dtors and functions whose"
" pointers are definitely not taken"),
- ("[none,all,safe]"),
+ ("[none,all,safe]"), false,
{"none", "all", "safe"});
DEFINE_uint(icf_iterations, options::TWO_DASHES , '\0', 0,
- N_("Number of iterations of ICF (default 2)"), N_("COUNT"));
+ N_("Number of iterations of ICF (default 3)"), N_("COUNT"));
DEFINE_special(incremental, options::TWO_DASHES, '\0',
N_("Do an incremental link if possible; "
DEFINE_enum(orphan_handling, options::TWO_DASHES, '\0', "place",
N_("Orphan section handling"), N_("[place,discard,warn,error]"),
- {"place", "discard", "warn", "error"});
+ false, {"place", "discard", "warn", "error"});
// p
N_("Load a plugin library"), N_("PLUGIN"));
DEFINE_special(plugin_opt, options::TWO_DASHES, '\0',
N_("Pass an option to the plugin"), N_("OPTION"));
+#else
+ DEFINE_special(plugin, options::TWO_DASHES, '\0',
+ N_("Load a plugin library (not supported)"), N_("PLUGIN"));
+ DEFINE_special(plugin_opt, options::TWO_DASHES, '\0',
+ N_("Pass an option to the plugin (not supported)"),
+ N_("OPTION"));
#endif
DEFINE_bool(posix_fallocate, options::TWO_DASHES, '\0', true,
N_("Use posix_fallocate to reserve space in the output file"),
N_("Use fallocate or ftruncate to reserve space"));
+ DEFINE_enum(power10_stubs, options::TWO_DASHES, '\0', "yes",
+ N_("(PowerPC64 only) stubs use power10 insns"),
+ N_("[=auto,no,yes]"), true, {"auto", "no", "yes"});
+ DEFINE_special(no_power10_stubs, options::TWO_DASHES, '\0',
+ N_("(PowerPC64 only) stubs do not use power10 insns"), NULL);
+
DEFINE_bool(preread_archive_symbols, options::TWO_DASHES, '\0', false,
N_("Preread archive symbols when multi-threaded"), NULL);
DEFINE_bool(rosegment, options::TWO_DASHES, '\0', false,
N_("Put read-only non-executable sections in their own segment"),
- NULL);
+ N_("Do not put read-only non-executable sections in their own segment"));
DEFINE_uint64(rosegment_gap, options::TWO_DASHES, '\0', -1U,
N_("Set offset between executable and read-only segments"),
DEFINE_enum(sort_section, options::TWO_DASHES, '\0', "none",
N_("Sort sections by name. \'--no-text-reorder\'"
" will override \'--sort-section=name\' for .text"),
- N_("[none,name]"),
+ N_("[none,name]"), false,
{"none", "name"});
DEFINE_uint(spare_dynamic_tags, options::TWO_DASHES, '\0', 5,
"output sections"),
N_("(PowerPC only) Each output section has its own stubs"));
- DEFINE_uint(split_stack_adjust_size, options::TWO_DASHES, '\0', 0x4000,
+ DEFINE_uint(split_stack_adjust_size, options::TWO_DASHES, '\0', 0x100000,
N_("Stack size when -fsplit-stack function calls non-split"),
N_("SIZE"));
NULL);
DEFINE_enum(target2, options::TWO_DASHES, '\0', NULL,
N_("(ARM only) Set R_ARM_TARGET2 relocation type"),
- N_("[rel, abs, got-rel"),
+ N_("[rel, abs, got-rel"), false,
{"rel", "abs", "got-rel"});
DEFINE_bool(text_reorder, options::TWO_DASHES, '\0', true,
DEFINE_enum(unresolved_symbols, options::TWO_DASHES, '\0', NULL,
N_("How to handle unresolved symbols"),
("ignore-all,report-all,ignore-in-object-files,"
- "ignore-in-shared-libs"),
+ "ignore-in-shared-libs"), false,
{"ignore-all", "report-all", "ignore-in-object-files",
"ignore-in-shared-libs"});
DEFINE_bool_ignore(warn_constructors, options::TWO_DASHES, '\0',
N_("Ignored"), N_("Ignored"));
+ DEFINE_bool(warn_drop_version, options::TWO_DASHES, '\0', false,
+ N_("Warn when discarding version information"),
+ N_("Do not warn when discarding version information"));
+
DEFINE_bool(warn_execstack, options::TWO_DASHES, '\0', false,
N_("Warn if the stack is executable"),
N_("Do not warn if the stack is executable"));
DEFINE_bool(interpose, options::DASH_Z, '\0', false,
N_("Mark object to interpose all DSOs but executable"),
NULL);
+ DEFINE_bool(unique, options::DASH_Z, '\0', false,
+ N_("Mark DSO to be loaded at most once, and only in the main namespace"),
+ N_("Do not mark the DSO as one to be loaded only in the main namespace"));
DEFINE_bool_alias(lazy, now, options::DASH_Z, '\0',
N_("Mark object for lazy runtime binding"),
NULL, true);
N_("Don't mark variables read-only after relocation"));
DEFINE_uint64(stack_size, options::DASH_Z, '\0', 0,
N_("Set PT_GNU_STACK segment p_memsz to SIZE"), N_("SIZE"));
+ DEFINE_enum(start_stop_visibility, options::DASH_Z, '\0', "protected",
+ N_("ELF symbol visibility for synthesized "
+ "__start_* and __stop_* symbols"),
+ ("[default,internal,hidden,protected]"), false,
+ {"default", "internal", "hidden", "protected"});
DEFINE_bool(text, options::DASH_Z, '\0', false,
N_("Do not permit relocations in read-only segments"),
N_("Permit relocations in read-only segments"));
orphan_handling_enum() const
{ return this->orphan_handling_enum_; }
+ elfcpp::STV
+ start_stop_visibility_enum() const
+ { return this->start_stop_visibility_enum_; }
+
+ enum Power10_stubs
+ {
+ // Use Power10 insns on @notoc calls/branches, non-Power10 elsewhere.
+ POWER10_STUBS_AUTO,
+ // Don't use Power10 insns
+ POWER10_STUBS_NO,
+ // Always use Power10 insns
+ POWER10_STUBS_YES
+ };
+
+ Power10_stubs
+ power10_stubs_enum() const
+ { return this->power10_stubs_enum_; }
+
private:
// Don't copy this structure.
General_options(const General_options&);
set_orphan_handling_enum(Orphan_handling value)
{ this->orphan_handling_enum_ = value; }
+ void
+ set_start_stop_visibility_enum(elfcpp::STV value)
+ { this->start_stop_visibility_enum_ = value; }
+
+ void
+ set_power10_stubs_enum(Power10_stubs value)
+ { this->power10_stubs_enum_ = value; }
+
// These are called by finalize() to set up the search-path correctly.
void
add_to_library_path_with_sysroot(const std::string& arg)
std::vector<Position_dependent_options*> options_stack_;
// Orphan handling option, decoded to an enum value.
Orphan_handling orphan_handling_enum_;
+ // Symbol visibility for __start_* / __stop_* magic symbols.
+ elfcpp::STV start_stop_visibility_enum_;
+ // Power10 stubs option
+ Power10_stubs power10_stubs_enum_;
};
// The position-dependent options. We use this to store the state of