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