sim: unify general maintainer settings
[binutils-gdb.git] / gold / options.h
index 678ca8208ec8ec1745f2e05b2c8c7e8823cb9051..757ebf18fecfa45dd16affc29c816c6975e07b60 100644 (file)
@@ -1,6 +1,6 @@
 // options.h -- handle command line options for gold  -*- C++ -*-
 
-// Copyright (C) 2006-2017 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.
@@ -471,15 +471,19 @@ struct Struct_special : public Struct_var
                                                                          \
   options::String_set::const_iterator                                    \
   varname__##_end() const                                                \
-  { return this->varname__##_.value.end(); }
+  { return this->varname__##_.value.end(); }                              \
+                                                                         \
+  options::String_set::size_type                                          \
+  varname__##_size() const                                                \
+  { return this->varname__##_.value.size(); }                             \
 
 // When you have a list of possible values (expressed as string)
 // 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,         \
@@ -699,7 +703,7 @@ class General_options
              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
@@ -743,11 +747,20 @@ class General_options
   DEFINE_bool(Bshareable, options::ONE_DASH, '\0', false,
              N_("Generate shared library (alias for -G/-shared)"), NULL);
 
-  DEFINE_bool(Bsymbolic, options::ONE_DASH, '\0', false,
-             N_("Bind defined symbols locally"), NULL);
+  DEFINE_special (Bno_symbolic, options::ONE_DASH, '\0',
+                 N_ ("Don't bind default visibility defined symbols locally "
+                     "for -shared (default)"),
+                 NULL);
 
-  DEFINE_bool(Bsymbolic_functions, options::ONE_DASH, '\0', false,
-             N_("Bind defined function symbols locally"), NULL);
+  DEFINE_special (Bsymbolic_functions, options::ONE_DASH, '\0',
+                 N_ ("Bind default visibility defined function symbols "
+                     "locally for -shared"),
+                 NULL);
+
+  DEFINE_special (
+      Bsymbolic, options::ONE_DASH, '\0',
+      N_ ("Bind default visibility defined symbols locally for -shared"),
+      NULL);
 
   // c
 
@@ -757,7 +770,7 @@ class General_options
 
   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,
@@ -796,6 +809,10 @@ class General_options
              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"));
@@ -894,7 +911,7 @@ class General_options
 
   DEFINE_string(fuse_ld, options::ONE_DASH, '\0', "",
                N_("Ignored for GCC linker option compatibility"),
-               "");
+               N_("[gold,bfd]"));
 
   // g
 
@@ -926,7 +943,7 @@ class General_options
                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
@@ -938,11 +955,11 @@ class General_options
              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; "
@@ -1078,7 +1095,7 @@ class General_options
 
   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
 
@@ -1101,7 +1118,7 @@ class General_options
              NULL, N_("(ARM only) Ignore for backward compatibility"));
 
   DEFINE_var(plt_align, options::TWO_DASHES, '\0', 0, "5",
-            N_("(PowerPC64 only) Align PLT call stubs to fit cache lines"),
+            N_("(PowerPC only) Align PLT call stubs to fit cache lines"),
             N_("[=P2ALIGN]"), true, int, int, options::parse_uint, false);
 
   DEFINE_bool(plt_localentry, options::TWO_DASHES, '\0', false,
@@ -1121,12 +1138,24 @@ class General_options
                 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);
 
@@ -1172,7 +1201,7 @@ class General_options
 
   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"),
@@ -1222,7 +1251,7 @@ class General_options
   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,
@@ -1240,7 +1269,7 @@ class General_options
                 "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"));
 
@@ -1273,7 +1302,7 @@ class General_options
              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,
@@ -1330,7 +1359,7 @@ class General_options
   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"});
 
@@ -1351,6 +1380,10 @@ class General_options
   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"));
@@ -1445,6 +1478,9 @@ class General_options
   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);
@@ -1486,12 +1522,26 @@ class General_options
              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"));
   DEFINE_bool_alias(textoff, text, options::DASH_Z, '\0',
                    N_("Permit relocations in read-only segments"),
                    NULL, true);
+  DEFINE_bool(text_unlikely_segment, options::DASH_Z, '\0', false,
+             N_("Move .text.unlikely sections to a separate segment."),
+             N_("Do not move .text.unlikely sections to a separate "
+                "segment."));
+  DEFINE_bool(keep_text_section_prefix, options::DASH_Z, '\0', false,
+             N_("Keep .text.hot, .text.startup, .text.exit and .text.unlikely "
+                "as separate sections in the final binary."),
+             N_("Merge all .text.* prefix sections."));
+
 
  public:
   typedef options::Dir_list Dir_list;
@@ -1699,6 +1749,21 @@ class General_options
   endianness() const
   { return this->endianness_; }
 
+  enum Bsymbolic_kind
+  {
+    BSYMBOLIC_NONE,
+    BSYMBOLIC_FUNCTIONS,
+    BSYMBOLIC_ALL,
+  };
+
+  bool
+  Bsymbolic() const
+  { return this->bsymbolic_ == BSYMBOLIC_ALL; }
+
+  bool
+  Bsymbolic_functions() const
+  { return this->bsymbolic_ == BSYMBOLIC_FUNCTIONS; }
+
   bool
   discard_all() const
   { return this->discard_locals_ == DISCARD_ALL; }
@@ -1727,6 +1792,24 @@ class General_options
   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&);
@@ -1786,6 +1869,14 @@ class 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)
@@ -1806,6 +1897,8 @@ class General_options
   void
   copy_from_posdep_options(const Position_dependent_options&);
 
+  // Whether we bind default visibility defined symbols locally for -shared.
+  Bsymbolic_kind bsymbolic_;
   // Whether we printed version information.
   bool printed_version_;
   // Whether to mark the stack as executable.
@@ -1853,6 +1946,10 @@ class General_options
   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