1 /**
2  * D header file for NetBSD.
3  *
4  * http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/include/link_elf.h
5  */
6 module core.sys.netbsd.sys.link_elf;
7 
8 version (NetBSD):
9 extern (C):
10 nothrow:
11 
12 import core.stdc.stdint : uint64_t;
13 import core.sys.netbsd.sys.elf;
14 
15 version (D_LP64)
16     enum __ELF_NATIVE_CLASS = 64;
17 else
18     enum __ELF_NATIVE_CLASS = 32;
19 
20 template ElfW(string type)
21 {
22     mixin("alias Elf"~__ELF_NATIVE_CLASS.stringof~"_"~type~" ElfW;");
23 }
24 
25 struct link_map
26 {
27     char*           l_addr;
28 
29     version (MIPS32)
30         char*       l_offs;
31     version (MIPS64)
32         char*       l_offs;
33 
34     char*           l_name;
35     void*           l_ld;
36     link_map*       l_next;
37     link_map*       l_prev;
38 }
39 alias link_map Link_map;
40 
41 enum
42 {
43     RT_CONSISTENT,
44     RT_ADD,
45     RT_DELETE,
46 }
47 
48 struct r_debug
49 {
50     int             r_version;
51     link_map*       r_map;
52     void function(r_debug*, link_map*) r_brk;
53 }
54 
55 struct dl_phdr_info
56 {
57     ElfW!"Addr"     dlpi_addr;
58     char*           dlpi_name;
59     ElfW!"Phdr"*    dlpi_phdr;
60     ElfW!"Half"     dlpi_phnum;
61     uint64_t        dlpi_adds;
62     uint64_t        dlpi_subs;
63     size_t          dlpi_tls_modid;
64     void*           dlpi_tls_data;
65 }
66 
67 
68 private alias extern(C) int function(dl_phdr_info*, size_t, void *) dl_iterate_phdr_cb;
69 private alias extern(C) int function(dl_phdr_info*, size_t, void *) @nogc dl_iterate_phdr_cb_ngc;
70 extern int dl_iterate_phdr(dl_iterate_phdr_cb __callback, void*__data);
71 extern int dl_iterate_phdr(dl_iterate_phdr_cb_ngc __callback, void*__data) @nogc;