* elf-bfd.h (struct elf_obj_tdata): Move find_line_info, local_stubs,
[binutils-gdb.git] / gold / options.h
index b3b51dc67ec3c381f3fa45c4720bccde9fb976db..66fcf3eec632f13c5b9047b128b99bad52b97a40 100644 (file)
@@ -1,6 +1,6 @@
 // options.h -- handle command line options for gold  -*- C++ -*-
 
-// Copyright 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+// Copyright 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
 // Written by Ian Lance Taylor <iant@google.com>.
 
 // This file is part of gold.
@@ -63,6 +63,11 @@ class Script_info;
 
 enum Incremental_disposition
 {
+  // Startup files that appear before the first disposition option.
+  // These will default to INCREMENTAL_CHECK unless the
+  // --incremental-startup-unchanged option is given.
+  // (For files added implicitly by gcc before any user options.)
+  INCREMENTAL_STARTUP,
   // Determine the status from the timestamp (default).
   INCREMENTAL_CHECK,
   // Assume the file changed from the previous build.
@@ -97,6 +102,9 @@ parse_uint64(const char* option_name, const char* arg, uint64_t* retval);
 extern void
 parse_double(const char* option_name, const char* arg, double* retval);
 
+extern void
+parse_percent(const char* option_name, const char* arg, double* retval);
+
 extern void
 parse_string(const char* option_name, const char* arg, const char** retval);
 
@@ -372,6 +380,12 @@ struct Struct_special : public Struct_var
             #default_value__, helpstring__, helparg__, false,           \
             double, double, options::parse_double)
 
+#define DEFINE_percent(varname__, dashes__, shortname__, default_value__, \
+                      helpstring__, helparg__)                           \
+  DEFINE_var(varname__, dashes__, shortname__, default_value__ / 100.0,          \
+            #default_value__, helpstring__, helparg__, false,            \
+            double, double, options::parse_percent)
+
 #define DEFINE_string(varname__, dashes__, shortname__, default_value__, \
                       helpstring__, helparg__)                           \
   DEFINE_var(varname__, dashes__, shortname__, default_value__,          \
@@ -484,6 +498,32 @@ struct Struct_special : public Struct_var
   };                                                                   \
   Struct_no_##option__ no_##option__##_initializer_
 
+// This is like DEFINE_uint64, but VARNAME is the name of a different
+// option.  This option becomes an alias for that one.
+#define DEFINE_uint64_alias(option__, varname__, dashes__, shortname__,        \
+                           helpstring__, helparg__)                    \
+ private:                                                              \
+  struct Struct_##option__ : public options::Struct_var                        \
+  {                                                                    \
+    Struct_##option__()                                                        \
+      : option(#option__, dashes__, shortname__, "", helpstring__,     \
+              helparg__, false, this)                                  \
+    { }                                                                        \
+                                                                       \
+    void                                                               \
+    parse_to_value(const char* option_name, const char* arg,           \
+                  Command_line*, General_options* options)             \
+    {                                                                  \
+      uint64_t value;                                                  \
+      options::parse_uint64(option_name, arg, &value);                 \
+      options->set_##varname__(value);                                 \
+      options->set_user_set_##varname__();                             \
+    }                                                                  \
+                                                                       \
+    options::One_option option;                                                \
+  };                                                                   \
+  Struct_##option__ option__##_;
+
 // This is used for non-standard flags.  It defines no functions; it
 // just calls General_options::parse_VARNAME whenever the flag is
 // seen.  We declare parse_VARNAME as a static member of
@@ -529,7 +569,7 @@ class Search_directory
   { }
 
   // This is the usual constructor.
-  Search_directory(const char* name, bool put_in_sysroot)
+  Search_directory(const std::string& name, bool put_in_sysroot)
     : name_(name), put_in_sysroot_(put_in_sysroot), is_in_sysroot_(false)
   {
     if (this->name_.empty())
@@ -629,6 +669,9 @@ class General_options
   DEFINE_bool_alias(dn, Bdynamic, options::ONE_DASH, '\0',
                    N_("alias for -Bstatic"), NULL, true);
 
+  DEFINE_bool(Bgroup, options::ONE_DASH, '\0', false,
+             N_("Use group name lookup rules for shared library"), NULL);
+
   DEFINE_bool(Bsymbolic, options::ONE_DASH, '\0', false,
               N_("Bind defined symbols locally"), NULL);
 
@@ -663,6 +706,10 @@ class General_options
              N_("Output cross reference table"),
              N_("Do not output cross reference table"));
 
+  DEFINE_bool(ctors_in_init_array, options::TWO_DASHES, '\0', true,
+             N_("Use DT_INIT_ARRAY for all constructors (default)"),
+             N_("Handle constructors as directed by compiler"));
+
   DEFINE_bool(define_common, options::TWO_DASHES, 'd', false,
               N_("Define common symbols"),
               N_("Do not define common symbols"));
@@ -718,19 +765,30 @@ class General_options
               N_("Export all dynamic symbols"),
              N_("Do not export all dynamic symbols (default)"));
 
+  DEFINE_set(export_dynamic_symbol, options::TWO_DASHES, '\0',
+            N_("Export SYMBOL to dynamic symbol table"), N_("SYMBOL"));
+
   DEFINE_special(EB, options::ONE_DASH, '\0',
                 N_("Link big-endian objects."), NULL);
 
-  DEFINE_bool(eh_frame_hdr, options::TWO_DASHES, '\0', false,
-              N_("Create exception frame header"), NULL);
-
   DEFINE_special(EL, options::ONE_DASH, '\0',
                 N_("Link little-endian objects."), NULL);
 
+  DEFINE_bool(eh_frame_hdr, options::TWO_DASHES, '\0', false,
+              N_("Create exception frame header"), NULL);
+
   DEFINE_bool(enum_size_warning, options::TWO_DASHES, '\0', true, NULL,
              N_("(ARM only) Do not warn about objects with incompatible "
                 "enum sizes"));
 
+  DEFINE_set(auxiliary, options::TWO_DASHES, 'f',
+            N_("Auxiliary filter for shared object symbol table"),
+            N_("SHLIB"));
+
+  DEFINE_string(filter, options::TWO_DASHES, 'F', NULL,
+               N_("Filter for shared object symbol table"),
+               N_("SHLIB"));
+
   DEFINE_bool(fatal_warnings, options::TWO_DASHES, '\0', false,
              N_("Treat warnings as errors"),
              N_("Do not treat warnings as errors"));
@@ -742,6 +800,10 @@ class General_options
              N_("(ARM only) Fix binaries for Cortex-A8 erratum."),
              N_("(ARM only) Do not fix binaries for Cortex-A8 erratum."));
 
+  DEFINE_bool(fix_arm1176, options::TWO_DASHES, '\0', true,
+             N_("(ARM only) Fix binaries for ARM1176 erratum."),
+             N_("(ARM only) Do not fix binaries for ARM1176 erratum."));
+
   DEFINE_bool(merge_exidx_entries, options::TWO_DASHES, '\0', true,
              N_("(ARM only) Merge exidx entries in debuginfo."),
              N_("(ARM only) Do not merge exidx entries in debuginfo."));
@@ -758,6 +820,14 @@ class General_options
   DEFINE_bool(g, options::EXACTLY_ONE_DASH, '\0', false,
              N_("Ignored"), NULL);
 
+  DEFINE_bool(gdb_index, options::TWO_DASHES, '\0', false,
+             N_("Generate .gdb_index section"),
+             N_("Do not generate .gdb_index section"));
+
+  DEFINE_bool(gnu_unique, options::TWO_DASHES, '\0', true,
+             N_("Enable STB_GNU_UNIQUE symbol binding (default)"),
+             N_("Disable STB_GNU_UNIQUE symbol binding"));
+
   DEFINE_string(soname, options::ONE_DASH, 'h', NULL,
                 N_("Set shared library name"), N_("FILENAME"));
 
@@ -801,6 +871,14 @@ class General_options
   DEFINE_special(incremental_unknown, options::TWO_DASHES, '\0',
                  N_("Use timestamps to check files (default)"), NULL);
 
+  DEFINE_special(incremental_startup_unchanged, options::TWO_DASHES, '\0',
+                 N_("Assume startup files unchanged "
+                   "(files preceding this option)"), NULL);
+
+  DEFINE_percent(incremental_patch, options::TWO_DASHES, '\0', 10,
+                N_("Amount of extra space to allocate for patches"),
+                N_("PERCENT"));
+
   DEFINE_string(init, options::ONE_DASH, '\0', "_init",
                 N_("Call SYMBOL at load-time"), N_("SYMBOL"));
 
@@ -816,12 +894,21 @@ class General_options
               N_("Keep files mapped across passes (default)"),
               N_("Release mapped files after each pass"));
 
+  DEFINE_bool(ld_generated_unwind_info, options::TWO_DASHES, '\0', true,
+             N_("Generate unwind information for PLT (default)"),
+             N_("Do not generate unwind information for PLT"));
+
   DEFINE_special(library, options::TWO_DASHES, 'l',
                  N_("Search for library LIBNAME"), N_("LIBNAME"));
 
   DEFINE_dirlist(library_path, options::TWO_DASHES, 'L',
                  N_("Add directory to search path"), N_("DIR"));
 
+  DEFINE_bool(text_reorder, options::TWO_DASHES, '\0', true,
+             N_("Enable text section reordering for GCC section names "
+                "(default)"),
+             N_("Disable text section reordering for GCC section names"));
+
   DEFINE_bool(nostdlib, options::ONE_DASH, '\0', false,
               N_(" Only search directories specified on the command line."),
               NULL);
@@ -831,7 +918,11 @@ class General_options
               NULL);
 
   DEFINE_string(m, options::EXACTLY_ONE_DASH, 'm', "",
-                N_("Ignored for compatibility"), N_("EMULATION"));
+                N_("Set GNU linker emulation; obsolete"), N_("EMULATION"));
+
+  DEFINE_bool(mmap_output_file, options::TWO_DASHES, '\0', true,
+              N_("Map the output file for writing (default)."),
+              N_("Do not map the output file for writing."));
 
   DEFINE_bool(print_map, options::TWO_DASHES, 'M', false,
              N_("Write map file on standard output"), NULL);
@@ -844,7 +935,7 @@ class General_options
              N_("Do not page align data, do not make text readonly"),
              N_("Page align data, make text readonly"));
 
-  DEFINE_enable(new_dtags, options::EXACTLY_TWO_DASHES, '\0', false,
+  DEFINE_enable(new_dtags, options::EXACTLY_TWO_DASHES, '\0', true,
                N_("Enable use of DT_RUNPATH and DT_FLAGS"),
                N_("Disable use of DT_RUNPATH and DT_FLAGS"));
 
@@ -876,6 +967,18 @@ class General_options
   DEFINE_bool(pipeline_knowledge, options::ONE_DASH, '\0', false,
              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_("[=P2ALIGN]"), true, int, int, options::parse_uint);
+
+  DEFINE_bool(plt_static_chain, options::TWO_DASHES, '\0', false,
+             N_("(PowerPC64 only) PLT call stubs should load r11"),
+             N_("(PowerPC64 only) PLT call stubs should not load r11"));
+
+  DEFINE_bool(plt_thread_safe, options::TWO_DASHES, '\0', false,
+             N_("(PowerPC64 only) PLT call stubs with load-load barrier"),
+             N_("(PowerPC64 only) PLT call stubs without barrier"));
+
 #ifdef ENABLE_PLUGINS
   DEFINE_special(plugin, options::TWO_DASHES, '\0',
                  N_("Load a plugin library"), N_("PLUGIN"));
@@ -883,9 +986,17 @@ class General_options
                  N_("Pass an option to the plugin"), N_("OPTION"));
 #endif
 
+  DEFINE_bool(posix_fallocate, options::TWO_DASHES, '\0', true,
+              N_("Use posix_fallocate to reserve space in the output file"
+                " (default)."),
+              N_("Use fallocate or ftruncate to reserve space."));
+
   DEFINE_bool(preread_archive_symbols, options::TWO_DASHES, '\0', false,
               N_("Preread archive symbols when multi-threaded"), NULL);
 
+  DEFINE_bool(print_output_format, options::TWO_DASHES, '\0', false,
+             N_("Print default output format"), NULL);
+
   DEFINE_string(print_symbol_counts, options::TWO_DASHES, '\0', NULL,
                N_("Print symbols defined and used for each input"),
                N_("FILENAME"));
@@ -943,14 +1054,15 @@ class General_options
               N_("Emit only debug line number information"), NULL);
   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);
+                 "(at least versions <= 7.4)"), NULL);
   DEFINE_bool(strip_lto_sections, options::TWO_DASHES, '\0', true,
               N_("Strip LTO intermediate code sections"), NULL);
 
   DEFINE_int(stub_group_size, options::TWO_DASHES , '\0', 1,
-             N_("(ARM only) The maximum distance from instructions in a group "
-               "of sections to their stubs.  Negative values mean stubs "
-               "are always after the group. 1 means using default size.\n"),
+             N_("(ARM, PowerPC only) The maximum distance from instructions "
+               "in a group of sections to their stubs.  Negative values mean "
+               "stubs are always after (PowerPC before) the group.  1 means "
+               "use default size.\n"),
             N_("SIZE"));
 
   DEFINE_bool(no_keep_memory, options::TWO_DASHES, '\0', false,
@@ -1027,10 +1139,28 @@ class General_options
                 N_("Set the address of the data segment"), N_("ADDRESS"));
   DEFINE_uint64(Ttext, options::ONE_DASH, '\0', -1U,
                 N_("Set the address of the text segment"), N_("ADDRESS"));
+  DEFINE_uint64_alias(Ttext_segment, Ttext, options::ONE_DASH, '\0',
+                     N_("Set the address of the text segment"),
+                     N_("ADDRESS"));
+
+  DEFINE_bool(toc_optimize, options::TWO_DASHES, '\0', true,
+             N_("(PowerPC64 only) Optimize TOC code sequences"),
+             N_("(PowerPC64 only) Don't optimize TOC code sequences"));
+
+  DEFINE_bool(toc_sort, options::TWO_DASHES, '\0', true,
+             N_("(PowerPC64 only) Sort TOC and GOT sections"),
+             N_("(PowerPC64 only) Don't sort TOC and GOT sections"));
 
   DEFINE_set(undefined, options::TWO_DASHES, 'u',
             N_("Create undefined reference to SYMBOL"), N_("SYMBOL"));
 
+  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-all", "report-all", "ignore-in-object-files",
+                 "ignore-in-shared-libs"});
+
   DEFINE_bool(verbose, options::TWO_DASHES, '\0', false,
               N_("Synonym for --debug=files"), NULL);
 
@@ -1103,6 +1233,10 @@ class General_options
   DEFINE_special(end_lib, options::TWO_DASHES, '\0',
                  N_("End a library "), NULL);
 
+  DEFINE_string(fuse_ld, options::ONE_DASH, '\0', "",
+               N_("Ignored for GCC linker option compatibility"),
+               "");
+
   // The -z options.
 
   DEFINE_bool(combreloc, options::DASH_Z, '\0', true,
@@ -1162,7 +1296,7 @@ class General_options
              N_("Don't mark variables read-only after relocation"));
   DEFINE_bool(text, options::DASH_Z, '\0', false,
              N_("Do not permit relocations in read-only segments"),
-             NULL);
+             N_("Permit relocations in read-only segments (default)"));
   DEFINE_bool_alias(textoff, text, options::DASH_Z, '\0',
                    N_("Permit relocations in read-only segments (default)"),
                    NULL, true);
@@ -1313,6 +1447,12 @@ class General_options
   incremental_disposition() const
   { return this->incremental_disposition_; }
 
+  // The disposition to use for startup files (those that precede the
+  // first --incremental-changed, etc. option).
+  Incremental_disposition
+  incremental_startup_disposition() const
+  { return this->incremental_startup_disposition_; }
+
   // Return true if S is the name of a library excluded from automatic
   // symbol export.
   bool
@@ -1324,6 +1464,11 @@ class General_options
   bool
   section_start(const char* secname, uint64_t* paddr) const;
 
+  // Return whether any --section-start option was used.
+  bool
+  any_section_start() const
+  { return !this->section_starts_.empty(); }
+
   enum Fix_v4bx
   {
     // Leave original instruction.
@@ -1393,7 +1538,7 @@ class General_options
 
   // These are called by finalize() to set up the search-path correctly.
   void
-  add_to_library_path_with_sysroot(const char* arg)
+  add_to_library_path_with_sysroot(const std::string& arg)
   { this->add_search_directory_to_library_path(Search_directory(arg, true)); }
 
   // Apply any sysroot to the directory lists.
@@ -1430,9 +1575,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_;
+  // The disposition to use for startup files (those marked
+  // INCREMENTAL_STARTUP).
+  Incremental_disposition incremental_startup_disposition_;
   // Whether we have seen one of the options that require incremental
-  // build (--incremental-changed, --incremental-unchanged or
-  // --incremental-unknown)
+  // build (--incremental-changed, --incremental-unchanged,
+  // --incremental-unknown, or --incremental-startup-unchanged).
   bool implicit_incremental_;
   // Libraries excluded from automatic export, via --exclude-libs.
   Unordered_set<std::string> excluded_libs_;