// parameters.cc -- general parameters for a link using gold
-// 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.
#include "gold.h"
+#include "debug.h"
#include "options.h"
#include "target.h"
#include "target-select.h"
{
gold_assert(!this->options_valid());
this->options_ = options;
- // For speed, we make our own copy of the debug variable.
- this->debug_ = this->options().debug();
+ // For speed, we convert the options() debug var from a string to an
+ // enum (from debug.h).
+ this->debug_ = debug_string_to_enum(this->options().debug());
+ // If --verbose is set, it acts as "--debug=files".
+ if (options->verbose())
+ this->debug_ |= DEBUG_FILES;
}
void
Parameters::default_target() const
{
gold_assert(this->options_valid());
- if (this->options().oformat_string() != NULL)
+ if (this->options().user_set_oformat())
{
const Target* target
- = select_target_by_name(this->options().oformat_string());
+ = select_target_by_name(this->options().oformat());
if (target != NULL)
return *target;
gold_error(_("unrecognized output format %s"),
- this->options().oformat_string());
+ this->options().oformat());
}
// The GOLD_DEFAULT_xx macros are defined by the configure script.
const Target* target = select_target(elfcpp::GOLD_DEFAULT_MACHINE,
GOLD_DEFAULT_SIZE,
GOLD_DEFAULT_BIG_ENDIAN,
- 0, 0);
+ elfcpp::GOLD_DEFAULT_OSABI,
+ 0);
gold_assert(target != NULL);
return *target;
}
+// Return whether TARGET is compatible with the target we are using.
+
+bool
+Parameters::is_compatible_target(const Target* target) const
+{
+ if (this->target_ == NULL)
+ return true;
+ return target == this->target_;
+}
+
Parameters::Target_size_endianness
Parameters::size_and_endianness() const
{