X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gold%2Fparameters.h;h=88d8a870323cff9727cac299d7d5ee1476143472;hb=a4216f37f01bff1fbed08d32ab6bf1f34d2ea3d2;hp=ce165dd9d14e88d9b418bee0708f2411f522d87f;hpb=ebdbb4583d9b05504b1ca7e4f6c370f5d355e9bd;p=deliverable%2Fbinutils-gdb.git diff --git a/gold/parameters.h b/gold/parameters.h index ce165dd9d1..88d8a87032 100644 --- a/gold/parameters.h +++ b/gold/parameters.h @@ -29,6 +29,8 @@ namespace gold class General_options; class Errors; class Target; +template +class Sized_target; // Here we define the Parameters class which simply holds simple // general parameters which apply to the entire link. We use a global @@ -61,7 +63,7 @@ class Parameters set_options(const General_options* options); void - set_target(const Target* target); + set_target(Target* target); void set_doing_static_link(bool doing_static_link); @@ -98,10 +100,24 @@ class Parameters return *this->target_; } - // When we don't have an output file to associate a target, make a - // default one, with guesses about size and endianness. - const Target& - default_target() const; + // The Sized_target of the output file. The caller must request the + // right size and endianness. + template + Sized_target* + sized_target() const + { + gold_assert(this->target_valid()); + return static_cast*>(this->target_); + } + + // Clear the target, for testing. + void + clear_target() + { this->target_ = NULL; } + + // Return true if TARGET is compatible with the current target. + bool + is_compatible_target(const Target*) const; bool doing_static_link() const @@ -136,7 +152,7 @@ class Parameters private: Errors* errors_; const General_options* options_; - const Target* target_; + Target* target_; bool doing_static_link_valid_; bool doing_static_link_; int debug_; @@ -155,11 +171,22 @@ extern void set_parameters_options(const General_options* options); extern void -set_parameters_target(const Target* target); +set_parameters_target(Target* target); extern void set_parameters_doing_static_link(bool doing_static_link); - + +// Ensure that the target to be valid by using the default target if +// necessary. + +extern void +parameters_force_valid_target(); + +// Clear the current target, for testing. + +extern void +parameters_clear_target(); + // Return whether we are doing a particular debugging type. The // argument is one of the flags from debug.h.