+ is_big_endian() const
+ { return this->is_big_endian_; }
+
+ // Return the BFD name. This may return NULL, in which case the
+ // do_recognize_by_bfd_name hook will be responsible for matching
+ // the BFD name.
+ const char*
+ bfd_name() const
+ { 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:
+ // Return an instance of the real target. This must be implemented
+ // by the child class.
+ virtual Target*
+ do_instantiate_target() = 0;
+
+ // Recognize an object file given a machine code, OSABI code, and
+ // ELF version value. When this is called we already know that they
+ // match the machine_, size_, and is_big_endian_ fields. The child
+ // class may implement a different version of this to do additional
+ // checks, or to check for multiple machine codes if the machine_
+ // field is EM_NONE.
+ virtual Target*
+ 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
+ // that the name matches (or that the bfd_name_ field is NULL). The
+ // child class may implement a different version of this to
+ // recognize more than one name.
+ virtual Target*
+ do_recognize_by_bfd_name(const char*)
+ { return this->instantiate_target(); }
+
+ // Return a list of supported BFD names. The child class may
+ // implement a different version of this to handle more than one
+ // name.
+ virtual void
+ do_supported_bfd_names(std::vector<const char*>* names)
+ {
+ gold_assert(this->bfd_name_ != NULL);
+ 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.
+ Target*
+ instantiate_target();
+
+ // Return whether TARGET is the target we instantiated.
+ bool
+ is_our_target(const Target* target)
+ { return target == this->instantiated_target_; }