1*cda5da8dSAndroid Build Coastguard Worker #ifndef _LINK_H 2*cda5da8dSAndroid Build Coastguard Worker #define _LINK_H 3*cda5da8dSAndroid Build Coastguard Worker 4*cda5da8dSAndroid Build Coastguard Worker #ifdef __cplusplus 5*cda5da8dSAndroid Build Coastguard Worker extern "C" { 6*cda5da8dSAndroid Build Coastguard Worker #endif 7*cda5da8dSAndroid Build Coastguard Worker 8*cda5da8dSAndroid Build Coastguard Worker #include <elf.h> 9*cda5da8dSAndroid Build Coastguard Worker #define __NEED_size_t 10*cda5da8dSAndroid Build Coastguard Worker #define __NEED_uint32_t 11*cda5da8dSAndroid Build Coastguard Worker #include <bits/alltypes.h> 12*cda5da8dSAndroid Build Coastguard Worker 13*cda5da8dSAndroid Build Coastguard Worker #if UINTPTR_MAX > 0xffffffff 14*cda5da8dSAndroid Build Coastguard Worker #define ElfW(type) Elf64_ ## type 15*cda5da8dSAndroid Build Coastguard Worker #else 16*cda5da8dSAndroid Build Coastguard Worker #define ElfW(type) Elf32_ ## type 17*cda5da8dSAndroid Build Coastguard Worker #endif 18*cda5da8dSAndroid Build Coastguard Worker 19*cda5da8dSAndroid Build Coastguard Worker #include <bits/link.h> 20*cda5da8dSAndroid Build Coastguard Worker 21*cda5da8dSAndroid Build Coastguard Worker struct dl_phdr_info { 22*cda5da8dSAndroid Build Coastguard Worker ElfW(Addr) dlpi_addr; 23*cda5da8dSAndroid Build Coastguard Worker const char *dlpi_name; 24*cda5da8dSAndroid Build Coastguard Worker const ElfW(Phdr) *dlpi_phdr; 25*cda5da8dSAndroid Build Coastguard Worker ElfW(Half) dlpi_phnum; 26*cda5da8dSAndroid Build Coastguard Worker unsigned long long int dlpi_adds; 27*cda5da8dSAndroid Build Coastguard Worker unsigned long long int dlpi_subs; 28*cda5da8dSAndroid Build Coastguard Worker size_t dlpi_tls_modid; 29*cda5da8dSAndroid Build Coastguard Worker void *dlpi_tls_data; 30*cda5da8dSAndroid Build Coastguard Worker }; 31*cda5da8dSAndroid Build Coastguard Worker 32*cda5da8dSAndroid Build Coastguard Worker struct link_map { 33*cda5da8dSAndroid Build Coastguard Worker ElfW(Addr) l_addr; 34*cda5da8dSAndroid Build Coastguard Worker char *l_name; 35*cda5da8dSAndroid Build Coastguard Worker ElfW(Dyn) *l_ld; 36*cda5da8dSAndroid Build Coastguard Worker struct link_map *l_next, *l_prev; 37*cda5da8dSAndroid Build Coastguard Worker }; 38*cda5da8dSAndroid Build Coastguard Worker 39*cda5da8dSAndroid Build Coastguard Worker struct r_debug { 40*cda5da8dSAndroid Build Coastguard Worker int r_version; 41*cda5da8dSAndroid Build Coastguard Worker struct link_map *r_map; 42*cda5da8dSAndroid Build Coastguard Worker ElfW(Addr) r_brk; 43*cda5da8dSAndroid Build Coastguard Worker enum { RT_CONSISTENT, RT_ADD, RT_DELETE } r_state; 44*cda5da8dSAndroid Build Coastguard Worker ElfW(Addr) r_ldbase; 45*cda5da8dSAndroid Build Coastguard Worker }; 46*cda5da8dSAndroid Build Coastguard Worker 47*cda5da8dSAndroid Build Coastguard Worker int dl_iterate_phdr(int (*)(struct dl_phdr_info *, size_t, void *), void *); 48*cda5da8dSAndroid Build Coastguard Worker 49*cda5da8dSAndroid Build Coastguard Worker #ifdef __cplusplus 50*cda5da8dSAndroid Build Coastguard Worker } 51*cda5da8dSAndroid Build Coastguard Worker #endif 52*cda5da8dSAndroid Build Coastguard Worker 53*cda5da8dSAndroid Build Coastguard Worker #endif 54