RTEMS 6.1-rc2
|
RTEMS Run-Time Link Editor. More...
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <rtems/libio_.h>
#include <rtems/rtl/rtl.h>
#include <rtems/rtl/rtl-allocator.h>
#include <rtems/rtl/rtl-trace.h>
#include "rtl-chain-iterator.h"
#include "rtl-error.h"
#include "rtl-string.h"
Data Structures | |
struct | rtems_rtl_obj_flags_data |
Macros | |
#define | RTEMS_RTL_ELF_SYMBOL_CACHE (2048) |
#define | RTEMS_RTL_ELF_STRING_CACHE (2048) |
#define | RTEMS_RTL_ELF_RELOC_CACHE (2048) |
#define | RTEMS_RTL_COMP_OUTPUT (2048) |
Typedefs | |
typedef struct rtems_rtl_obj_flags_data | rtems_rtl_obj_flags_data |
RTEMS Run-Time Link Editor.
This is the RTL implementation.
#define RTEMS_RTL_COMP_OUTPUT (2048) |
Decompression output buffer.
#define RTEMS_RTL_ELF_RELOC_CACHE (2048) |
Relocations table cache size.
#define RTEMS_RTL_ELF_STRING_CACHE (2048) |
String table cache size.
#define RTEMS_RTL_ELF_SYMBOL_CACHE (2048) |
Symbol table cache size. They can be big so the cache needs space to work.
rtems_rtl_archives * rtems_rtl_archives_unprotected | ( | void | ) |
Get the RTL archives with out locking. This call assumes the RTL is locked.
NULL | The RTL data is not initialised. |
void rtems_rtl_base_global_syms_init | ( | void | ) |
Define a default base global symbol loader function that is weak so a real table can be linked in when the user wants one.
void rtems_rtl_base_sym_global_add | ( | const unsigned char * | esyms, |
unsigned int | count, | ||
rtems_rtl_tls_offset * | tls_offsets, | ||
unsigned int | tls_size | ||
) |
Add an exported symbol table to the global symbol table. This call is normally used by an object file when loaded that contains a global symbol table.
esyms | The exported symbol table. |
count | The size of the exported symbol table. |
tls_offsets | The TLS offsets table. If NULL none provided. |
tls_size | The number TLS offset entries in the table. |
rtems_rtl_obj * rtems_rtl_baseimage | ( | void | ) |
Return the object file descriptor for the base image. The object file descriptor returned is created when the run time linker is initialised.
Assumes the RTL has been locked.
rtems_rtl_obj * rtems_rtl_check_handle | ( | void * | handle | ) |
Check a pointer is a valid object file descriptor returning the pointer as that type.
Assumes the RTL has been locked.
handle | Pointer to the object file to be validated. |
rtems_rtl_data * rtems_rtl_data_unprotected | ( | void | ) |
Get the RTL data with out locking. This call assumes the RTL is locked.
NULL | The RTL data is not initialised. |
rtems_rtl_obj * rtems_rtl_find_obj | ( | const char * | name | ) |
Find the object given a file name.
name | The name of the object file. |
NULL | No object file with that name found. |
rtems_rtl_obj * rtems_rtl_find_obj_with_symbol | ( | const rtems_rtl_obj_sym * | sym | ) |
Find the object file a symbol is exported from.
sym | The symbol to search with. |
NULL | No object file found. |
rtems_rtl_symbols * rtems_rtl_global_symbols | ( | void | ) |
Get the RTL global symbol table with out locking. This call assumes the RTL is locked.
NULL | The RTL data is not initialised. |
const char * rtems_rtl_last_error_unprotected | ( | void | ) |
Get the RTL last error string with out locking. This call assumes the RTL is locked.
NULL | The RTL data is not initialised. |
rtems_rtl_obj * rtems_rtl_load | ( | const char * | name, |
int | mode | ||
) |
Load an object file. This is the user accessable interface to unloading an object file. See @rtems_rtl_load_object.
name | The name of the object file. |
mode | The mode of the load as defined by the dlopen call. |
rtems_rtl_obj * rtems_rtl_load_object | ( | const char * | name, |
int | mode | ||
) |
Load an object file into memory relocating it. It will not be resolved against other symbols in other object files or the base image.
The name can be a file name for an object file or it can be encoded to reference an archive of object modules (static library). This encoding is specific to RTEMS and allows dependences to specify an archive without the searching overhead normally incurred by linkers locating object files in an archive. The file name format rules are:
Assumes the RTL has been locked.
name | The name of the object file. |
mode | The mode of the load as defined by the dlopen call. |
rtems_rtl_data * rtems_rtl_lock | ( | void | ) |
Lock the Run-time Linker.
NULL | The RTL data could not be initialised or locked. Typically this means the lock could not be created. |
void rtems_rtl_obj_caches | ( | rtems_rtl_obj_cache ** | symbols, |
rtems_rtl_obj_cache ** | strings, | ||
rtems_rtl_obj_cache ** | relocs | ||
) |
Get the RTL symbols, strings, or relocations object file caches. This call assmes the RTL is locked.
symbols | Pointer to the location to set the cache into. Returns NULL is rtl is not initialised. If NULL is passed in no value set. |
strings | Pointer to the location to set the cache into. Returns NULL is rtl is not initialised. If NULL is passed in no value set. |
relocs | Pointer to the location to set the cache into. Returns NULL is rtl is not initialised. If NULL is passed in no value set. |
void rtems_rtl_obj_caches_flush | ( | void | ) |
Flush all the object file caches.
void rtems_rtl_obj_decompress | ( | rtems_rtl_obj_comp ** | decomp, |
rtems_rtl_obj_cache * | cache, | ||
int | fd, | ||
int | compression, | ||
off_t | offset | ||
) |
Get the RTL decompressor setting for the cache and the offset in the file the compressed stream starts. This call assumes the RTL is locked.
decomp | Pointer to the location to set the compressor into. Returns NULL is rtl is not initialised. |
cache | The cache to read the file with. Saves needing an extrs buffer. |
offset | The offset in the file the compressed stream starts. |
void rtems_rtl_obj_update_flags | ( | uint32_t | clear, |
uint32_t | set | ||
) |
Update the mask in the object files. You can clear flags and then set flags. A zero (0) does not clear or set the flags. This is global to all object files that are laoded.
clear | The flag's clear mask, a 0 does not clear any flags. |
set | The flag's set mask, a 0 does not set any flags. |
rtems_chain_control * rtems_rtl_objects_unprotected | ( | void | ) |
Get the RTL objects table with out locking. This call assumes the RTL is locked.
NULL | The RTL data is not initialised. |
bool rtems_rtl_path_append | ( | const char * | path | ) |
Append the path to the search path.
path | The path to append. |
false | The path could not be appended. |
true | The path was appended. |
bool rtems_rtl_path_prepend | ( | const char * | path | ) |
Prepend the path to the search path.
path | The path to prepend. |
false | The path could not be prepended. |
true | The path was prepended. |
rtems_chain_control * rtems_rtl_pending_unprotected | ( | void | ) |
Get the RTL pending with out locking. This call assumes the RTL is locked.
NULL | The RTL data is not initialised. |
bool rtems_rtl_unload | ( | rtems_rtl_obj * | obj | ) |
Unload an object file. This is the user accessable interface to unloading an object file. See @rtems_rtl_unload_object.
Assumes the RTL has been locked.
obj | The object file descriptor. |
true | The object file has been unloaded. |
false | The object file could not be unloaded. |
bool rtems_rtl_unload_object | ( | rtems_rtl_obj * | obj | ) |
Unload an object file. This only happens when the user count is 0.
Assumes the RTL has been locked.
obj | The object file descriptor. |
true | The object file has been unloaded. |
false | The object file could not be unloaded. |
void rtems_rtl_unlock | ( | void | ) |
Unlock the Run-time Linker.
rtems_rtl_unresolved * rtems_rtl_unresolved_unprotected | ( | void | ) |
Get the RTL unresolved table with out locking. This call assumes the RTL is locked.
NULL | The RTL data is not initialised. |