1 /**
2  * D header file for OpenBSD.
3  *
4  * Authors:  Iain Buclaw
5  * Based-on: core/sys/freebsd/sys
6  */
7 module core.sys.openbsd.sys.elf_common;
8 
9 version (OpenBSD):
10 extern (C):
11 pure:
12 nothrow:
13 
14 import core.stdc.stdint;
15 public import core.sys.elf;
16 
17 struct Elf_Note
18 {
19     uint32_t      n_namesz;
20     uint32_t      n_descsz;
21     uint32_t      n_type;
22 }
23 
24 struct Elf_GNU_Hash_Header
25 {
26     uint32_t      gh_nbuckets;
27     uint32_t      gh_symndx;
28     uint32_t      gh_maskwords;
29     uint32_t      gh_shift2;
30 }
31 
32 enum OLD_EI_BRAND =    8;
33 
34 extern (D) pure @safe
35 {
36     auto IS_ELF(T)(T ehdr) { return ehdr.e_ident[EI_MAG0] == ELFMAG0 &&
37                                     ehdr.e_ident[EI_MAG1] == ELFMAG1 &&
38                                     ehdr.e_ident[EI_MAG2] == ELFMAG2 &&
39                                     ehdr.e_ident[EI_MAG3] == ELFMAG3; }
40 }
41 
42 enum EM_486 =           6;
43 enum EM_MIPS_RS4_BE =  10;
44 enum EM_ALPHA_STD =    41;
45 
46 enum PT_SUNW_EH_FRAME = PT_GNU_EH_FRAME;
47 
48 enum SHT_GNU_INCREMENTAL_INPUTS =  0x6fff4700;
49 
50 enum SHT_SUNW_verdef =   0x6ffffffd;
51 enum SHT_SUNW_verneed =  0x6ffffffe;
52 enum SHT_SUNW_versym =   0x6fffffff;
53 
54 enum NT_PRSTATUS =     1;
55 enum NT_FPREGSET =     2;
56 enum NT_PRPSINFO =     3;
57 enum NT_TASKSTRUCT =   4;
58 enum NT_AUXV =         6;
59 
60 enum DT_USED =         0x7ffffffe;
61 
62 enum DF_1_BIND_NOW =   0x00000001;
63 
64 alias VER_NDX VER_DEF_IDX;
65 
66 enum VER_FLG_INFO =    0x4;
67 
68 enum VER_NDX_GIVEN =           2;
69 enum VER_NDX_HIDDEN =      32768;
70 
71 extern (D) pure @safe
72 {
73     auto VER_NDX(V)(V v) { return v & ~(1u << 15); }
74 }
75 
76 enum VER_NEED_WEAK =    32768;
77 enum VER_NEED_HIDDEN = VER_NDX_HIDDEN;
78 alias VER_NDX VER_NEED_IDX;
79 
80 enum VERSYM_HIDDEN =   0x8000;
81 enum VERSYM_VERSION =  0x7fff;
82 enum ELF_VER_CHR =     '@';