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.link_elf;
8 
9 version (OpenBSD):
10 
11 extern (C) nothrow @system:
12 
13 import core.sys.posix.config;
14 import core.sys.posix.sys.types;
15 import core.sys.openbsd.sys.elf;
16 
17 version (D_LP64)
18     enum __ELF_NATIVE_CLASS = 64;
19 else
20     enum __ELF_NATIVE_CLASS = 32;
21 
22 template ElfW(string type)
23 {
24     mixin("alias Elf"~__ELF_NATIVE_CLASS.stringof~"_"~type~" ElfW;");
25 }
26 
27 struct link_map
28 {
29     caddr_t     l_addr;
30     char*       l_name;
31     void*       l_ld;
32     link_map*   l_next;
33     link_map*   l_prev;
34 }
35 
36 enum
37 {
38     RT_CONSISTENT,
39     RT_ADD,
40     RT_DELETE,
41 }
42 
43 struct r_debug
44 {
45     int                   r_version;
46     link_map*             r_map;
47     void function(r_debug*, link_map*) r_brk;
48     typeof(RT_CONSISTENT) r_state;
49     c_ulong               r_ldbase;
50 }
51 
52 struct dl_phdr_info
53 {
54     ElfW!"Addr"     dlpi_addr;
55     char*           dlpi_name;
56     ElfW!"Phdr"*    dlpi_phdr;
57     ElfW!"Half"     dlpi_phnum;
58 }
59 
60 
61 private alias int function(dl_phdr_info*, size_t, void *) dl_iterate_phdr_cb;
62 private alias int function(dl_phdr_info*, size_t, void *) @nogc dl_iterate_phdr_cb_ngc;
63 
64 int dl_iterate_phdr(dl_iterate_phdr_cb __callback, void*__data);
65 int dl_iterate_phdr(dl_iterate_phdr_cb_ngc __callback, void*__data) @nogc;
66 
67 int _rtld_addr_phdr(const void*, dl_phdr_info*) @nogc
68 {
69     return 0;
70 }