RTEMS CPU Kit with SuperCore
4.11.3
|
RTEMS Run-Time Linker Object File Unresolved Relocations Table. More...
Go to the source code of this file.
Data Structures | |
struct | rtems_rtl_unresolv_name_s |
Unresolved externals symbol names. More... | |
struct | rtems_rtl_unresolv_reloc_s |
Unresolved externals symbols require the relocation records to be held and references. More... | |
struct | rtems_rtl_unresolv_rec_s |
Unresolved externals records. More... | |
struct | rtems_rtl_unresolv_block_s |
Unresolved blocks. More... | |
struct | rtems_rtl_unresolved_s |
Unresolved table holds the names and relocations. More... | |
Typedefs | |
typedef uint32_t | rtems_rtl_word_t |
Hack to work around machine size. More... | |
typedef enum rtems_rtl_unresolved_rtype_e | rtems_rtl_unresolved_rtype_t |
The types of records in the blocks. | |
typedef struct rtems_rtl_unresolv_name_s | rtems_rtl_unresolv_name_t |
Unresolved externals symbol names. More... | |
typedef struct rtems_rtl_unresolv_reloc_s | rtems_rtl_unresolv_reloc_t |
Unresolved externals symbols require the relocation records to be held and references. | |
typedef struct rtems_rtl_unresolv_rec_s | rtems_rtl_unresolv_rec_t |
Unresolved externals records. | |
typedef struct rtems_rtl_unresolv_block_s | rtems_rtl_unresolv_block_t |
Unresolved blocks. | |
typedef struct rtems_rtl_unresolved_s | rtems_rtl_unresolved_t |
Unresolved table holds the names and relocations. | |
typedef bool | rtems_rtl_unresolved_iterator_t(rtems_rtl_unresolv_rec_t *rec, void *data) |
The iterator function used to iterate over the unresolved table. More... | |
Enumerations | |
enum | rtems_rtl_unresolved_rtype_e { rtems_rtl_unresolved_empty = 0, rtems_rtl_unresolved_name = 1, rtems_rtl_unresolved_reloc = 2 } |
The types of records in the blocks. More... | |
Functions | |
bool | rtems_rtl_unresolved_table_open (rtems_rtl_unresolved_t *unresolved, size_t block_records) |
Open an unresolved relocation table. More... | |
void | rtems_rtl_unresolved_table_close (rtems_rtl_unresolved_t *unresolved) |
Close the table and erase the blocks. More... | |
bool | rtems_rtl_unresolved_interate (rtems_rtl_unresolved_iterator_t iterator, void *data) |
Iterate over the table of unresolved entries. | |
bool | rtems_rtl_unresolved_add (rtems_rtl_obj_t *obj, const uint16_t flags, const char *name, const uint16_t sect, const rtems_rtl_word_t *rel) |
Add a relocation to the list of unresolved relocations. More... | |
void | rtems_rtl_unresolved_resolve (void) |
Resolve the unresolved symbols. | |
bool | rtems_rtl_unresolved_remove (rtems_rtl_obj_t *obj, const char *name, const uint16_t sect, const rtems_rtl_word_t *rel) |
Remove a relocation from the list of unresolved relocations. More... | |
RTEMS Run-Time Linker Object File Unresolved Relocations Table.
The unresolved relocation table holds relocations in a loaded object file which reference unresolved external symbols. The support is needed to allow dependent object files to load. In the case of dependent object files one will have unresolved externals until the dependent object file is also loaded. There is no load order that resolves this.
The unresolved relocation table is a single table used by all object files with unresolved symbols. It made of blocks linked together where blocks are allocated as requiered. The table is always maintained compacted. That is as relocations are resolved and removed the table is compacted. The only pointer in the table is the object file poniter. This is used to identify which object the relocation belongs to. There are no linking or back pointers in the unresolved relocations table. The table is scanned for each object file's relocations. This is not fast but the table should be small and if it happens to grow large you have other more pressing issues to resolve in your application.
The table holds two (2) types of records:
The symbol name a relocation references is held in a specific symbol name string record in the table the relocation record references. The record counts the number of references and the string is removed from the table when the reference count reaches 0. There can be many relocations referencing the symbol. The strings are referenced by a single 16bit unsigned integer which is the count of the string in the table.
The section the relocation is for in the object is the section number. The relocation data is series of machine word sized fields:
typedef struct rtems_rtl_unresolv_name_s rtems_rtl_unresolv_name_t |
Unresolved externals symbol names.
The names are reference counted and separate from the relocation records because a number of records could reference the same symbol name.
typedef bool rtems_rtl_unresolved_iterator_t(rtems_rtl_unresolv_rec_t *rec, void *data) |
The iterator function used to iterate over the unresolved table.
rec | The current iterator. |
data | The user data. |
true | The iterator has finished. |
false | The iterator has not finished. Keep iterating. |
typedef uint32_t rtems_rtl_word_t |
Hack to work around machine size.
This needs to be cleaned up to better support 64bit targets.
bool rtems_rtl_unresolved_add | ( | rtems_rtl_obj_t * | obj, |
const uint16_t | flags, | ||
const char * | name, | ||
const uint16_t | sect, | ||
const rtems_rtl_word_t * | rel | ||
) |
Add a relocation to the list of unresolved relocations.
unresolved | The unresolved symbol table. |
obj | The object table the symbols are for. |
flags | Format specific flags. |
name | The symbol name the relocation references. |
sect | The target section number the relocation references. |
rel | The format specific relocation data. |
true | The relocation has been added. |
false | The relocation could not be added. |
bool rtems_rtl_unresolved_remove | ( | rtems_rtl_obj_t * | obj, |
const char * | name, | ||
const uint16_t | sect, | ||
const rtems_rtl_word_t * | rel | ||
) |
Remove a relocation from the list of unresolved relocations.
unresolved | The unresolved symbol table. |
obj | The object table the symbols are for. |
esyms | The exported symbol table. |
size | The size of the table in bytes. |
References rtems_rtl_unresolved().
void rtems_rtl_unresolved_table_close | ( | rtems_rtl_unresolved_t * | unresolved | ) |
Close the table and erase the blocks.
unreolved | Close the unresolved table. |
References rtems_rtl_unresolved_s::blocks, rtems_chain_first(), and rtems_chain_is_tail().
bool rtems_rtl_unresolved_table_open | ( | rtems_rtl_unresolved_t * | unresolved, |
size_t | block_records | ||
) |
Open an unresolved relocation table.
unresolv | The unresolved table to open. |
block_records | The number of records per block allocated. |
true | The table is open. |
false | The unresolved relocation table could not created. The RTL error has the error. |
References rtems_rtl_unresolved_s::block_recs, rtems_rtl_unresolved_s::blocks, and rtems_chain_initialize_empty().