Fix typo in comment.
[deliverable/binutils-gdb.git] / gold / target-select.cc
CommitLineData
14bfc3f5
ILT
1// target-select.cc -- select a target for an object file
2
3#include "gold.h"
4
5#include "elfcpp.h"
6#include "target-select.h"
7
8namespace
9{
10
11// The start of the list of target selectors.
12
13gold::Target_selector* target_selectors;
14
15} // End anonymous namespace.
16
17namespace gold
18{
19
20// Construct a Target_selector, which means adding it to the linked
21// list. This runs at global constructor time, so we want it to be
22// fast.
23
24Target_selector::Target_selector(int machine, int size, bool big_endian)
25 : machine_(machine), size_(size), big_endian_(big_endian)
26{
27 this->next_ = target_selectors;
28 target_selectors = this;
29}
30
31// Find the target for an ELF file.
32
33extern Target*
34select_target(int machine, int size, bool big_endian, int osabi,
35 int abiversion)
36{
37 for (const Target_selector* p = target_selectors; p != NULL; p = p->next())
38 {
39 int pmach = p->machine();
40 if ((pmach == machine || pmach == elfcpp::EM_NONE)
41 && p->size() == size
42 && p->big_endian() ? big_endian : !big_endian)
43 {
44 Target* ret = p->recognize(machine, osabi, abiversion);
45 if (ret != NULL)
46 return ret;
47 }
48 }
49 return NULL;
50}
51
52} // End namespace gold.
This page took 0.029078 seconds and 4 git commands to generate.