PR ld/10515
[binutils-gdb.git] / gold / options.h
index b811332406f92dc95ab85061c7197f900db4b6dc..3f145293df2f9bbd05e112f25957dfe33a98eee3 100644 (file)
@@ -645,6 +645,9 @@ class General_options
               N_("Try to detect violations of the One Definition Rule"),
               NULL);
 
+  DEFINE_bool(discard_locals, options::TWO_DASHES, 'X', false,
+              N_("Delete all temporary local symbols"), NULL);
+
   DEFINE_bool(dynamic_list_data, options::TWO_DASHES, '\0', false,
               N_("Add data symbols to dynamic symbols"), NULL);
 
@@ -660,6 +663,10 @@ class General_options
   DEFINE_string(entry, options::TWO_DASHES, 'e', NULL,
                 N_("Set program start address"), N_("ADDRESS"));
 
+  DEFINE_special(exclude_libs, options::TWO_DASHES, '\0',
+                N_("Exclude libraries from automatic export"),
+                N_(("lib,lib ...")));
+
   DEFINE_bool(export_dynamic, options::TWO_DASHES, 'E', false,
               N_("Export all dynamic symbols"),
              N_("Do not export all dynamic symbols (default)"));
@@ -792,8 +799,9 @@ class General_options
   DEFINE_bool(strip_lto_sections, options::TWO_DASHES, '\0', true,
               N_("Strip LTO intermediate code sections"), NULL);
 
-  DEFINE_bool(no_keep_memory, options::TWO_DASHES, 's', false,
-              N_("Use less memory and more disk I/O (included only for compatibility with GNU ld)"), NULL);
+  DEFINE_bool(no_keep_memory, options::TWO_DASHES, '\0', false,
+              N_("Use less memory and more disk I/O "
+                 "(included only for compatibility with GNU ld)"), NULL);
 
   DEFINE_bool(shared, options::ONE_DASH, '\0', false,
               N_("Generate shared library"), NULL);
@@ -806,6 +814,20 @@ class General_options
   DEFINE_special(static, options::ONE_DASH, '\0',
                  N_("Do not link against shared libraries"), NULL);
 
+  DEFINE_bool(icf, options::TWO_DASHES, '\0', false,
+              N_("Identical Code Folding (Fold identical functions)"),
+              N_("Don't fold identical functions (default)"));
+
+  DEFINE_uint(icf_iterations, options::TWO_DASHES , '\0', 0,
+              N_("Number of iterations of ICF (default 2)"), N_("COUNT"));
+
+  DEFINE_bool(print_icf_sections, options::TWO_DASHES, '\0', false,
+              N_("List folded identical sections on stderr"),
+              N_("Do not list folded identical sections"));
+
+  DEFINE_set(keep_unique, options::TWO_DASHES, '\0',
+            N_("Do not fold this symbol during ICF"), N_("SYMBOL"));
+
   DEFINE_bool(gc_sections, options::TWO_DASHES, '\0', false,
               N_("Remove unused sections"),
               N_("Don't remove unused sections (default)"));
@@ -889,19 +911,20 @@ class General_options
               NULL);
   DEFINE_bool(execstack, options::DASH_Z, '\0', false,
               N_("Mark output as requiring executable stack"), NULL);
-  DEFINE_uint64(max_page_size, options::DASH_Z, '\0', 0,
-                N_("Set maximum page size to SIZE"), N_("SIZE"));
-  DEFINE_bool(noexecstack, options::DASH_Z, '\0', false,
-              N_("Mark output as not requiring executable stack"), NULL);
   DEFINE_bool(initfirst, options::DASH_Z, '\0', false,
              N_("Mark DSO to be initialized first at runtime"),
              NULL);
   DEFINE_bool(interpose, options::DASH_Z, '\0', false,
              N_("Mark object to interpose all DSOs but executable"),
              NULL);
+  DEFINE_bool(lazy, options::DASH_Z, '\0', false,
+             N_("Mark object for lazy runtime binding (default)"),
+             NULL);
   DEFINE_bool(loadfltr, options::DASH_Z, '\0', false,
              N_("Mark object requiring immediate process"),
              NULL);
+  DEFINE_uint64(max_page_size, options::DASH_Z, '\0', 0,
+                N_("Set maximum page size to SIZE"), N_("SIZE"));
   DEFINE_bool(nodefaultlib, options::DASH_Z, '\0', false,
              N_("Mark object not to use default search paths"),
              NULL);
@@ -914,12 +937,17 @@ class General_options
   DEFINE_bool(nodump, options::DASH_Z, '\0', false,
              N_("Mark DSO not available to dldump"),
              NULL);
-  DEFINE_bool(relro, options::DASH_Z, '\0', false,
-             N_("Where possible mark variables read-only after relocation"),
-             N_("Don't mark variables read-only after relocation"));
+  DEFINE_bool(noexecstack, options::DASH_Z, '\0', false,
+              N_("Mark output as not requiring executable stack"), NULL);
+  DEFINE_bool(now, options::DASH_Z, '\0', false,
+             N_("Mark object for immediate function binding"),
+             NULL);
   DEFINE_bool(origin, options::DASH_Z, '\0', false,
              N_("Mark DSO to indicate that needs immediate $ORIGIN "
                  "processing at runtime"), NULL);
+  DEFINE_bool(relro, options::DASH_Z, '\0', false,
+             N_("Where possible mark variables read-only after relocation"),
+             N_("Don't mark variables read-only after relocation"));
 
  public:
   typedef options::Dir_list Dir_list;
@@ -933,6 +961,11 @@ class General_options
   // any problems.
   void finalize();
 
+  // True if we printed the version information.
+  bool
+  printed_version() const
+  { return this->printed_version_; }
+
   // The macro defines output() (based on --output), but that's a
   // generic name.  Provide this alternative name, which is clearer.
   const char*
@@ -975,6 +1008,11 @@ class General_options
     OBJECT_FORMAT_BINARY
   };
 
+  // Convert a string to an Object_format.  Gives an error if the
+  // string is not recognized.
+  static Object_format
+  string_to_object_format(const char* arg);
+
   // Note: these functions are not very fast.
   Object_format format_enum() const;
   Object_format oformat_enum() const;
@@ -1022,6 +1060,11 @@ class General_options
   incremental_disposition() const
   { return this->incremental_disposition_; }
 
+  // Return true if S is the name of a library excluded from automatic
+  // symbol export.
+  bool
+  check_excluded_libs (const std::string &s) const;
+
  private:
   // Don't copy this structure.
   General_options(const General_options&);
@@ -1067,6 +1110,8 @@ class General_options
   void
   add_plugin_option(const char* opt);
 
+  // Whether we printed version information.
+  bool printed_version_;
   // Whether to mark the stack as executable.
   Execstack execstack_status_;
   // Whether to do a static link.
@@ -1083,10 +1128,12 @@ class General_options
   // --incremental-unchanged or --incremental-unknown option.  The
   // value may change as we proceed parsing the command line flags.
   Incremental_disposition incremental_disposition_;
-  // Wheater we have seen one of the options that require incremental
+  // Whether we have seen one of the options that require incremental
   // build (--incremental-changed, --incremental-unchanged or
   // --incremental-unknown)
   bool implicit_incremental_;
+  // Libraries excluded from automatic export via --exclude-libs
+  Unordered_set<std::string> excluded_libs_;
 };
 
 // The position-dependent options.  We use this to store the state of
@@ -1432,6 +1479,16 @@ class Command_line
   Command_line(const Command_line&);
   Command_line& operator=(const Command_line&);
 
+  // This is a dummy class to provide a constructor that runs before
+  // the constructor for the General_options.  The Pre_options constructor
+  // is used as a hook to set the flag enabling the options to register
+  // themselves.
+  struct Pre_options {
+    Pre_options();
+  };
+
+  // This must come before options_!
+  Pre_options pre_options_;
   General_options options_;
   Position_dependent_options position_options_;
   Script_options script_options_;