1*2fe8fb19SBen Gras /* $NetBSD: link_elf.h,v 1.10 2010/10/16 10:27:06 skrll Exp $ */ 2*2fe8fb19SBen Gras 3*2fe8fb19SBen Gras #ifndef _LINK_ELF_H_ 4*2fe8fb19SBen Gras #define _LINK_ELF_H_ 5*2fe8fb19SBen Gras 6*2fe8fb19SBen Gras #include <sys/types.h> 7*2fe8fb19SBen Gras #include <sys/exec_elf.h> 8*2fe8fb19SBen Gras 9*2fe8fb19SBen Gras typedef struct link_map { 10*2fe8fb19SBen Gras caddr_t l_addr; /* Base Address of library */ 11*2fe8fb19SBen Gras #ifdef __mips__ 12*2fe8fb19SBen Gras caddr_t l_offs; /* Load Offset of library */ 13*2fe8fb19SBen Gras #endif 14*2fe8fb19SBen Gras const char *l_name; /* Absolute Path to Library */ 15*2fe8fb19SBen Gras void *l_ld; /* Pointer to .dynamic in memory */ 16*2fe8fb19SBen Gras struct link_map *l_next; /* linked list of of mapped libs */ 17*2fe8fb19SBen Gras struct link_map *l_prev; 18*2fe8fb19SBen Gras } Link_map; 19*2fe8fb19SBen Gras 20*2fe8fb19SBen Gras /* 21*2fe8fb19SBen Gras * This only exists for GDB. 22*2fe8fb19SBen Gras */ 23*2fe8fb19SBen Gras struct r_debug { 24*2fe8fb19SBen Gras int r_version; /* not used */ 25*2fe8fb19SBen Gras struct link_map *r_map; /* list of loaded images */ 26*2fe8fb19SBen Gras void (*r_brk)(void); /* pointer to break point */ 27*2fe8fb19SBen Gras enum { 28*2fe8fb19SBen Gras RT_CONSISTENT, /* things are stable */ 29*2fe8fb19SBen Gras RT_ADD, /* adding a shared library */ 30*2fe8fb19SBen Gras RT_DELETE /* removing a shared library */ 31*2fe8fb19SBen Gras } r_state; 32*2fe8fb19SBen Gras }; 33*2fe8fb19SBen Gras 34*2fe8fb19SBen Gras struct dl_phdr_info 35*2fe8fb19SBen Gras { 36*2fe8fb19SBen Gras Elf_Addr dlpi_addr; /* module relocation base */ 37*2fe8fb19SBen Gras const char *dlpi_name; /* module name */ 38*2fe8fb19SBen Gras const Elf_Phdr *dlpi_phdr; /* pointer to module's phdr */ 39*2fe8fb19SBen Gras Elf_Half dlpi_phnum; /* number of entries in phdr */ 40*2fe8fb19SBen Gras unsigned long long int dlpi_adds; /* total # of loads */ 41*2fe8fb19SBen Gras unsigned long long int dlpi_subs; /* total # of unloads */ 42*2fe8fb19SBen Gras size_t dlpi_tls_modid; 43*2fe8fb19SBen Gras void *dlpi_tls_data; 44*2fe8fb19SBen Gras }; 45*2fe8fb19SBen Gras 46*2fe8fb19SBen Gras __BEGIN_DECLS 47*2fe8fb19SBen Gras 48*2fe8fb19SBen Gras int dl_iterate_phdr(int (*)(struct dl_phdr_info *, size_t, void *), 49*2fe8fb19SBen Gras void *); 50*2fe8fb19SBen Gras 51*2fe8fb19SBen Gras __END_DECLS 52*2fe8fb19SBen Gras 53*2fe8fb19SBen Gras #endif /* _LINK_ELF_H_ */ 54