Commit | Line | Data |
---|---|---|
c06b7b0b ILT |
1 | // reloc-types.h -- ELF relocation templates for gold -*- C++ -*- |
2 | ||
3 | // This header files defines a few convenient templated types for use | |
4 | // when handling ELF relocations. | |
5 | ||
6 | #ifndef GOLD_RELOC_TYPES_H | |
7 | #define GOLD_RELOC_TYPES_H | |
8 | ||
9 | #include "elfcpp.h" | |
10 | ||
11 | namespace gold | |
12 | { | |
13 | ||
14 | // Pick the ELF relocation accessor class and the size based on | |
15 | // SH_TYPE, which is either elfcpp::SHT_REL or elfcpp::SHT_RELA. | |
16 | ||
17 | template<int sh_type, int size, bool big_endian> | |
18 | struct Reloc_types; | |
19 | ||
20 | template<int size, bool big_endian> | |
21 | struct Reloc_types<elfcpp::SHT_REL, size, big_endian> | |
22 | { | |
23 | typedef typename elfcpp::Rel<size, big_endian> Reloc; | |
24 | static const int reloc_size = elfcpp::Elf_sizes<size>::rel_size; | |
25 | }; | |
26 | ||
27 | template<int size, bool big_endian> | |
28 | struct Reloc_types<elfcpp::SHT_RELA, size, big_endian> | |
29 | { | |
30 | typedef typename elfcpp::Rela<size, big_endian> Reloc; | |
31 | static const int reloc_size = elfcpp::Elf_sizes<size>::rela_size; | |
32 | }; | |
33 | ||
34 | }; // End namespace gold. | |
35 | ||
36 | #endif // !defined(GOLD_RELOC_TYPE_SH) |