xref: /haiku/headers/private/system/elf_private.h (revision a553e95d858fc08a9e923f7a87fe28780370fbbc)
1 /*
2  * Copyright 2002-2018 Haiku, Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Copyright 2001 Travis Geiselbrecht. All rights reserved.
6  * Distributed under the terms of the NewOS License.
7  */
8 #ifndef _ELF_PRIVATE_H
9 #define _ELF_PRIVATE_H
10 
11 
12 #include <os/kernel/elf.h>
13 
14 #include <SupportDefs.h>
15 
16 #include <arch_elf.h>
17 
18 
19 // Determine the correct ELF types to use for the architecture
20 
21 #if defined(B_HAIKU_64_BIT) && !defined(ELF32_COMPAT)
22 #	define _ELF_TYPE(type)	Elf64_##type
23 #else
24 #	define _ELF_TYPE(type)	Elf32_##type
25 #endif
26 #define DEFINE_ELF_TYPE(type, name) \
27 	typedef _ELF_TYPE(type) name
28 
29 DEFINE_ELF_TYPE(Addr, elf_addr);
30 DEFINE_ELF_TYPE(Ehdr, elf_ehdr);
31 DEFINE_ELF_TYPE(Phdr, elf_phdr);
32 DEFINE_ELF_TYPE(Shdr, elf_shdr);
33 DEFINE_ELF_TYPE(Sym, elf_sym);
34 DEFINE_ELF_TYPE(Dyn, elf_dyn);
35 DEFINE_ELF_TYPE(Rel, elf_rel);
36 DEFINE_ELF_TYPE(Rela, elf_rela);
37 DEFINE_ELF_TYPE(Verdef, elf_verdef);
38 DEFINE_ELF_TYPE(Verdaux, elf_verdaux);
39 DEFINE_ELF_TYPE(Verneed, elf_verneed);
40 DEFINE_ELF_TYPE(Vernaux, elf_vernaux);
41 DEFINE_ELF_TYPE(Nhdr, elf_nhdr);
42 DEFINE_ELF_TYPE(Note_Team, elf_note_team);
43 DEFINE_ELF_TYPE(Note_Area_Entry, elf_note_area_entry);
44 DEFINE_ELF_TYPE(Note_Image_Entry, elf_note_image_entry);
45 DEFINE_ELF_TYPE(Note_Thread_Entry, elf_note_thread_entry);
46 
47 #undef DEFINE_ELF_TYPE
48 #undef _ELF_TYPE
49 
50 typedef uint16 elf_versym;
51 
52 #if defined(B_HAIKU_64_BIT) && !defined(ELF32_COMPAT)
53 #	define ELF_CLASS	ELFCLASS64
54 #else
55 #	define ELF_CLASS	ELFCLASS32
56 #endif
57 
58 
59 #endif	/* _ELF_PRIVATE_H_ */
60