* src/gdb/target.h: Remove all tests for already defined
[external/binutils.git] / gold / options.h
index 91f9552..904743e 100644 (file)
@@ -1,6 +1,6 @@
 // options.h -- handle command line options for gold  -*- C++ -*-
 
-// Copyright 2006, 2007, 2008 Free Software Foundation, Inc.
+// Copyright 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
 // Written by Ian Lance Taylor <iant@google.com>.
 
 // This file is part of gold.
@@ -54,6 +54,19 @@ class Search_directory;
 class Input_file_group;
 class Position_dependent_options;
 class Target;
+class Plugin_manager;
+
+// Incremental build action for a specific file, as selected by the user.
+
+enum Incremental_disposition
+{
+  // Determine the status from the timestamp (default).
+  INCREMENTAL_CHECK,
+  // Assume the file changed from the previous build.
+  INCREMENTAL_CHANGED,
+  // Assume the file didn't change from the previous build.
+  INCREMENTAL_UNCHANGED
+};
 
 // The nested namespace is to contain all the global variables and
 // structs that need to be defined in the .h file, but do not need to
@@ -521,9 +534,22 @@ class Search_directory
   is_in_sysroot() const
   { return this->is_in_sysroot_; }
 
+  // Return whether this is considered a system directory.
+  bool
+  is_system_directory() const
+  { return this->put_in_sysroot_ || this->is_in_sysroot_; }
+
  private:
+  // The directory name.
   std::string name_;
+  // True if the sysroot should be added as a prefix for this
+  // directory (if there is a sysroot).  This is true for system
+  // directories that we search by default.
   bool put_in_sysroot_;
+  // True if this directory is in the sysroot (if there is a sysroot).
+  // This is true if there is a sysroot and either 1) put_in_sysroot_
+  // is true, or 2) the directory happens to be in the sysroot based
+  // on a pathname comparison.
   bool is_in_sysroot_;
 };
 
@@ -576,6 +602,10 @@ class General_options
                         N_("Generate build ID note"),
                         N_("[=STYLE]"));
 
+  DEFINE_bool(check_sections, options::TWO_DASHES, '\0', true,
+             N_("Check segment addresses for overlaps (default)"),
+             N_("Do not check segment addresses for overlaps"));
+
 #ifdef HAVE_ZLIB_H
   DEFINE_enum(compress_debug_sections, options::TWO_DASHES, '\0', "none",
               N_("Compress .debug_* sections in the output file"),
@@ -615,11 +645,24 @@ class General_options
               N_("Try to detect violations of the One Definition Rule"),
               NULL);
 
+  DEFINE_bool(dynamic_list_data, options::TWO_DASHES, '\0', false,
+              N_("Add data symbols to dynamic symbols"), NULL);
+
+  DEFINE_bool(dynamic_list_cpp_new, options::TWO_DASHES, '\0', false,
+              N_("Add C++ operator new/delete to dynamic symbols"), NULL);
+
+  DEFINE_bool(dynamic_list_cpp_typeinfo, options::TWO_DASHES, '\0', false,
+              N_("Add C++ typeinfo to dynamic symbols"), NULL);
+
+  DEFINE_special(dynamic_list, options::TWO_DASHES, '\0',
+                 N_("Read a list of dynamic symbols"), N_("FILE"));
+
   DEFINE_string(entry, options::TWO_DASHES, 'e', NULL,
                 N_("Set program start address"), N_("ADDRESS"));
 
   DEFINE_bool(export_dynamic, options::TWO_DASHES, 'E', false,
-              N_("Export all dynamic symbols"), NULL);
+              N_("Export all dynamic symbols"),
+             N_("Do not export all dynamic symbols (default)"));
 
   DEFINE_bool(eh_frame_hdr, options::TWO_DASHES, '\0', false,
               N_("Create exception frame header"), NULL);
@@ -642,6 +685,19 @@ class General_options
   DEFINE_string(dynamic_linker, options::TWO_DASHES, 'I', NULL,
                 N_("Set dynamic linker path"), N_("PROGRAM"));
 
+  DEFINE_bool(incremental, options::TWO_DASHES, '\0', false,
+              N_("Work in progress; do not use"),
+              N_("Do a full build"));
+
+  DEFINE_special(incremental_changed, options::TWO_DASHES, '\0',
+                 N_("Assume files changed"), NULL);
+
+  DEFINE_special(incremental_unchanged, options::TWO_DASHES, '\0',
+                 N_("Assume files didn't change"), NULL);
+
+  DEFINE_special(incremental_unknown, options::TWO_DASHES, '\0',
+                 N_("Use timestamps to check files (default)"), NULL);
+
   DEFINE_special(just_symbols, options::TWO_DASHES, '\0',
                  N_("Read only symbol values from FILE"), N_("FILE"));
 
@@ -685,6 +741,16 @@ class General_options
   DEFINE_string(oformat, options::EXACTLY_TWO_DASHES, '\0', "elf",
                N_("Set output format"), N_("[binary]"));
 
+#ifdef ENABLE_PLUGINS
+  DEFINE_special(plugin, options::TWO_DASHES, '\0',
+                 N_("Load a plugin library"), N_("PLUGIN"));
+  DEFINE_special(plugin_opt, options::TWO_DASHES, '\0',
+                 N_("Pass an option to the plugin"), N_("OPTION"));
+#endif
+
+  DEFINE_bool(preread_archive_symbols, options::TWO_DASHES, '\0', false,
+              N_("Preread archive symbols when multi-threaded"), NULL);
+
   DEFINE_string(print_symbol_counts, options::TWO_DASHES, '\0', NULL,
                N_("Print symbols defined and used for each input"),
                N_("FILENAME"));
@@ -723,15 +789,31 @@ class General_options
   DEFINE_bool(strip_debug_gdb, options::TWO_DASHES, '\0', false,
               N_("Strip debug symbols that are unused by gdb "
                  "(at least versions <= 6.7)"), NULL);
+  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(shared, options::ONE_DASH, '\0', false,
               N_("Generate shared library"), NULL);
 
+  DEFINE_bool(Bshareable, options::ONE_DASH, '\0', false,
+              N_("Generate shared library"), NULL);
+
   // This is not actually special in any way, but I need to give it
   // a non-standard accessor-function name because 'static' is a keyword.
   DEFINE_special(static, options::ONE_DASH, '\0',
                  N_("Do not link against shared libraries"), NULL);
 
+  DEFINE_bool(gc_sections, options::TWO_DASHES, '\0', false,
+              N_("Remove unused sections"),
+              N_("Don't remove unused sections (default)"));
+
+  DEFINE_bool(print_gc_sections, options::TWO_DASHES, '\0', false,
+              N_("List removed unused sections on stderr"),
+              N_("Do not list removed unused sections"));
+
   DEFINE_bool(stats, options::TWO_DASHES, '\0', false,
               N_("Print resource usage statistics"), NULL);
 
@@ -772,6 +854,10 @@ class General_options
   DEFINE_special(version_script, options::TWO_DASHES, '\0',
                  N_("Read version script"), N_("FILE"));
 
+  DEFINE_bool(warn_search_mismatch, options::TWO_DASHES, '\0', true,
+             N_("Warn when skipping an incompatible library"),
+             N_("Don't warn when skipping an incompatible library"));
+
   DEFINE_bool(whole_archive, options::TWO_DASHES, '\0', false,
               N_("Include all archive contents"),
               N_("Include only needed archive contents"));
@@ -831,6 +917,9 @@ class General_options
   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(origin, options::DASH_Z, '\0', false,
+             N_("Mark DSO to indicate that needs immediate $ORIGIN "
+                 "processing at runtime"), NULL);
 
  public:
   typedef options::Dir_list Dir_list;
@@ -856,6 +945,20 @@ class General_options
   output_is_position_independent() const
   { return this->shared(); }
 
+  // Return true if the output is something that can be exec()ed, such
+  // as a static executable, or a position-dependent or
+  // position-independent executable, but not a dynamic library or an
+  // object file.
+  bool
+  output_is_executable() const
+  { return !this->shared() || this->output_is_pie(); }
+
+  // Return true if the output is a position-independent executable.
+  // This is currently not supported.
+  bool
+  output_is_pie() const
+  { return false; }
+
   // This would normally be static(), and defined automatically, but
   // since static is a keyword, we need to come up with our own name.
   bool
@@ -876,6 +979,10 @@ class General_options
   Object_format format_enum() const;
   Object_format oformat_enum() const;
 
+  // Return whether FILENAME is in a system directory.
+  bool
+  is_in_system_directory(const std::string& name) const;
+
   // These are the best way to get access to the execstack state,
   // not execstack() and noexecstack() which are hard to use properly.
   bool
@@ -893,6 +1000,28 @@ class General_options
   do_demangle() const
   { return this->do_demangle_; }
 
+  // Returns TRUE if any plugin libraries have been loaded.
+  bool
+  has_plugins() const
+  { return this->plugins_ != NULL; }
+
+  // Return a pointer to the plugin manager.
+  Plugin_manager*
+  plugins() const
+  { return this->plugins_; }
+
+  // True iff SYMBOL was found in the file specified by dynamic-list.
+  bool
+  in_dynamic_list(const char* symbol) const
+  { return this->dynamic_list_.version_script_info()->symbol_is_local(symbol); }
+
+  // The disposition given by the --incremental-changed,
+  // --incremental-unchanged or --incremental-unknown option.  The
+  // value may change as we proceed parsing the command line flags.
+  Incremental_disposition
+  incremental_disposition() const
+  { return this->incremental_disposition_; }
+
  private:
   // Don't copy this structure.
   General_options(const General_options&);
@@ -930,12 +1059,34 @@ class General_options
   void
   add_sysroot();
 
+  // Add a plugin and its arguments to the list of plugins.
+  void
+  add_plugin(const char *filename);
+
+  // Add a plugin option.
+  void
+  add_plugin_option(const char* opt);
+
   // Whether to mark the stack as executable.
   Execstack execstack_status_;
   // Whether to do a static link.
   bool static_;
   // Whether to do demangling.
   bool do_demangle_;
+  // List of plugin libraries.
+  Plugin_manager* plugins_;
+  // The parsed output of --dynamic-list files.  For convenience in
+  // script.cc, we store this as a Script_options object, even though
+  // we only use a single Version_tree from it.
+  Script_options dynamic_list_;
+  // The disposition given by the --incremental-changed,
+  // --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
+  // build (--incremental-changed, --incremental-unchanged or
+  // --incremental-unknown)
+  bool implicit_incremental_;
 };
 
 // The position-dependent options.  We use this to store the state of
@@ -972,12 +1123,14 @@ class Position_dependent_options
     this->set_Bdynamic(options.Bdynamic());
     this->set_format_enum(options.format_enum());
     this->set_whole_archive(options.whole_archive());
+    this->set_incremental_disposition(options.incremental_disposition());
   }
 
   DEFINE_posdep(as_needed, bool);
   DEFINE_posdep(Bdynamic, bool);
   DEFINE_posdep(format_enum, General_options::Object_format);
   DEFINE_posdep(whole_archive, bool);
+  DEFINE_posdep(incremental_disposition, Incremental_disposition);
 
  private:
   // This is a General_options with everything set to its default