Remove unnecessary elfcpp_config.h file.
[deliverable/binutils-gdb.git] / gold / target-select.h
CommitLineData
14bfc3f5
ILT
1// target-select.h -- select a target for an object file -*- C++ -*-
2
3#ifndef GOLD_TARGET_SELECT_H
4#define GOLD_TARGET_SELECT_H
5
6namespace gold
7{
8
9class Target;
10
11// We want to avoid a master list of targets, which implies using a
12// global constructor. And we also want the program to start up as
13// quickly as possible, which implies avoiding global constructors.
14// We compromise on a very simple global constructor. We use a target
15// selector, which specifies an ELF machine number and a recognition
16// function. We use global constructors to build a linked list of
17// target selectors--a simple pointer list, not a std::list.
18
19class Target_selector
20{
21 public:
22 // Create a target selector for a specific machine number, size (32
23 // or 64), and endianness. The machine number can be EM_NONE to
24 // test for any machine number.
25 Target_selector(int machine, int size, bool big_endian);
26
27 virtual ~Target_selector()
28 { }
29
30 // If we can handle this target, return a pointer to a target
31 // structure. The size and endianness are known.
ead1e424 32 virtual Target* recognize(int machine, int osabi, int abiversion) = 0;
14bfc3f5
ILT
33
34 // Return the next Target_selector in the linked list.
35 Target_selector*
36 next() const
37 { return this->next_; }
38
39 // Return the machine number this selector is looking for, which can
40 // be EM_NONE to match any machine number.
41 int
42 machine() const
43 { return this->machine_; }
44
45 // Return the size this is looking for (32 or 64).
46 int
47 size() const
48 { return this->size_; }
49
50 // Return the endianness this is looking for.
51 bool
52 big_endian() const
53 { return this->big_endian_; }
54
55 private:
56 int machine_;
57 int size_;
58 bool big_endian_;
59 Target_selector* next_;
60};
61
62// Select the target for an ELF file.
63
64extern Target* select_target(int machine, int size, bool big_endian,
65 int osabi, int abiversion);
66
67} // End namespace gold.
68
69#endif // !defined(GOLD_TARGET_SELECT_H)
This page took 0.060804 seconds and 4 git commands to generate.