RTEMS CPU Kit with SuperCore  4.11.3
rtl.h
Go to the documentation of this file.
1 /*
2  * COPYRIGHT (c) 2012 Chris Johns <chrisj@rtems.org>
3  *
4  * The license and distribution terms for this file may be
5  * found in the file LICENSE in this distribution or at
6  * http://www.rtems.org/license/LICENSE.
7  */
8 
19 #if !defined (_RTEMS_RTL_H_)
20 #define _RTEMS_RTL_H_
21 
22 #include <link.h>
23 #include <rtems.h>
24 #include <rtems/chain.h>
25 
26 #include <rtems/rtl/rtl-allocator.h>
27 #include <rtems/rtl/rtl-fwd.h>
28 #include <rtems/rtl/rtl-obj.h>
29 #include <rtems/rtl/rtl-obj-cache.h>
30 #include <rtems/rtl/rtl-obj-comp.h>
31 #include <rtems/rtl/rtl-unresolved.h>
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif /* __cplusplus */
36 
55 #ifdef __STDC__
56 #define RTL_XGLUE(a,b) a##b
57 #else
58 #define RTL_XGLUE(a,b) ab
59 #endif
60 
61 #define RTL_GLUE(a,b) RTL_XGLUE(a,b)
62 
66 #define RTEMS_RTL_SYMS_GLOBAL_BUCKETS (32)
67 
71 #define RTEMS_RTL_UNRESOLVED_BLOCK_SIZE (64)
72 
76 extern struct r_debug _rtld_debug;
77 
82 extern void _rtld_debug_state (void);
83 
87 typedef void (*rtems_rtl_cdtor_t)(void);
88 
98 {
102  const char* paths;
111  char last_error[64];
112 };
113 
121 
130 
139 
154 
158 void rtems_rtl_obj_caches_flush (void);
159 
170  rtems_rtl_obj_cache_t* cache,
171  int fd,
172  int compression,
173  off_t offset);
174 
183 
190 bool rtems_rtl_unlock (void);
191 
202 
210 rtems_rtl_obj_t* rtems_rtl_find_obj (const char* name);
211 
243 rtems_rtl_obj_t* rtems_rtl_load_object (const char* name, int mode);
244 
255 
263 
274 int rtems_rtl_get_error (char* message, size_t max_message);
275 
283 bool rtems_rtl_path_append (const char* path);
284 
293 bool rtems_rtl_path_prepend (const char* path);
294 
303 void rtems_rtl_base_sym_global_add (const unsigned char* esyms,
304  unsigned int count);
305 
316 
317 #ifdef __cplusplus
318 }
319 #endif /* __cplusplus */
320 
321 #endif
rtems_rtl_symbols_t * rtems_rtl_global_symbols(void)
Get the RTL global symbol table with out locking.
Definition: rtl.c:268
Definition: media-server.c:33
rtems_rtl_obj_cache_t strings
Strings object file cache.
Definition: rtl.h:107
rtems_id lock
The RTL lock id.
Definition: rtl.h:99
rtems_rtl_unresolved_t * rtems_rtl_unresolved(void)
Get the RTL resolved table with out locking.
Definition: rtl.c:279
Objects_Id rtems_id
Used to manage and manipulate RTEMS object identifiers.
Definition: types.h:80
rtems_rtl_obj_t * rtems_rtl_load_object(const char *name, int mode)
Load an object file into memory relocating it.
Definition: rtl.c:435
bool rtems_rtl_unload_object(rtems_rtl_obj_t *obj)
Unload an object file.
Definition: rtl.c:513
void rtems_rtl_run_ctors(rtems_rtl_obj_t *obj)
Run any constructor functions the object file may contain.
Definition: rtl.c:554
rtems_rtl_obj_comp_t decomp
The decompression compressor.
Definition: rtl.h:109
This is used to manage a chain.
Definition: chain.h:83
void rtems_rtl_obj_caches(rtems_rtl_obj_cache_t **symbols, rtems_rtl_obj_cache_t **strings, rtems_rtl_obj_cache_t **relocs)
Get the RTL symbols, strings, or relocations object file caches.
Definition: rtl.c:290
The allocator data.
Definition: rtl-allocator.h:74
rtems_rtl_data_t * rtems_rtl_data(void)
Get the RTL data with out locking.
Definition: rtl.c:262
int rtems_rtl_get_error(char *message, size_t max_message)
Get the last error message clearing it.
Definition: rtl-error.c:40
rtems_chain_control objects
List if loaded object files.
Definition: rtl.h:101
Table of symbols stored in a hash table.
Definition: rtl-sym.h:40
r_debug is used to manage the debug related structures.
Definition: link_elf.h:56
const char * paths
Search paths for archives.
Definition: rtl.h:102
rtems_rtl_symbols_t globals
Global symbol table.
Definition: rtl.h:103
The buffer cache.
Definition: rtl-obj-cache.h:53
bool rtems_rtl_path_prepend(const char *path)
Prepend the path to the search path.
Definition: rtl.c:641
rtems_rtl_obj_t * rtems_rtl_baseimage(void)
Return the object file descriptor for the base image.
Definition: rtl.c:665
void rtems_rtl_obj_comp(rtems_rtl_obj_comp_t **decomp, rtems_rtl_obj_cache_t *cache, int fd, int compression, off_t offset)
Get the RTL decompressor setting the cache and the offset in the file the compressed stream starts...
Definition: rtl.c:326
rtems_rtl_data_t * rtems_rtl_lock(void)
Lock the Run-time Linker.
Definition: rtl.c:344
rtems_rtl_obj_cache_t relocs
Relocations object file cache.
Definition: rtl.h:108
The compressed file.
Definition: rtl-obj-comp.h:46
void _rtld_debug_state(void)
Debugger break function.
Definition: rtl-debugger.c:38
RTL Object.
Definition: rtl-obj.h:156
bool rtems_rtl_path_append(const char *path)
Append the path to the search path.
Definition: rtl.c:635
rtems_rtl_obj_t * base
Base object file.
Definition: rtl.h:105
bool rtems_rtl_unlock(void)
Unlock the Run-time Linker.
Definition: rtl.c:363
The global RTL data.
Definition: rtl.h:97
struct r_debug _rtld_debug
The global debugger interface variable.
Definition: rtl-debugger.c:35
Unresolved table holds the names and relocations.
Definition: rtl-unresolved.h:129
rtems_rtl_obj_cache_t symbols
Symbols object file cache.
Definition: rtl.h:106
void rtems_rtl_base_sym_global_add(const unsigned char *esyms, unsigned int count)
Add an exported symbol table to the global symbol table.
Definition: rtl.c:647
Chain API.
rtems_rtl_unresolved_t unresolved
Unresolved symbols.
Definition: rtl.h:104
char last_error[64]
Last error string.
Definition: rtl.h:111
rtems_rtl_obj_t * rtems_rtl_check_handle(void *handle)
Check a pointer is a valid object file descriptor returning the pointer as that type.
Definition: rtl.c:379
rtems_rtl_obj_t * rtems_rtl_find_obj(const char *name)
Find the object given a file name.
Definition: rtl.c:399
void(* rtems_rtl_cdtor_t)(void)
The type of constructor/destructor function.
Definition: rtl.h:87
void rtems_rtl_obj_caches_flush(void)
Flush all the object file caches.
Definition: rtl.c:315
rtems_rtl_alloc_data_t allocator
The allocator data.
Definition: rtl.h:100
int last_errno
Last error number.
Definition: rtl.h:110