OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Target-specific ELF type traits. | 5 // Target-specific ELF type traits. |
6 | 6 |
7 #ifndef TOOLS_RELOCATION_PACKER_SRC_ELF_TRAITS_H_ | 7 #ifndef TOOLS_RELOCATION_PACKER_SRC_ELF_TRAITS_H_ |
8 #define TOOLS_RELOCATION_PACKER_SRC_ELF_TRAITS_H_ | 8 #define TOOLS_RELOCATION_PACKER_SRC_ELF_TRAITS_H_ |
9 | 9 |
10 #include "elf.h" | 10 #include "elf.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 typedef Elf32_Xword Xword; | 50 typedef Elf32_Xword Xword; |
51 | 51 |
52 static inline Ehdr* getehdr(Elf* elf) { return elf32_getehdr(elf); } | 52 static inline Ehdr* getehdr(Elf* elf) { return elf32_getehdr(elf); } |
53 static inline Phdr* getphdr(Elf* elf) { return elf32_getphdr(elf); } | 53 static inline Phdr* getphdr(Elf* elf) { return elf32_getphdr(elf); } |
54 static inline Shdr* getshdr(Elf_Scn* scn) { return elf32_getshdr(scn); } | 54 static inline Shdr* getshdr(Elf_Scn* scn) { return elf32_getshdr(scn); } |
55 | 55 |
56 enum { kMachine = EM_ARM }; | 56 enum { kMachine = EM_ARM }; |
57 enum { kFileClass = ELFCLASS32 }; | 57 enum { kFileClass = ELFCLASS32 }; |
58 enum { kRelativeRelocationCode = R_ARM_RELATIVE }; | 58 enum { kRelativeRelocationCode = R_ARM_RELATIVE }; |
59 enum { kNoRelocationCode = R_ARM_NONE }; | 59 enum { kNoRelocationCode = R_ARM_NONE }; |
| 60 enum { kGnuStackSegmentAlignment = 0 }; |
60 | 61 |
61 static inline const char* Machine() { return "ARM"; } | 62 static inline const char* Machine() { return "ARM"; } |
62 | 63 |
63 # define ELF_R_SYM(val) ELF32_R_SYM(val) | 64 # define ELF_R_SYM(val) ELF32_R_SYM(val) |
64 # define ELF_R_TYPE(val) ELF32_R_TYPE(val) | 65 # define ELF_R_TYPE(val) ELF32_R_TYPE(val) |
65 # define ELF_R_INFO(sym, type) ELF32_R_INFO(sym, type) | 66 # define ELF_R_INFO(sym, type) ELF32_R_INFO(sym, type) |
66 # define ELF_ST_TYPE(val) ELF32_ST_TYPE(val) | 67 # define ELF_ST_TYPE(val) ELF32_ST_TYPE(val) |
67 }; | 68 }; |
68 | 69 |
69 #elif defined(TARGET_ARM64) | 70 #elif defined(TARGET_ARM64) |
(...skipping 13 matching lines...) Expand all Loading... |
83 typedef Elf64_Xword Xword; | 84 typedef Elf64_Xword Xword; |
84 | 85 |
85 static inline Ehdr* getehdr(Elf* elf) { return elf64_getehdr(elf); } | 86 static inline Ehdr* getehdr(Elf* elf) { return elf64_getehdr(elf); } |
86 static inline Phdr* getphdr(Elf* elf) { return elf64_getphdr(elf); } | 87 static inline Phdr* getphdr(Elf* elf) { return elf64_getphdr(elf); } |
87 static inline Shdr* getshdr(Elf_Scn* scn) { return elf64_getshdr(scn); } | 88 static inline Shdr* getshdr(Elf_Scn* scn) { return elf64_getshdr(scn); } |
88 | 89 |
89 enum { kMachine = EM_AARCH64 }; | 90 enum { kMachine = EM_AARCH64 }; |
90 enum { kFileClass = ELFCLASS64 }; | 91 enum { kFileClass = ELFCLASS64 }; |
91 enum { kRelativeRelocationCode = R_AARCH64_RELATIVE }; | 92 enum { kRelativeRelocationCode = R_AARCH64_RELATIVE }; |
92 enum { kNoRelocationCode = R_AARCH64_NONE }; | 93 enum { kNoRelocationCode = R_AARCH64_NONE }; |
| 94 enum { kGnuStackSegmentAlignment = 16 }; |
93 | 95 |
94 static inline const char* Machine() { return "ARM64"; } | 96 static inline const char* Machine() { return "ARM64"; } |
95 | 97 |
96 # define ELF_R_SYM(val) ELF64_R_SYM(val) | 98 # define ELF_R_SYM(val) ELF64_R_SYM(val) |
97 # define ELF_R_TYPE(val) ELF64_R_TYPE(val) | 99 # define ELF_R_TYPE(val) ELF64_R_TYPE(val) |
98 # define ELF_R_INFO(sym, type) ELF64_R_INFO(sym, type) | 100 # define ELF_R_INFO(sym, type) ELF64_R_INFO(sym, type) |
99 # define ELF_ST_TYPE(val) ELF64_ST_TYPE(val) | 101 # define ELF_ST_TYPE(val) ELF64_ST_TYPE(val) |
100 }; | 102 }; |
101 #endif | 103 #endif |
102 | 104 |
103 #endif // TOOLS_RELOCATION_PACKER_SRC_ELF_TRAITS_H_ | 105 #endif // TOOLS_RELOCATION_PACKER_SRC_ELF_TRAITS_H_ |
OLD | NEW |