| 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 }; | |
| 61 | 60 |
| 62 static inline const char* Machine() { return "ARM"; } | 61 static inline const char* Machine() { return "ARM"; } |
| 63 | 62 |
| 64 # define ELF_R_SYM(val) ELF32_R_SYM(val) | 63 # define ELF_R_SYM(val) ELF32_R_SYM(val) |
| 65 # define ELF_R_TYPE(val) ELF32_R_TYPE(val) | 64 # define ELF_R_TYPE(val) ELF32_R_TYPE(val) |
| 66 # define ELF_R_INFO(sym, type) ELF32_R_INFO(sym, type) | 65 # define ELF_R_INFO(sym, type) ELF32_R_INFO(sym, type) |
| 67 # define ELF_ST_TYPE(val) ELF32_ST_TYPE(val) | 66 # define ELF_ST_TYPE(val) ELF32_ST_TYPE(val) |
| 68 }; | 67 }; |
| 69 | 68 |
| 70 #elif defined(TARGET_ARM64) | 69 #elif defined(TARGET_ARM64) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 84 typedef Elf64_Xword Xword; | 83 typedef Elf64_Xword Xword; |
| 85 | 84 |
| 86 static inline Ehdr* getehdr(Elf* elf) { return elf64_getehdr(elf); } | 85 static inline Ehdr* getehdr(Elf* elf) { return elf64_getehdr(elf); } |
| 87 static inline Phdr* getphdr(Elf* elf) { return elf64_getphdr(elf); } | 86 static inline Phdr* getphdr(Elf* elf) { return elf64_getphdr(elf); } |
| 88 static inline Shdr* getshdr(Elf_Scn* scn) { return elf64_getshdr(scn); } | 87 static inline Shdr* getshdr(Elf_Scn* scn) { return elf64_getshdr(scn); } |
| 89 | 88 |
| 90 enum { kMachine = EM_AARCH64 }; | 89 enum { kMachine = EM_AARCH64 }; |
| 91 enum { kFileClass = ELFCLASS64 }; | 90 enum { kFileClass = ELFCLASS64 }; |
| 92 enum { kRelativeRelocationCode = R_AARCH64_RELATIVE }; | 91 enum { kRelativeRelocationCode = R_AARCH64_RELATIVE }; |
| 93 enum { kNoRelocationCode = R_AARCH64_NONE }; | 92 enum { kNoRelocationCode = R_AARCH64_NONE }; |
| 94 enum { kGnuStackSegmentAlignment = 16 }; | |
| 95 | 93 |
| 96 static inline const char* Machine() { return "ARM64"; } | 94 static inline const char* Machine() { return "ARM64"; } |
| 97 | 95 |
| 98 # define ELF_R_SYM(val) ELF64_R_SYM(val) | 96 # define ELF_R_SYM(val) ELF64_R_SYM(val) |
| 99 # define ELF_R_TYPE(val) ELF64_R_TYPE(val) | 97 # define ELF_R_TYPE(val) ELF64_R_TYPE(val) |
| 100 # define ELF_R_INFO(sym, type) ELF64_R_INFO(sym, type) | 98 # define ELF_R_INFO(sym, type) ELF64_R_INFO(sym, type) |
| 101 # define ELF_ST_TYPE(val) ELF64_ST_TYPE(val) | 99 # define ELF_ST_TYPE(val) ELF64_ST_TYPE(val) |
| 102 }; | 100 }; |
| 103 #endif | 101 #endif |
| 104 | 102 |
| 105 #endif // TOOLS_RELOCATION_PACKER_SRC_ELF_TRAITS_H_ | 103 #endif // TOOLS_RELOCATION_PACKER_SRC_ELF_TRAITS_H_ |
| OLD | NEW |