1 // target-select.cc -- select a target for an object file
6 #include "target-select.h"
11 // The start of the list of target selectors.
13 gold::Target_selector
* target_selectors
;
15 } // End anonymous namespace.
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
24 Target_selector::Target_selector(int machine
, int size
, bool big_endian
)
25 : machine_(machine
), size_(size
), big_endian_(big_endian
)
27 this->next_
= target_selectors
;
28 target_selectors
= this;
31 // Find the target for an ELF file.
34 select_target(int machine
, int size
, bool big_endian
, int osabi
,
37 for (const Target_selector
* p
= target_selectors
; p
!= NULL
; p
= p
->next())
39 int pmach
= p
->machine();
40 if ((pmach
== machine
|| pmach
== elfcpp::EM_NONE
)
42 && p
->big_endian() ? big_endian
: !big_endian
)
44 Target
* ret
= p
->recognize(machine
, osabi
, abiversion
);
52 } // End namespace gold.