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