1 | /* $NetBSD: link_elf.h,v 1.8 2009/11/04 19:28:03 pooka Exp $ */ |
---|
2 | |
---|
3 | /* |
---|
4 | * This only exists for GDB. |
---|
5 | */ |
---|
6 | |
---|
7 | #ifndef _LINK_ELF_H_ |
---|
8 | #define _LINK_ELF_H_ |
---|
9 | |
---|
10 | #include <sys/types.h> |
---|
11 | |
---|
12 | #include <machine/elf_machdep.h> |
---|
13 | #include <stdint.h> |
---|
14 | #include <rtems/rtl/rtl-obj-fwd.h> |
---|
15 | |
---|
16 | #ifdef __cplusplus |
---|
17 | extern "C" { |
---|
18 | #endif |
---|
19 | |
---|
20 | enum sections |
---|
21 | { |
---|
22 | rap_text = 0, |
---|
23 | rap_const = 1, |
---|
24 | rap_ctor = 2, |
---|
25 | rap_dtor = 3, |
---|
26 | rap_data = 4, |
---|
27 | rap_bss = 5, |
---|
28 | rap_secs = 6 |
---|
29 | }; |
---|
30 | |
---|
31 | /** |
---|
32 | * Object details. |
---|
33 | */ |
---|
34 | typedef struct |
---|
35 | { |
---|
36 | const char* name; /**< Section name. */ |
---|
37 | uint32_t offset; /**< The offset in the elf file. */ |
---|
38 | uint32_t size; /**< The size of the section. */ |
---|
39 | uint32_t rap_id; /**< Which obj does this section belongs to. */ |
---|
40 | }section_detail; |
---|
41 | |
---|
42 | /** |
---|
43 | * link map structure will be used for GDB support. |
---|
44 | */ |
---|
45 | struct link_map { |
---|
46 | const char* name; /**< Name of the obj. */ |
---|
47 | uint32_t sec_num; /**< The count of section. */ |
---|
48 | section_detail* sec_detail; /**< The section details. */ |
---|
49 | uint32_t* sec_addr[rap_secs]; /**< The RAP section addr. */ |
---|
50 | uint32_t rpathlen; /**< The length of the path. */ |
---|
51 | char* rpath; /**< The path of object files. */ |
---|
52 | struct link_map* l_next; /**< Linked list of mapped libs. */ |
---|
53 | struct link_map* l_prev; |
---|
54 | }; |
---|
55 | |
---|
56 | /** |
---|
57 | * r_debug is used to manage the debug related structures. |
---|
58 | */ |
---|
59 | struct r_debug { |
---|
60 | int r_version; /* not used */ |
---|
61 | struct link_map *r_map; /* list of loaded images */ |
---|
62 | enum { |
---|
63 | RT_CONSISTENT, /* things are stable */ |
---|
64 | RT_ADD, /* adding a shared library */ |
---|
65 | RT_DELETE /* removing a shared library */ |
---|
66 | } r_state; |
---|
67 | }; |
---|
68 | |
---|
69 | /* |
---|
70 | * stub function. It is empty. |
---|
71 | */ |
---|
72 | void _rtld_debug_state (void); |
---|
73 | |
---|
74 | /* |
---|
75 | * add link map to the list. |
---|
76 | */ |
---|
77 | int _rtld_linkmap_add (rtems_rtl_obj* obj); |
---|
78 | |
---|
79 | /* |
---|
80 | * Remove link map from the list. |
---|
81 | */ |
---|
82 | void _rtld_linkmap_delete (rtems_rtl_obj* obj); |
---|
83 | |
---|
84 | #ifdef __cplusplus |
---|
85 | } |
---|
86 | #endif |
---|
87 | #endif /* _LINK_ELF_H_ */ |
---|