The OpenD Programming Language

1 /**
2  * D header file for Solaris.
3  *
4  * $(LINK2 http://src.illumos.org/source/xref/illumos-gate/usr/src/head/libelf.h, illumos libelf.h)
5  */
6 module core.sys.solaris.libelf;
7 
8 version (Solaris):
9 extern (C):
10 nothrow:
11 
12 import core.stdc.config;
13 import core.sys.posix.sys.types;
14 import core.sys.solaris.sys.elf;
15 
16 enum Elf_Cmd
17 {
18     ELF_C_NULL = 0,
19     ELF_C_READ,
20     ELF_C_WRITE,
21     ELF_C_CLR,
22     ELF_C_SET,
23     ELF_C_FDDONE,
24     ELF_C_FDREAD,
25     ELF_C_RDWR,
26     ELF_C_WRIMAGE,
27     ELF_C_IMAGE,
28     ELF_C_NUM
29 }
30 
31 enum ELF_F_DIRTY  = 0x1;
32 enum ELF_F_LAYOUT = 0x4;
33 
34 enum Elf_Kind
35 {
36     ELF_K_NONE = 0,
37     ELF_K_AR,
38     ELF_K_COFF,
39     ELF_K_ELF,
40     ELF_K_NUM
41 }
42 
43 enum Elf_Type
44 {
45     ELF_T_BYTE = 0,
46     ELF_T_ADDR,
47     ELF_T_DYN,
48     ELF_T_EHDR,
49     ELF_T_HALF,
50     ELF_T_OFF,
51     ELF_T_PHDR,
52     ELF_T_RELA,
53     ELF_T_REL,
54     ELF_T_SHDR,
55     ELF_T_SWORD,
56     ELF_T_SYM,
57     ELF_T_WORD,
58     ELF_T_VDEF,
59     ELF_T_VNEED,
60     ELF_T_SXWORD,
61     ELF_T_XWORD,
62     ELF_T_SYMINFO,
63     ELF_T_NOTE,
64     ELF_T_MOVE,
65     ELF_T_MOVEP,
66     ELF_T_CAP,
67     ELF_T_NUM
68 }
69 
70 struct Elf
71 {
72 }
73 
74 struct Elf_Scn
75 {
76 }
77 
78 struct Elf_Arhdr
79 {
80     char*   ar_name;
81     time_t  ar_date;
82     uid_t   ar_uid;
83     gid_t   ar_gid;
84     mode_t  ar_mode;
85     off_t   ar_size;
86     char*   ar_rawname;
87 }
88 
89 struct Elf_Arsym
90 {
91     char*    as_name;
92     size_t   as_off;
93     c_ulong  as_hash;
94 }
95 
96 struct Elf_Data
97 {
98   void*     d_buf;
99   Elf_Type  d_type;
100   size_t    d_size;
101   off_t     d_off;
102   size_t    d_align;
103   uint      d_version;
104 }
105 
106 Elf* elf_begin(int, Elf_Cmd, Elf*);
107 int elf_cntl(Elf*, Elf_Cmd);
108 int elf_end(Elf*);
109 const(char)* elf_errmsg(int);
110 int elf_errno();
111 void elf_fill(int);
112 uint elf_flagdata(Elf_Data*, Elf_Cmd, uint);
113 uint elf_flagehdr(Elf*, Elf_Cmd,  uint);
114 uint elf_flagelf(Elf*, Elf_Cmd, uint);
115 uint elf_flagphdr(Elf*, Elf_Cmd, uint);
116 uint elf_flagscn(Elf_Scn*, Elf_Cmd, uint);
117 uint elf_flagshdr(Elf_Scn*, Elf_Cmd, uint);
118 size_t elf32_fsize(Elf_Type, size_t, uint);
119 Elf_Arhdr* elf_getarhdr(Elf*);
120 Elf_Arsym* elf_getarsym(Elf*, size_t*);
121 off_t elf_getbase(Elf*);
122 Elf_Data* elf_getdata(Elf_Scn*, Elf_Data*);
123 Elf32_Ehdr* elf32_getehdr(Elf*);
124 char* elf_getident(Elf*, size_t*);
125 Elf32_Phdr* elf32_getphdr(Elf*);
126 Elf_Scn* elf_getscn(Elf*, size_t);
127 Elf32_Shdr* elf32_getshdr(Elf_Scn*);
128 int elf_getphnum(Elf*, size_t*);
129 int elf_getphdrnum(Elf*, size_t*);
130 int elf_getshnum(Elf*, size_t*);
131 int elf_getshdrnum(Elf*, size_t*);
132 int elf_getshstrndx(Elf*, size_t*);
133 int elf_getshdrstrndx(Elf*, size_t*);
134 c_ulong elf_hash(const scope char*);
135 uint elf_sys_encoding();
136 long elf32_checksum(Elf*);
137 Elf_Kind elf_kind(Elf*);
138 Elf* elf_memory(char*, size_t);
139 size_t elf_ndxscn(Elf_Scn*);
140 Elf_Data* elf_newdata(Elf_Scn*);
141 Elf32_Ehdr* elf32_newehdr(Elf*);
142 Elf32_Phdr* elf32_newphdr(Elf*, size_t);
143 Elf_Scn* elf_newscn(Elf*);
144 Elf_Scn* elf_nextscn(Elf*, Elf_Scn*);
145 Elf_Cmd elf_next(Elf*);
146 size_t elf_rand(Elf*, size_t);
147 Elf_Data* elf_rawdata(Elf_Scn*, Elf_Data*);
148 char* elf_rawfile(Elf*, size_t*);
149 char* elf_strptr(Elf*, size_t, size_t);
150 off_t elf_update(Elf*, Elf_Cmd);
151 uint elf_version(uint);
152 Elf_Data* elf32_xlatetof(Elf_Data*, const scope Elf_Data*, uint);
153 Elf_Data* elf32_xlatetom(Elf_Data*, const scope Elf_Data*, uint);
154 
155 version (D_LP64)
156 {
157 size_t elf64_fsize(Elf_Type, size_t, uint);
158 Elf64_Ehdr* elf64_getehdr(Elf*);
159 Elf64_Phdr* elf64_getphdr(Elf*);
160 Elf64_Shdr* elf64_getshdr(Elf_Scn*);
161 long elf64_checksum(Elf*);
162 Elf64_Ehdr* elf64_newehdr(Elf*);
163 Elf64_Phdr* elf64_newphdr(Elf*, size_t);
164 Elf_Data* elf64_xlatetof(Elf_Data*, const scope Elf_Data*, uint);
165 Elf_Data* elf64_xlatetom(Elf_Data*, const scope Elf_Data*, uint);
166 }