daily update
[external/binutils.git] / gold / options.h
index cae1b1a..47623dc 100644 (file)
@@ -1,6 +1,6 @@
 // options.h -- handle command line options for gold  -*- C++ -*-
 
-// Copyright 2006, 2007 Free Software Foundation, Inc.
+// Copyright 2006, 2007, 2008 Free Software Foundation, Inc.
 // Written by Ian Lance Taylor <iant@google.com>.
 
 // This file is part of gold.
@@ -106,13 +106,23 @@ class Search_directory
 class General_options
 {
  public:
-  General_options();
+  General_options(Script_options*);
+
+  // -e: set entry address.
+  const char*
+  entry() const
+  { return this->script_options_->entry(); }
 
   // -E: export dynamic symbols.
   bool
   export_dynamic() const
   { return this->export_dynamic_; }
 
+  // -h: shared library name.
+  const char*
+  soname() const
+  { return this->soname_; }
+
   // -I: dynamic linker name.
   const char*
   dynamic_linker() const
@@ -223,6 +233,11 @@ class General_options
   sysroot() const
   { return this->sysroot_; }
 
+  // --version-script: The version script to apply if --shared is true.
+  const Version_script_info&
+  version_script() const
+  { return *this->script_options_->version_script_info(); }
+
   // -Ttext: The address of the .text section
   uint64_t
   text_segment_address() const
@@ -267,6 +282,15 @@ class General_options
   debug() const
   { return this->debug_; }
 
+  // Return the options which may be set from a linker script.
+  Script_options*
+  script_options()
+  { return this->script_options_; }
+
+  const Script_options*
+  script_options() const
+  { return this->script_options_; }
+
  private:
   // Don't copy this structure.
   General_options(const General_options&);
@@ -307,10 +331,18 @@ class General_options
   };
 
   void
+  set_entry(const char* arg)
+  { this->script_options_->set_entry(arg, strlen(arg)); }
+
+  void
   set_export_dynamic()
   { this->export_dynamic_ = true; }
 
   void
+  set_soname(const char* arg)
+  { this->soname_ = arg; }
+
+  void
   set_dynamic_linker(const char* arg)
   { this->dynamic_linker_ = arg; }
 
@@ -379,6 +411,9 @@ class General_options
   }
 
   void
+  define_symbol(const char* arg);
+
+  void
   set_demangle()
   { this->demangle_ = true; }
 
@@ -501,6 +536,7 @@ class General_options
   add_sysroot();
 
   bool export_dynamic_;
+  const char* soname_;
   const char* dynamic_linker_;
   Dir_list search_path_;
   int optimization_level_;
@@ -526,6 +562,9 @@ class General_options
   int thread_count_final_;
   Execstack execstack_;
   unsigned int debug_;
+  // Some options can also be set from linker scripts.  Those are
+  // stored here.
+  Script_options* script_options_;
 };
 
 // The current state of the position dependent options.
@@ -790,7 +829,7 @@ class Command_line
  public:
   typedef Input_arguments::const_iterator const_iterator;
 
-  Command_line();
+  Command_line(Script_options*);
 
   // Process the command line options.  This will exit with an
   // appropriate error message if an unrecognized option is seen.
@@ -830,6 +869,15 @@ class Command_line
   position_dependent_options() const
   { return this->position_options_; }
 
+  // Get the options which may be set from a linker script.
+  Script_options*
+  script_options()
+  { return this->options_.script_options(); }
+
+  const Script_options*
+  script_options() const
+  { return this->options_.script_options(); }
+
   // The number of input files.
   int
   number_of_input_files() const