// target-select.h -- select a target for an object file -*- C++ -*-
-// Copyright 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+// Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012
+// Free Software Foundation, Inc.
// Written by Ian Lance Taylor <iant@google.com>.
// This file is part of gold.
namespace gold
{
+class Input_file;
class Target;
class Target_selector;
// If we can handle this target, return a pointer to a target
// structure. The size and endianness are known.
Target*
- recognize(int machine, int osabi, int abiversion)
- { return this->do_recognize(machine, osabi, abiversion); }
+ recognize(Input_file* input_file, off_t offset,
+ int machine, int osabi, int abiversion)
+ { return this->do_recognize(input_file, offset, machine, osabi, abiversion); }
// If NAME matches the target, return a pointer to a target
// structure.
emulation() const
{ return this->emulation_; }
+ // The reverse mapping, for --print-output-format: if we
+ // instantiated TARGET, return our BFD_NAME. If we did not
+ // instantiate it, return NULL.
+ const char*
+ target_bfd_name(const Target* target)
+ { return this->do_target_bfd_name(target); }
+
protected:
// Return an instance of the real target. This must be implemented
// by the child class.
// checks, or to check for multiple machine codes if the machine_
// field is EM_NONE.
virtual Target*
- do_recognize(int, int, int)
+ do_recognize(Input_file*, off_t, int, int, int)
{ return this->instantiate_target(); }
// Recognize a target by name. When this is called we already know
emulations->push_back(this->emulation_);
}
+ // Map from target to BFD name.
+ virtual const char*
+ do_target_bfd_name(const Target*);
+
// Instantiate the target and return it.
Target*
instantiate_target();
+ // Return whether TARGET is the target we instantiated.
+ bool
+ is_our_target(const Target* target)
+ { return target == this->instantiated_target_; }
+
private:
// Set the target.
void
// Select the target for an ELF file.
extern Target*
-select_target(int machine, int size, bool big_endian, int osabi,
+select_target(Input_file*, off_t,
+ int machine, int size, bool big_endian, int osabi,
int abiversion);
// Select a target using a BFD name.
extern void
supported_emulation_names(std::vector<const char*>*);
+// Print the output format, for the --print-output-format option.
+
+extern void
+print_output_format();
+
} // End namespace gold.
#endif // !defined(GOLD_TARGET_SELECT_H)