The OpenD Programming Language

1 /**
2  * D header file for Solaris.
3  *
4  * $(LINK2 http://src.illumos.org/source/xref/illumos-gate/usr/src/uts/common/sys/link.h, illumos sys/link.h)
5  */
6 module core.sys.solaris.sys.link;
7 
8 version (Solaris):
9 extern (C):
10 nothrow:
11 
12 public import core.sys.solaris.sys.elftypes;
13 public import core.sys.elf;
14 import core.stdc.config;
15 
16 struct Elf32_Dyn
17 {
18     Elf32_Sword d_tag;
19     union _d_un
20     {
21         Elf32_Word d_val;
22         Elf32_Addr d_ptr;
23         Elf32_Off  d_off;
24     } _d_un d_un;
25 }
26 
27 struct Elf64_Dyn
28 {
29     Elf64_Xword d_tag;
30     union _d_un
31     {
32         Elf64_Xword d_val;
33         Elf64_Addr  d_ptr;
34     } _d_un d_un;
35 }
36 
37 enum DT_MAXPOSTAGS = 34;
38 
39 enum DT_SUNW_AUXILIARY = 0x6000000d;
40 enum DT_SUNW_RTLDINF   = 0x6000000e;
41 enum DT_SUNW_FILTER    = 0x6000000f;
42 enum DT_SUNW_CAP       = 0x60000010;
43 enum DT_SUNW_SYMTAB    = 0x60000011;
44 enum DT_SUNW_SYMSZ     = 0x60000012;
45 
46 enum DT_SUNW_ENCODING    = 0x60000013;
47 enum DT_SUNW_SORTENT     = 0x60000013;
48 enum DT_SUNW_SYMSORT     = 0x60000014;
49 enum DT_SUNW_SYMSORTSZ   = 0x60000015;
50 enum DT_SUNW_TLSSORT     = 0x60000016;
51 enum DT_SUNW_TLSSORTSZ   = 0x60000017;
52 enum DT_SUNW_CAPINFO     = 0x60000018;
53 enum DT_SUNW_STRPAD      = 0x60000019;
54 enum DT_SUNW_CAPCHAIN    = 0x6000001a;
55 enum DT_SUNW_LDMACH      = 0x6000001b;
56 enum DT_SUNW_CAPCHAINENT = 0x6000001d;
57 enum DT_SUNW_CAPCHAINSZ  = 0x6000001f;
58 
59 enum DT_DEPRECATED_SPARC_REGISTER = 0x7000001;
60 
61 enum DT_USED      = 0x7ffffffe;
62 
63 enum DF_P1_DEFERRED  = 0x00000004;
64 
65 enum VER_FLG_INFO = 0x4;
66 
67 enum SYMINFO_FLG_FILTER      = 0x0002;
68 enum SYMINFO_FLG_DIRECTBIND  = 0x0010;
69 enum SYMINFO_FLG_NOEXTDIRECT = 0x0020;
70 enum SYMINFO_FLG_AUXILIARY   = 0x0040;
71 enum SYMINFO_FLG_INTERPOSE   = 0x0080;
72 enum SYMINFO_FLG_CAP         = 0x0100;
73 enum SYMINFO_FLG_DEFERRED    = 0x0200;
74 
75 enum SYMINFO_BT_NONE       = 0xfffd;
76 enum SYMINFO_BT_EXTERN     = 0xfffc;
77 
78 alias link_map Link_map;
79 
80 struct link_map
81 {
82     c_ulong  l_addr;
83     char*    l_name;
84     version (D_LP64)
85         Elf64_Dyn*  l_ld;
86     else
87         Elf32_Dyn*  l_ld;
88     Link_map*  l_next;
89     Link_map*  l_prev;
90     char*      l_refname;
91 }
92 
93 version (_SYSCALL32)
94 {
95 alias link_map32 Link_map32;
96 
97 struct link_map32
98 {
99     Elf32_Word  l_addr;
100     Elf32_Addr  l_name;
101     Elf32_Addr  l_ld;
102     Elf32_Addr  l_next;
103     Elf32_Addr  l_prev;
104     Elf32_Addr  l_refname;
105 }
106 }
107 
108 enum r_state_e
109 {
110     RT_CONSISTENT,
111     RT_ADD,
112     RT_DELETE
113 }
114 
115 enum rd_flags_e
116 {
117     RD_FL_NONE = 0,
118     RD_FL_ODBG = (1<<0),
119     RD_FL_DBG  = (1<<1)
120 }
121 
122 enum rd_event_e
123 {
124     RD_NONE = 0,
125     RD_PREINIT,
126     RD_POSTINIT,
127     RD_DLACTIVITY
128 }
129 
130 struct r_debug
131 {
132     int         r_version;
133     Link_map*   r_map;
134     c_ulong     r_brk;
135     r_state_e   r_state;
136     c_ulong     r_ldbase;
137     Link_map*   r_ldsomap;
138     rd_event_e  r_rdevent;
139     rd_flags_e  r_flags;
140 }
141 
142 version (_SYSCALL32)
143 {
144 struct r_debug32
145 {
146     Elf32_Word  r_version;
147     Elf32_Addr  r_map;
148     Elf32_Word  r_brk;
149     r_state_e   r_state;
150     Elf32_Word  r_ldbase;
151     Elf32_Addr  r_ldsomap;
152     rd_event_e  r_rdevent;
153     rd_flags_e  r_flags;
154 }
155 }
156 
157 enum R_DEBUG_VERSION = 2;
158 
159 struct Elf32_Boot
160 {
161     Elf32_Sword eb_tag;
162     union eb_un
163     {
164         Elf32_Word eb_val;
165         Elf32_Addr eb_ptr;
166         Elf32_Off  eb_off;
167     }
168 }
169 
170 struct Elf64_Boot
171 {
172     Elf64_Xword eb_tag;
173     union eb_un
174     {
175         Elf64_Xword eb_val;
176         Elf64_Addr eb_ptr;
177         Elf64_Off eb_off;
178     }
179 }
180 
181 enum EB_NULL       = 0;
182 enum EB_DYNAMIC    = 1;
183 enum EB_LDSO_BASE  = 2;
184 enum EB_ARGV       = 3;
185 enum EB_ENVP       = 4;
186 enum EB_AUXV       = 5;
187 enum EB_DEVZERO    = 6;
188 enum EB_PAGESIZE   = 7;
189 enum EB_MAX        = 8;
190 enum EB_MAX_SIZE32 = 64;
191 enum EB_MAX_SIZE64 = 128;
192 
193 void _ld_libc(void *);