-// be set to ELFOSABI_FREEBSD. This is a subclass of Sized_target
-// which supports that. The real target would be a subclass of this
-// one. We permit combining FreeBSD and non-FreeBSD object files.
-// The effect of this target is to set the code in the output file.
-
-template<int size, bool big_endian>
-class Target_freebsd : public Sized_target<size, big_endian>
-{
- public:
- // Set the value to use for the EI_OSABI field in the ELF header.
- void
- set_osabi(elfcpp::ELFOSABI osabi)
- { this->osabi_ = osabi; }
-
- protected:
- Target_freebsd(const Target::Target_info* pti)
- : Sized_target<size, big_endian>(pti),
- osabi_(elfcpp::ELFOSABI_NONE)
- { }
-
- virtual void
- do_adjust_elf_header(unsigned char* view, int len) const;
-
- private:
- // Value to store in the EI_OSABI field of the ELF file header.
- elfcpp::ELFOSABI osabi_;
-};
-
-// Adjust the ELF file header by storing the requested value in the
-// OSABI field. This is for FreeBSD support.
-
-template<int size, bool big_endian>
-inline void
-Target_freebsd<size, big_endian>::do_adjust_elf_header(unsigned char* view,
- int len) const
-{
- if (this->osabi_ != elfcpp::ELFOSABI_NONE)
- {
- gold_assert(len == elfcpp::Elf_sizes<size>::ehdr_size);
-
- elfcpp::Ehdr<size, false> ehdr(view);
- unsigned char e_ident[elfcpp::EI_NIDENT];
- memcpy(e_ident, ehdr.get_e_ident(), elfcpp::EI_NIDENT);
-
- e_ident[elfcpp::EI_OSABI] = this->osabi_;
-
- elfcpp::Ehdr_write<size, false> oehdr(view);
- oehdr.put_e_ident(e_ident);
- }
-}
-
-// A target selector for targets which permit combining both FreeBSD
-// and non-FreeBSD object files.