daily update
[external/binutils.git] / gold / options.h
index 4cb7608..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,12 +106,12 @@ class Search_directory
 class General_options
 {
  public:
-  General_options();
+  General_options(Script_options*);
 
   // -e: set entry address.
   const char*
   entry() const
-  { return this->entry_; }
+  { return this->script_options_->entry(); }
 
   // -E: export dynamic symbols.
   bool
@@ -233,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
@@ -277,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&);
@@ -318,7 +332,7 @@ class General_options
 
   void
   set_entry(const char* arg)
-  { this->entry_ = arg; }
+  { this->script_options_->set_entry(arg, strlen(arg)); }
 
   void
   set_export_dynamic()
@@ -397,6 +411,9 @@ class General_options
   }
 
   void
+  define_symbol(const char* arg);
+
+  void
   set_demangle()
   { this->demangle_ = true; }
 
@@ -518,7 +535,6 @@ class General_options
   void
   add_sysroot();
 
-  const char* entry_;
   bool export_dynamic_;
   const char* soname_;
   const char* dynamic_linker_;
@@ -546,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.
@@ -810,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.
@@ -834,11 +853,6 @@ class Command_line
   void
   end_group(const char* arg);
 
-  // Set the entry symbol from a linker script.
-  void
-  set_entry(const char* entry)
-  { this->options_.set_entry(entry); }
-
   // Get an option argument--a helper function for special processing.
   const char*
   get_special_argument(const char* longname, int argc, char** argv,
@@ -855,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