* mips-tdep.c (mips16_scan_prologue): Handle the MIPS16e SAVE
[deliverable/binutils-gdb.git] / gold / options.h
index 9848639dff52fd7d88d3ae99f9b49c9a453f4057..48047c2aa3b687a3701d77e4b1ce9b007ae26862 100644 (file)
 #include <string>
 #include <vector>
 
+#include "script.h"
+
 namespace gold
 {
 
 class Command_line;
 class Input_file_group;
+class Position_dependent_options;
 
 namespace options {
 
 class Command_line_options;
 struct One_option;
+struct One_z_option;
 
 } // End namespace gold::options.
 
@@ -144,6 +148,33 @@ class General_options
   strip_debug() const
   { return this->strip_ == STRIP_ALL || this->strip_ == STRIP_DEBUG; }
 
+  // -Sgdb: strip only debugging information that's not used by
+  //         gdb (at least, for gdb versions <= 6.7).
+  bool
+  strip_debug_gdb() const
+  { return this->strip_debug() || this->strip_ == STRIP_DEBUG_UNUSED_BY_GDB; }
+
+  // --allow-shlib-undefined: do not warn about unresolved symbols in
+  // --shared libraries.
+  bool
+  allow_shlib_undefined() const
+  { return this->allow_shlib_undefined_; }
+
+  // -Bsymbolic: bind defined symbols locally.
+  bool
+  symbolic() const
+  { return this->symbolic_; }
+
+  // --demangle: demangle C++ symbols in our log messages.
+  bool
+  demangle() const
+  { return this->demangle_; }
+
+  // --detect-odr-violations: Whether to search for One Defn Rule violations.
+  bool
+  detect_odr_violations() const
+  { return this->detect_odr_violations_; }
+
   // --eh-frame-hdr: Whether to generate an exception frame header.
   bool
   create_eh_frame_hdr() const
@@ -169,7 +200,7 @@ class General_options
   is_static() const
   { return this->is_static_; }
 
-  // --statis: Print resource usage statistics.
+  // --stats: Print resource usage statistics.
   bool
   print_stats() const
   { return this->print_stats_; }
@@ -179,6 +210,45 @@ class General_options
   sysroot() const
   { return this->sysroot_; }
 
+  // -Ttext: The address of the .text section
+  uint64_t
+  text_segment_address() const
+  { return this->text_segment_address_; }
+
+  // Whether -Ttext was used.
+  bool
+  user_set_text_segment_address() const
+  { return this->text_segment_address_ != -1U; }
+
+  // --threads: Whether to use threads.
+  bool
+  threads() const
+  { return this->threads_; }
+
+  // --thread-count-initial: Threads to use in initial pass.
+  int
+  thread_count_initial() const
+  { return this->thread_count_initial_; }
+
+  // --thread-count-middle: Threads to use in middle pass.
+  int
+  thread_count_middle() const
+  { return this->thread_count_middle_; }
+
+  // --thread-count-final: Threads to use in final pass.
+  int
+  thread_count_final() const
+  { return this->thread_count_final_; }
+
+  // -z execstack, -z noexecstack
+  bool
+  is_execstack_set() const
+  { return this->execstack_ != EXECSTACK_FROM_INPUT; }
+
+  bool
+  is_stack_executable() const
+  { return this->execstack_ == EXECSTACK_YES; }
+
  private:
   // Don't copy this structure.
   General_options(const General_options&);
@@ -195,7 +265,20 @@ class General_options
     // Strip all symbols.
     STRIP_ALL,
     // Strip debugging information.
-    STRIP_DEBUG
+    STRIP_DEBUG,
+    // Strip debugging information that's not used by gdb (at least <= 6.7)
+    STRIP_DEBUG_UNUSED_BY_GDB
+  };
+
+  // Whether to mark the stack as executable.
+  enum Execstack
+  {
+    // Not set on command line.
+    EXECSTACK_FROM_INPUT,
+    // Mark the stack as executable.
+    EXECSTACK_YES,
+    // Mark the stack as not executable.
+    EXECSTACK_NO
   };
 
   void
@@ -236,6 +319,34 @@ class General_options
   set_strip_debug()
   { this->strip_ = STRIP_DEBUG; }
 
+  void
+  set_strip_debug_gdb()
+  { this->strip_ = STRIP_DEBUG_UNUSED_BY_GDB; }
+
+  void
+  set_allow_shlib_undefined()
+  { this->allow_shlib_undefined_ = true; }
+
+  void
+  set_no_allow_shlib_undefined()
+  { this->allow_shlib_undefined_ = false; }
+
+  void
+  set_symbolic()
+  { this->symbolic_ = true; }
+
+  void
+  set_demangle()
+  { this->demangle_ = true; }
+
+  void
+  clear_demangle()
+  { this->demangle_ = false; }
+
+  void
+  set_detect_odr_violations()
+  { this->detect_odr_violations_ = true; }
+
   void
   set_create_eh_frame_hdr()
   { this->create_eh_frame_hdr_ = true; }
@@ -264,10 +375,79 @@ class General_options
   set_sysroot(const char* arg)
   { this->sysroot_ = arg; }
 
+  void
+  set_text_segment_address(const char* arg)
+  {
+    char* endptr;
+    this->text_segment_address_ = strtoull(arg, &endptr, 0);
+    if (*endptr != '\0'
+       || this->text_segment_address_ == -1U)
+      {
+        fprintf(stderr, _("%s: invalid argument to -Ttext: %s\n"),
+                program_name, arg);
+        ::exit(1);
+      }
+  }
+
+  int
+  parse_thread_count(const char* arg)
+  {
+    char* endptr;
+    int count = strtol(arg, &endptr, 0);
+    if (*endptr != '\0' || count < 0)
+      {
+       fprintf(stderr, _("%s: invalid thread count: %s\n"),
+               program_name, arg);
+       ::exit(1);
+      }
+    return count;
+  }
+
+  void
+  set_threads()
+  { this->threads_ = true; }
+
+  void
+  clear_threads()
+  { this->threads_ = false; }
+
+  void
+  set_thread_count(const char* arg)
+  {
+    int count = this->parse_thread_count(arg);
+    this->thread_count_initial_ = count;
+    this->thread_count_middle_ = count;
+    this->thread_count_final_ = count;
+  }
+
+  void
+  set_thread_count_initial(const char* arg)
+  { this->thread_count_initial_ = this->parse_thread_count(arg); }
+
+  void
+  set_thread_count_middle(const char* arg)
+  { this->thread_count_initial_ = this->parse_thread_count(arg); }
+
+  void
+  set_thread_count_final(const char* arg)
+  { this->thread_count_initial_ = this->parse_thread_count(arg); }
+
   void
   ignore(const char*)
   { }
 
+  void
+  set_execstack()
+  { this->execstack_ = EXECSTACK_YES; }
+
+  void
+  set_noexecstack()
+  { this->execstack_ = EXECSTACK_NO; }
+
+  // Handle the -z option.
+  void
+  handle_z_option(const char*);
+
   // Apply any sysroot to the directory lists.
   void
   add_sysroot();
@@ -279,6 +459,10 @@ class General_options
   const char* output_file_name_;
   bool is_relocatable_;
   Strip strip_;
+  bool allow_shlib_undefined_;
+  bool symbolic_;
+  bool demangle_;
+  bool detect_odr_violations_;
   bool create_eh_frame_hdr_;
   Dir_list rpath_;
   Dir_list rpath_link_;
@@ -286,6 +470,12 @@ class General_options
   bool is_static_;
   bool print_stats_;
   std::string sysroot_;
+  uint64_t text_segment_address_;
+  bool threads_;
+  int thread_count_initial_;
+  int thread_count_middle_;
+  int thread_count_final_;
+  Execstack execstack_;
 };
 
 // The current state of the position dependent options.
@@ -295,8 +485,8 @@ class Position_dependent_options
  public:
   Position_dependent_options();
 
-  // -Bstatic: Whether we are searching for a static archive rather
-  // than a shared object.
+  // -Bdynamic/-Bstatic: Whether we are searching for a static archive
+  // -rather than a shared object.
   bool
   do_static_search() const
   { return this->do_static_search_; }
@@ -518,6 +708,11 @@ class Input_arguments
   in_group() const
   { return this->in_group_; }
 
+  // The number of entries in the list.
+  int
+  size() const
+  { return this->input_argument_list_.size(); }
+
   // Iterators to iterate over the list of input files.
 
   const_iterator
@@ -552,9 +747,14 @@ class Command_line
   void
   process(int argc, char** argv);
 
+  // Process one command-line option.  This takes the index of argv to
+  // process, and returns the index for the next option.
+  int
+  process_one_option(int argc, char** argv, int i, bool* no_more_options);
+
   // Handle a -l option.
   int
-  process_l_option(int, char**, char*);
+  process_l_option(int, char**, char*, bool);
 
   // Handle a --start-group option.
   void
@@ -564,11 +764,27 @@ class Command_line
   void
   end_group(const char* arg);
 
+  // Get an option argument--a helper function for special processing.
+  const char*
+  get_special_argument(const char* longname, int argc, char** argv,
+                      const char* arg, bool long_option,
+                      int *pret);
+
   // Get the general options.
   const General_options&
   options() const
   { return this->options_; }
 
+  // Get the position dependent options.
+  const Position_dependent_options&
+  position_dependent_options() const
+  { return this->position_options_; }
+
+  // The number of input files.
+  int
+  number_of_input_files() const
+  { return this->inputs_.size(); }
+
   // Iterators to iterate over the list of input files.
 
   const_iterator
This page took 0.025825 seconds and 4 git commands to generate.