OpenCores
URL https://opencores.org/ocsvn/open8_urisc/open8_urisc/trunk

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [gnu/] [binutils/] [gold/] [target-select.h] - Diff between revs 27 and 159

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 27 Rev 159
Line 1... Line 1...
// target-select.h -- select a target for an object file  -*- C++ -*-
// target-select.h -- select a target for an object file  -*- C++ -*-
 
 
// Copyright 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
// Copyright 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
// Written by Ian Lance Taylor <iant@google.com>.
// Written by Ian Lance Taylor <iant@google.com>.
 
 
// This file is part of gold.
// This file is part of gold.
 
 
// This program is free software; you can redistribute it and/or modify
// This program is free software; you can redistribute it and/or modify
Line 63... Line 63...
 public:
 public:
  // Create a target selector for a specific machine number, size (32
  // Create a target selector for a specific machine number, size (32
  // or 64), and endianness.  The machine number can be EM_NONE to
  // or 64), and endianness.  The machine number can be EM_NONE to
  // test for any machine number.  BFD_NAME is the name of the target
  // test for any machine number.  BFD_NAME is the name of the target
  // used by the GNU linker, for backward compatibility; it may be
  // used by the GNU linker, for backward compatibility; it may be
  // NULL.
  // NULL.  EMULATION is the name of the emulation used by the GNU
 
  // linker; it is similar to BFD_NAME.
  Target_selector(int machine, int size, bool is_big_endian,
  Target_selector(int machine, int size, bool is_big_endian,
                  const char* bfd_name);
                  const char* bfd_name, const char* emulation);
 
 
  virtual ~Target_selector()
  virtual ~Target_selector()
  { }
  { }
 
 
  // If we can handle this target, return a pointer to a target
  // If we can handle this target, return a pointer to a target
Line 79... Line 80...
  { return this->do_recognize(machine, osabi, abiversion); }
  { return this->do_recognize(machine, osabi, abiversion); }
 
 
  // If NAME matches the target, return a pointer to a target
  // If NAME matches the target, return a pointer to a target
  // structure.
  // structure.
  Target*
  Target*
  recognize_by_name(const char* name)
  recognize_by_bfd_name(const char* name)
  { return this->do_recognize_by_name(name); }
  { return this->do_recognize_by_bfd_name(name); }
 
 
  // Push all supported names onto the vector.  This is only used for
  // Push all supported BFD names onto the vector.  This is only used
  // help output.
  // for help output.
  void
  void
  supported_names(std::vector<const char*>* names)
  supported_bfd_names(std::vector<const char*>* names)
  { this->do_supported_names(names); }
  { this->do_supported_bfd_names(names); }
 
 
 
  // If NAME matches the target emulation, return a pointer to a
 
  // target structure.
 
  Target*
 
  recognize_by_emulation(const char* name)
 
  { return this->do_recognize_by_emulation(name); }
 
 
 
  // Push all supported emulations onto the vector.  This is only used
 
  // for help output.
 
  void
 
  supported_emulations(std::vector<const char*>* names)
 
  { this->do_supported_emulations(names); }
 
 
  // Return the next Target_selector in the linked list.
  // Return the next Target_selector in the linked list.
  Target_selector*
  Target_selector*
  next() const
  next() const
  { return this->next_; }
  { return this->next_; }
Line 112... Line 125...
  bool
  bool
  is_big_endian() const
  is_big_endian() const
  { return this->is_big_endian_; }
  { return this->is_big_endian_; }
 
 
  // Return the BFD name.  This may return NULL, in which case the
  // Return the BFD name.  This may return NULL, in which case the
  // do_recognize_by_name hook will be responsible for matching the
  // do_recognize_by_bfd_name hook will be responsible for matching
  // BFD name.
  // the BFD name.
  const char*
  const char*
  bfd_name() const
  bfd_name() const
  { return this->bfd_name_; }
  { return this->bfd_name_; }
 
 
 
  // Return the emulation.  This may return NULL, in which case the
 
  // do_recognize_by_emulation hook will be responsible for matching
 
  // the emulation.
 
  const char*
 
  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:
 protected:
  // Return an instance of the real target.  This must be implemented
  // Return an instance of the real target.  This must be implemented
  // by the child class.
  // by the child class.
  virtual Target*
  virtual Target*
  do_instantiate_target() = 0;
  do_instantiate_target() = 0;
Line 139... Line 166...
  // Recognize a target by name.  When this is called we already know
  // Recognize a target by name.  When this is called we already know
  // that the name matches (or that the bfd_name_ field is NULL).  The
  // that the name matches (or that the bfd_name_ field is NULL).  The
  // child class may implement a different version of this to
  // child class may implement a different version of this to
  // recognize more than one name.
  // recognize more than one name.
  virtual Target*
  virtual Target*
  do_recognize_by_name(const char*)
  do_recognize_by_bfd_name(const char*)
  { return this->instantiate_target(); }
  { return this->instantiate_target(); }
 
 
  // Return a list of supported BFD names.  The child class may
  // Return a list of supported BFD names.  The child class may
  // implement a different version of this to handle more than one
  // implement a different version of this to handle more than one
  // name.
  // name.
  virtual void
  virtual void
  do_supported_names(std::vector<const char*>* names)
  do_supported_bfd_names(std::vector<const char*>* names)
  {
  {
    gold_assert(this->bfd_name_ != NULL);
    gold_assert(this->bfd_name_ != NULL);
    names->push_back(this->bfd_name_);
    names->push_back(this->bfd_name_);
  }
  }
 
 
 
  // Recognize a target by emulation.  When this is called we already
 
  // know that the name matches (or that the emulation_ field is
 
  // NULL).  The child class may implement a different version of this
 
  // to recognize more than one emulation.
 
  virtual Target*
 
  do_recognize_by_emulation(const char*)
 
  { return this->instantiate_target(); }
 
 
 
  // Return a list of supported emulations.  The child class may
 
  // implement a different version of this to handle more than one
 
  // emulation.
 
  virtual void
 
  do_supported_emulations(std::vector<const char*>* emulations)
 
  {
 
    gold_assert(this->emulation_ != NULL);
 
    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.
  // Instantiate the target and return it.
  Target*
  Target*
  instantiate_target();
  instantiate_target();
 
 
 
  // Return whether TARGET is the target we instantiated.
 
  bool
 
  is_our_target(const Target* target)
 
  { return target == this->instantiated_target_; }
 
 
 private:
 private:
  // Set the target.
  // Set the target.
  void
  void
  set_target();
  set_target();
 
 
Line 171... Line 225...
  const int size_;
  const int size_;
  // Whether the target is big endian.
  // Whether the target is big endian.
  const bool is_big_endian_;
  const bool is_big_endian_;
  // BFD name of target, for compatibility.
  // BFD name of target, for compatibility.
  const char* const bfd_name_;
  const char* const bfd_name_;
 
  // GNU linker emulation for this target, for compatibility.
 
  const char* const emulation_;
  // Next entry in list built at global constructor time.
  // Next entry in list built at global constructor time.
  Target_selector* next_;
  Target_selector* next_;
  // The singleton Target structure--this points to an instance of the
  // The singleton Target structure--this points to an instance of the
  // real implementation.
  // real implementation.
  Target* instantiated_target_;
  Target* instantiated_target_;
Line 189... Line 245...
              int abiversion);
              int abiversion);
 
 
// Select a target using a BFD name.
// Select a target using a BFD name.
 
 
extern Target*
extern Target*
select_target_by_name(const char* name);
select_target_by_bfd_name(const char* name);
 
 
 
// Select a target using a GNU linker emulation.
 
 
 
extern Target*
 
select_target_by_emulation(const char* name);
 
 
// Fill in a vector with the list of supported targets.  This returns
// Fill in a vector with the list of supported targets.  This returns
// a list of BFD names.
// a list of BFD names.
 
 
extern void
extern void
supported_target_names(std::vector<const char*>*);
supported_target_names(std::vector<const char*>*);
 
 
 
// Fill in a vector with the list of supported emulations.
 
 
 
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.
} // End namespace gold.
 
 
#endif // !defined(GOLD_TARGET_SELECT_H)
#endif // !defined(GOLD_TARGET_SELECT_H)
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.