• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2018 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef BERBERIS_TINY_LOADER_ELF_TYPES_H_
18 #define BERBERIS_TINY_LOADER_ELF_TYPES_H_
19 
20 #include <elf.h>
21 
22 // glibc has this defined in link.h - remove the definition to avoid conflicts
23 #if defined(ElfW)
24 #undef ElfW
25 #endif
26 
27 #if defined(__LP64__)
28 #define ElfW(type) Elf64_##type
29 constexpr int kSupportedElfClass = ELFCLASS64;
30 #else
31 #define ElfW(type) Elf32_##type
32 constexpr int kSupportedElfClass = ELFCLASS32;
33 #endif
34 
35 typedef ElfW(Addr) ElfAddr;
36 typedef ElfW(Dyn) ElfDyn;
37 typedef ElfW(Ehdr) ElfEhdr;
38 typedef ElfW(Half) ElfHalf;
39 typedef ElfW(Phdr) ElfPhdr;
40 typedef ElfW(Shdr) ElfShdr;
41 typedef ElfW(Sym) ElfSym;
42 typedef ElfW(Word) ElfWord;
43 
44 #endif  // BERBERIS_TINY_LOADER_ELF_TYPES_H_
45