1 /**
2  * D header file for Solaris.
3  *
4  * $(LINK2 http://src.illumos.org/source/xref/illumos-gate/usr/src/uts/common/sys/elf_386.h, illumos sys/elf_386.h)
5  */
6 module core.sys.solaris.sys.elf;
7 
8 version (Solaris):
9 extern (C):
10 nothrow:
11 
12 public import core.sys.elf;
13 
14 enum ELF32_FSZ_ADDR  = 4;
15 enum ELF32_FSZ_HALF  = 2;
16 enum ELF32_FSZ_OFF   = 4;
17 enum ELF32_FSZ_SWORD = 4;
18 enum ELF32_FSZ_WORD  = 4;
19 
20 enum ELF64_FSZ_ADDR   = 8;
21 enum ELF64_FSZ_HALF   = 2;
22 enum ELF64_FSZ_OFF    = 8;
23 enum ELF64_FSZ_SWORD  = 4;
24 enum ELF64_FSZ_WORD   = 4;
25 enum ELF64_FSZ_SXWORD = 8;
26 enum ELF64_FSZ_XWORD  = 8;
27 
28 enum ET_LOSUNW     = 0xfeff;
29 enum ET_SUNWPSEUDO = 0xfeff;
30 enum ET_HISUNW     = 0xfeff;
31 
32 enum EAV_SUNW_NONE    = 0;
33 enum EAV_SUNW_CURRENT = 1;
34 enum EAV_SUNW_NUM     = 2;
35 
36 enum PT_SUNW_UNWIND   = 0x6464e550;
37 enum PT_SUNW_EH_FRAME = 0x6474e550;
38 
39 enum PT_SUNWDTRACE = 0x6ffffffc;
40 enum PT_SUNWCAP    = 0x6ffffffd;
41 
42 enum PF_SUNW_FAILURE = 0x00100000;
43 enum PF_SUNW_KILLED  = 0x00200000;
44 enum PF_SUNW_SIGINFO = 0x00400000;
45 
46 enum SHT_SUNW_capchain  = 0x6fffffef;
47 enum SHT_SUNW_capinfo   = 0x6ffffff0;
48 enum SHT_SUNW_symsort   = 0x6ffffff1;
49 enum SHT_SUNW_tlssort   = 0x6ffffff2;
50 enum SHT_SUNW_LDYNSYM   = 0x6ffffff3;
51 enum SHT_SUNW_dof       = 0x6ffffff4;
52 enum SHT_SUNW_cap       = 0x6ffffff5;
53 enum SHT_SUNW_SIGNATURE = 0x6ffffff6;
54 enum SHT_SUNW_ANNOTATE  = 0x6ffffff7;
55 enum SHT_SUNW_DEBUGSTR  = 0x6ffffff8;
56 enum SHT_SUNW_DEBUG     = 0x6ffffff9;
57 enum SHT_SUNW_verdef    = 0x6ffffffd;
58 enum SHT_SUNW_verneed   = 0x6ffffffe;
59 enum SHT_SUNW_versym    = 0x6fffffff;
60 
61 extern (D)
62 {
63     auto ELF32_ST_VISIBILITY(O)(O o) { return o & 0x07; }
64     alias ELF32_ST_VISIBILITY ELF64_ST_VISIBILITY;
65 }
66 
67 enum STV_EXPORTED  = 4;
68 enum STV_SINGLETON = 5;
69 enum STV_ELIMINATE = 6;
70 enum STV_NUM       = 7;
71 
72 extern (D)
73 {
74     auto ELF64_R_TYPE_DATA(I)(I i) { return (i << 32) >> 40; }
75     auto ELF64_R_TYPE_ID(I)(I i) { return (i << 56) >> 56; }
76     auto ELF64_R_TYPE_INFO(S, T)(S sym, T type) { return (sym <<8) + (type); }
77 }
78 
79 struct Elf32_Nhdr
80 {
81     Elf32_Word n_namesz;
82     Elf32_Word n_descsz;
83     Elf32_Word n_type;
84 }
85 
86 struct Elf64_Nhdr
87 {
88     Elf64_Word n_namesz;
89     Elf64_Word n_descsz;
90     Elf64_Word n_type;
91 }
92 
93 struct Elf32_Cap
94 {
95     Elf32_Word  c_tag;
96     union c_un
97     {
98         Elf32_Word  c_val;
99         Elf32_Addr  c_ptr;
100     }
101 }
102 
103 alias Elf32_Word Elf32_Capinfo;
104 alias Elf32_Word Elf32_Capchain;
105 
106 alias ELF32_M_SYM ELF32_C_SYM;
107 alias ELF32_M_SIZE ELF32_C_GROUP;
108 alias ELF32_M_INFO ELF32_C_INFO;
109 
110 struct Elf64_Cap
111 {
112     Elf64_Xword c_tag;
113     union c_un
114     {
115         Elf64_Xword c_val;
116         Elf64_Addr  c_ptr;
117     }
118 }
119 
120 alias Elf64_Xword Elf64_Capinfo;
121 alias Elf64_Word  Elf64_Capchain;
122 
123 extern (D)
124 {
125     auto ELF64_C_SYM(I)(I info) { return info >> 32; }
126     auto ELF64_C_GROUP(I)(I info) { return cast(Elf64_Word)info; }
127     auto ELF64_C_INFO(S, G)(S sym, G grp) { return (sym << 32) + grp; }
128 }
129 
130 enum CAPINFO_NONE    = 0;
131 enum CAPINFO_CURRENT = 1;
132 enum CAPINFO_NUM     = 2;
133 
134 enum CAPCHAIN_NONE    = 0;
135 enum CAPCHAIN_CURRENT = 1;
136 enum CAPCHAIN_NUM     = 2;
137 
138 enum CAPINFO_SUNW_GLOB = 0xff;
139 
140 enum CA_SUNW_NULL = 0;
141 enum CA_SUNW_HW_1 = 1;
142 enum CA_SUNW_SF_1 = 2;
143 enum CA_SUNW_HW_2 = 3;
144 enum CA_SUNW_PLAT = 4;
145 enum CA_SUNW_MACH = 5;
146 enum CA_SUNW_ID   = 6;
147 enum CA_SUNW_NUM  = 7;
148 
149 enum SF1_SUNW_FPKNWN = 0x001;
150 enum SF1_SUNW_FPUSED = 0x002;
151 enum SF1_SUNW_ADDR32 = 0x004;
152 enum SF1_SUNW_MASK   = 0x007;
153 
154 enum NT_PRSTATUS   = 1;
155 enum NT_PRFPREG    = 2;
156 enum NT_PRPSINFO   = 3;
157 enum NT_PRXREG     = 4;
158 enum NT_PLATFORM   = 5;
159 enum NT_AUXV       = 6;
160 enum NT_GWINDOWS   = 7;
161 enum NT_ASRS       = 8;
162 enum NT_LDT        = 9;
163 enum NT_PSTATUS    = 10;
164 enum NT_PSINFO     = 13;
165 enum NT_PRCRED     = 14;
166 enum NT_UTSNAME    = 15;
167 enum NT_LWPSTATUS  = 16;
168 enum NT_LWPSINFO   = 17;
169 enum NT_PRPRIV     = 18;
170 enum NT_PRPRIVINFO = 19;
171 enum NT_CONTENT    = 20;
172 enum NT_ZONENAME   = 21;
173 enum NT_FDINFO     = 22;
174 enum NT_SPYMASTER  = 23;
175 enum NT_NUM        = 23;