2 * D header file for GNU/Linux
4 * $(LINK2 http://sourceware.org/git/?p=glibc.git;a=blob;f=elf/link.h, glibc elf/link.h)
6 module core
.sys
.linux
.link
;
12 version (ARM
) version = ARM_Any
;
13 version (AArch64
) version = ARM_Any
;
14 version (HPPA
) version = HPPA_Any
;
15 version (MIPS32
) version = MIPS_Any
;
16 version (MIPS64
) version = MIPS_Any
;
17 version (PPC
) version = PPC_Any
;
18 version (PPC64
) version = PPC_Any
;
19 version (RISCV32
) version = RISCV_Any
;
20 version (RISCV64
) version = RISCV_Any
;
21 version (S390
) version = IBMZ_Any
;
22 version (SPARC
) version = SPARC_Any
;
23 version (SPARC64
) version = SPARC_Any
;
24 version (SystemZ
) version = IBMZ_Any
;
25 version (X86
) version = X86_Any
;
26 version (X86_64
) version = X86_Any
;
28 import core
.stdc
.stdint
: uintptr_t
, uint32_t
, uint64_t
;
29 import core
.sys
.linux
.config
: __WORDSIZE
;
30 import core
.sys
.linux
.dlfcn
: Lmid_t
;
31 import core
.sys
.linux
.elf
;
36 alias __WORDSIZE __ELF_NATIVE_CLASS
;
38 alias uint64_t Elf_Symndx
;
40 alias uint32_t Elf_Symndx
;
42 else version (X86_Any
)
44 // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/elfclass.h
45 alias __WORDSIZE __ELF_NATIVE_CLASS
;
46 alias uint32_t Elf_Symndx
;
48 else version (HPPA_Any
)
50 // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/elfclass.h
51 alias __WORDSIZE __ELF_NATIVE_CLASS
;
52 alias uint32_t Elf_Symndx
;
54 else version (MIPS_Any
)
56 // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/elfclass.h
57 alias __WORDSIZE __ELF_NATIVE_CLASS
;
58 alias uint32_t Elf_Symndx
;
60 else version (PPC_Any
)
62 // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/elfclass.h
63 alias __WORDSIZE __ELF_NATIVE_CLASS
;
64 alias uint32_t Elf_Symndx
;
66 else version (ARM_Any
)
68 // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/elfclass.h
69 alias __WORDSIZE __ELF_NATIVE_CLASS
;
70 alias uint32_t Elf_Symndx
;
72 else version (RISCV_Any
)
74 // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/elfclass.h
75 alias __WORDSIZE __ELF_NATIVE_CLASS
;
76 alias uint32_t Elf_Symndx
;
78 else version (SPARC_Any
)
80 // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/elfclass.h
81 alias __WORDSIZE __ELF_NATIVE_CLASS
;
82 alias uint32_t Elf_Symndx
;
84 else version (IBMZ_Any
)
86 // http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/s390/bits/elfclass.h
87 alias __WORDSIZE __ELF_NATIVE_CLASS
;
88 static if (__WORDSIZE
== 64)
89 alias uint64_t Elf_Symndx
;
91 alias uint32_t Elf_Symndx
;
93 else version (LoongArch64
)
95 // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/elfclass.h
96 alias __WORDSIZE __ELF_NATIVE_CLASS
;
97 alias uint32_t Elf_Symndx
;
100 static assert(0, "unimplemented");
103 template ElfW(string type
)
105 mixin("alias Elf"~__ELF_NATIVE_CLASS
.stringof
~"_"~type
~" ElfW;");
120 typeof(RT_CONSISTENT
) r_state
;
121 ElfW
!"Addr" r_ldbase
;
124 extern r_debug _r_debug
;
125 extern ElfW
!"Dyn"* _DYNAMIC
;
132 link_map
* l_next
, l_prev
;
145 LA_SER_LIBPATH
= 0x02,
146 LA_SER_RUNPATH
= 0x04,
147 LA_SER_CONFIG
= 0x08,
148 LA_SER_DEFAULT
= 0x40,
149 LA_SER_SECURE
= 0x80,
155 LA_FLG_BINDTO
= 0x01,
156 LA_FLG_BINDFROM
= 0x02,
162 LA_SYMB_NOPLTENTER
= 0x01,
163 LA_SYMB_NOPLTEXIT
= 0x02,
164 LA_SYMB_STRUCTCALL
= 0x04,
165 LA_SYMB_DLSYM
= 0x08,
166 LA_SYMB_ALTVALUE
= 0x10,
171 ElfW
!"Addr" dlpi_addr
;
172 const(char)* dlpi_name
;
173 const(ElfW
!"Phdr")* dlpi_phdr
;
174 ElfW
!"Half" dlpi_phnum
;
176 // check the SIZE argument of the dl_iterate_phdr callback whether
177 // the following members are available
181 size_t dlpi_tls_modid
;
185 private alias extern(C
) int function(dl_phdr_info
*, size_t
, void *) dl_iterate_phdr_cb
;
186 private alias extern(C
) int function(dl_phdr_info
*, size_t
, void *) @nogc dl_iterate_phdr_cb_ngc
;
187 extern int dl_iterate_phdr(dl_iterate_phdr_cb __callback
, void*__data
);
188 extern int dl_iterate_phdr(dl_iterate_phdr_cb_ngc __callback
, void*__data
) @nogc;
190 // ld.so auditing interfaces prototypes have to be defined by the auditing DSO.
191 extern uint la_version(uint __version
);
192 extern void la_activity(uintptr_t
*__cookie
, uint __flag
);
193 extern char* la_objsearch(const(char)* __name
, uintptr_t
* __cookie
,
195 extern uint la_objopen(link_map
* __map
, Lmid_t __lmid
,
196 uintptr_t
* __cookie
);
197 extern void la_preinit(uintptr_t
* __cookie
);
198 extern uintptr_t
la_symbind32(Elf32_Sym
* __sym
, uint __ndx
,
199 uintptr_t
* __refcook
, uintptr_t
* __defcook
,
200 uint *__flags
, const(char)* __symname
);
201 extern uintptr_t
la_symbind64(Elf64_Sym
* __sym
, uint __ndx
,
202 uintptr_t
* __refcook
, uintptr_t
* __defcook
,
203 uint* __flags
, const(char)* __symname
);
204 extern uint la_objclose(uintptr_t
*__cookie
);