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

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [gnu/] [binutils/] [gold/] [freebsd.h] - Blame information for rev 159

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 khays
// freebsd.h -- FreeBSD support for gold    -*- C++ -*-
2
 
3 159 khays
// Copyright 2009, 2011 Free Software Foundation, Inc.
4 27 khays
// Written by Ian Lance Taylor <iant@google.com>.
5
 
6
// This file is part of gold.
7
 
8
// This program is free software; you can redistribute it and/or modify
9
// it under the terms of the GNU General Public License as published by
10
// the Free Software Foundation; either version 3 of the License, or
11
// (at your option) any later version.
12
 
13
// This program is distributed in the hope that it will be useful,
14
// but WITHOUT ANY WARRANTY; without even the implied warranty of
15
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
// GNU General Public License for more details.
17
 
18
// You should have received a copy of the GNU General Public License
19
// along with this program; if not, write to the Free Software
20
// Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
21
// MA 02110-1301, USA.
22
 
23
#include "target.h"
24
#include "target-select.h"
25
 
26
#ifndef GOLD_FREEBSD_H
27
#define GOLD_FREEBSD_H
28
 
29
namespace gold
30
{
31
 
32
// FreeBSD 4.1 and later wants the EI_OSABI field in the ELF header to
33 159 khays
// be set to ELFOSABI_FREEBSD.  This is a target selector for targets
34
// which permit combining both FreeBSD and non-FreeBSD object files.
35 27 khays
 
36
class Target_selector_freebsd : public Target_selector
37
{
38
 public:
39
  Target_selector_freebsd(int machine, int size, bool is_big_endian,
40
                          const char* bfd_name,
41 159 khays
                          const char* freebsd_bfd_name,
42
                          const char* emulation)
43
    : Target_selector(machine, size, is_big_endian, NULL, emulation),
44 27 khays
      bfd_name_(bfd_name), freebsd_bfd_name_(freebsd_bfd_name)
45
  { }
46
 
47
 protected:
48
  // If we see a FreeBSD input file, mark the output file as using
49
  // FreeBSD.
50
  virtual Target*
51
  do_recognize(int, int osabi, int)
52
  {
53
    Target* ret = this->instantiate_target();
54
    if (osabi == elfcpp::ELFOSABI_FREEBSD)
55 159 khays
      ret->set_osabi(static_cast<elfcpp::ELFOSABI>(osabi));
56 27 khays
    return ret;
57
  }
58
 
59
  // Recognize two names.
60
  virtual Target*
61 159 khays
  do_recognize_by_bfd_name(const char* name)
62 27 khays
  {
63
    if (strcmp(name, this->bfd_name_) == 0)
64
      return this->instantiate_target();
65
    else if (strcmp(name, this->freebsd_bfd_name_) == 0)
66
      {
67
        Target* ret = this->instantiate_target();
68 159 khays
        ret->set_osabi(elfcpp::ELFOSABI_FREEBSD);
69 27 khays
        return ret;
70
      }
71
    else
72
      return NULL;
73
  }
74
 
75
  // Print both names in --help output.
76
  virtual void
77 159 khays
  do_supported_bfd_names(std::vector<const char*>* names)
78 27 khays
  {
79
    names->push_back(this->bfd_name_);
80
    names->push_back(this->freebsd_bfd_name_);
81
  }
82
 
83 159 khays
  // Return appropriate BFD name.
84
  virtual const char*
85
  do_target_bfd_name(const Target* target)
86 27 khays
  {
87 159 khays
    if (!this->is_our_target(target))
88
      return NULL;
89
    return (target->osabi() == elfcpp::ELFOSABI_FREEBSD
90
            ? this->freebsd_bfd_name_
91
            : this->bfd_name_);
92 27 khays
  }
93
 
94 159 khays
 private:
95 27 khays
  // The BFD name for the non-Freebsd target.
96
  const char* bfd_name_;
97
  // The BFD name for the Freebsd target.
98
  const char* freebsd_bfd_name_;
99
};
100
 
101
} // end namespace gold
102
 
103
#endif // !defined(GOLD_FREEBSD_H)

powered by: WebSVN 2.1.0

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