1 /**
2  * D header file for DragonFlyBSD.
3  *
4  * $(LINK2 http://svnweb.freebsd.org/base/head/sys/sys/link_elf.h?view=markup, sys/link_elf.h)
5  * Authors: Diederik de Groot(port:DragonFlyBSD)
6  * Copied:  From core/sys/freebsd/sys
7  */
8 module core.sys.dragonflybsd.sys.link_elf;
9 
10 version (DragonFlyBSD):
11 
12 extern (C) nothrow @system:
13 
14 import core.stdc.stdint : uint64_t;
15 import core.sys.dragonflybsd.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 enum LA_SER_ORIG =      0x01;
28 enum LA_SER_LIBPATH =   0x02;
29 enum LA_SER_RUNPATH =   0x04;
30 enum LA_SER_CONFIG =    0x08;
31 enum LA_SER_DEFAULT =   0x40;
32 enum LA_SER_SECURE =    0x80;
33 
34 struct link_map
35 {
36     char*           l_addr;
37 
38     version (MIPS32)
39         char*       l_offs;
40     version (MIPS64)
41         char*       l_offs;
42 
43     char*           l_name;
44     void*           l_ld;
45     link_map*       l_next, l_prev;
46 }
47 alias link_map Link_map;
48 
49 enum
50 {
51     RT_CONSISTENT,
52     RT_ADD,
53     RT_DELETE,
54 }
55 
56 struct r_debug
57 {
58     int             r_version;
59     link_map*       r_map;
60     void function(r_debug*, link_map*) r_brk;
61 }
62 
63 struct dl_phdr_info
64 {
65     ElfW!"Addr"     dlpi_addr;
66     char*           dlpi_name;
67     ElfW!"Phdr"*    dlpi_phdr;
68     ElfW!"Half"     dlpi_phnum;
69     uint64_t        dlpi_adds;
70     uint64_t        dlpi_subs;
71     size_t          dlpi_tls_modid;
72     void*           dlpi_tls_data;
73 }
74 
75 
76 private alias int function(dl_phdr_info*, size_t, void *) dl_iterate_phdr_cb;
77 private alias int function(dl_phdr_info*, size_t, void *) @nogc dl_iterate_phdr_cb_ngc;
78 
79 int dl_iterate_phdr(dl_iterate_phdr_cb __callback, void*__data);
80 int dl_iterate_phdr(dl_iterate_phdr_cb_ngc __callback, void*__data) @nogc;
81 int _rtld_addr_phdr(const void*, dl_phdr_info*) @nogc;
82 int _rtld_get_stack_prot() @nogc;