Compress all debug sections.
[platform/upstream/binutils.git] / gold / options.h
index 4b774ac..b327aa9 100644 (file)
@@ -46,11 +46,13 @@ class Command_line;
 class Input_file_group;
 class Position_dependent_options;
 
-namespace options {
+namespace options
+{
 
 class Command_line_options;
 struct One_option;
 struct One_z_option;
+struct One_debug_option;
 
 } // End namespace gold::options.
 
@@ -148,11 +150,44 @@ class General_options
   strip_debug() const
   { return this->strip_ == STRIP_ALL || this->strip_ == STRIP_DEBUG; }
 
+  // --strip-debug-gdb: 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_; }
 
+  // --compress-debug-sections: compress .debug_* sections in the
+  // output file using the given compression method.  This is useful
+  // when the tools (such as gdb) support compressed sections.
+  bool
+  compress_debug_sections() const
+  { return this->compress_debug_sections_ != NO_COMPRESSION; }
+
+  bool
+  zlib_compress_debug_sections() const
+  { return this->compress_debug_sections_ == ZLIB_COMPRESSION; }
+
+  // --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
@@ -227,6 +262,11 @@ class General_options
   is_stack_executable() const
   { return this->execstack_ == EXECSTACK_YES; }
 
+  // --debug
+  unsigned int
+  debug() const
+  { return this->debug_; }
+
  private:
   // Don't copy this structure.
   General_options(const General_options&);
@@ -243,7 +283,9 @@ 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.
@@ -257,6 +299,13 @@ class General_options
     EXECSTACK_NO
   };
 
+  // What compression method to use
+  enum CompressionMethod
+  {
+    NO_COMPRESSION,
+    ZLIB_COMPRESSION,
+  };
+
   void
   set_export_dynamic()
   { this->export_dynamic_ = true; }
@@ -296,9 +345,46 @@ class General_options
   { 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_compress_debug_symbols(const char* arg)
+  {
+    if (strcmp(arg, "none") == 0)
+      this->compress_debug_sections_ = NO_COMPRESSION;
+#ifdef HAVE_ZLIB_H
+    else if (strcmp(arg, "zlib") == 0)
+      this->compress_debug_sections_ = ZLIB_COMPRESSION;
+#endif
+    else
+      gold_fatal(_("Unsupported argument to --compress-debug-symbols: %s"),
+                 arg);
+  }
+
+  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; }
@@ -396,10 +482,18 @@ class General_options
   set_noexecstack()
   { this->execstack_ = EXECSTACK_NO; }
 
+  void
+  set_debug(unsigned int flags)
+  { this->debug_ = flags; }
+
   // Handle the -z option.
   void
   handle_z_option(const char*);
 
+  // Handle the --debug option.
+  void
+  handle_debug_option(const char*);
+
   // Apply any sysroot to the directory lists.
   void
   add_sysroot();
@@ -411,7 +505,11 @@ class General_options
   const char* output_file_name_;
   bool is_relocatable_;
   Strip strip_;
+  bool allow_shlib_undefined_;
   bool symbolic_;
+  CompressionMethod compress_debug_sections_;
+  bool demangle_;
+  bool detect_odr_violations_;
   bool create_eh_frame_hdr_;
   Dir_list rpath_;
   Dir_list rpath_link_;
@@ -425,6 +523,7 @@ class General_options
   int thread_count_middle_;
   int thread_count_final_;
   Execstack execstack_;
+  unsigned int debug_;
 };
 
 // The current state of the position dependent options.