RTEMS 6.1-rc1
Functions
rtl-sym.c File Reference

RTEMS Run-Time Linker Object File Symbol Table. More...

#include <errno.h>
#include <inttypes.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <rtems/rtl/rtl.h>
#include "rtl-error.h"
#include <rtems/rtl/rtl-sym.h>
#include <rtems/rtl/rtl-trace.h>

Functions

bool rtems_rtl_symbol_table_open (rtems_rtl_symbols *symbols, size_t buckets)
 
void rtems_rtl_symbol_table_close (rtems_rtl_symbols *symbols)
 
bool rtems_rtl_symbol_global_add (rtems_rtl_obj *obj, const unsigned char *esyms, unsigned int size, rtems_rtl_tls_offset *tls_offsets, unsigned int tls_size)
 
rtems_rtl_obj_symrtems_rtl_symbol_global_find (const char *name)
 
void rtems_rtl_symbol_obj_sort (rtems_rtl_obj *obj)
 
rtems_rtl_obj_symrtems_rtl_symbol_obj_find (rtems_rtl_obj *obj, const char *name)
 
void rtems_rtl_symbol_obj_add (rtems_rtl_obj *obj)
 
void rtems_rtl_symbol_obj_erase_local (rtems_rtl_obj *obj)
 
void rtems_rtl_symbol_obj_erase (rtems_rtl_obj *obj)
 

Detailed Description

RTEMS Run-Time Linker Object File Symbol Table.

Function Documentation

◆ rtems_rtl_symbol_global_add()

bool rtems_rtl_symbol_global_add ( rtems_rtl_obj obj,
const unsigned char *  esyms,
unsigned int  size,
rtems_rtl_tls_offset tls_offsets,
unsigned int  tls_size 
)

Add a table of exported symbols to the symbol table.

The export table is a series of symbol records and each record has two fields:

  1. label
  2. address

The 'label' is an ASCIIZ string of variable length. The address is of size of an unsigned long for the target running the link editor. The byte order is defined by the machine type because the table should be built by the target compiler.

The table is terminated with a nul string followed by the bytes 0xDE, 0xAD, 0xBE, and 0xEF. This avoids alignments issues.

Parameters
objThe object table the symbols are for.
esymsThe exported symbol table.
sizeThe size of the table in bytes.
tls_offsetsThe TLS offsets table. If NULL none provided.
tls_sizeThe number TLS offset entries in the table.

◆ rtems_rtl_symbol_global_find()

rtems_rtl_obj_sym * rtems_rtl_symbol_global_find ( const char *  name)

Find a symbol given the symbol label in the global symbol table.

Parameters
nameThe name as an ASCIIZ string.
Return values
NULLNo symbol found.
Returns
rtems_rtl_obj_sym* Reference to the symbol.

◆ rtems_rtl_symbol_obj_add()

void rtems_rtl_symbol_obj_add ( rtems_rtl_obj obj)

Add the object file's symbols to the global table.

Parameters
objThe object file the symbols are to be added.

◆ rtems_rtl_symbol_obj_erase()

void rtems_rtl_symbol_obj_erase ( rtems_rtl_obj obj)

Erase the object file's symbols.

Parameters
objThe object file the symbols are to be erased from.

◆ rtems_rtl_symbol_obj_erase_local()

void rtems_rtl_symbol_obj_erase_local ( rtems_rtl_obj obj)

Erase the object file's local symbols.

Parameters
objThe object file the local symbols are to be erased from.

◆ rtems_rtl_symbol_obj_find()

rtems_rtl_obj_sym * rtems_rtl_symbol_obj_find ( rtems_rtl_obj obj,
const char *  name 
)

Find a symbol given the symbol label in the local object file.

Parameters
objThe object file to search.
nameThe name as an ASCIIZ string.
Return values
NULLNo symbol found.
Returns
rtems_rtl_obj_sym* Reference to the symbol.

◆ rtems_rtl_symbol_obj_sort()

void rtems_rtl_symbol_obj_sort ( rtems_rtl_obj obj)

Sort an object file's local and global symbol table. This needs to be done before calling rtems_rtl_symbol_obj_find as it performs a binary search on the tables.

Parameters
objThe object file to sort.

◆ rtems_rtl_symbol_table_close()

void rtems_rtl_symbol_table_close ( rtems_rtl_symbols symbols)

Close the table and erase the hash table.

Parameters
symbolsClose the symbol table.

◆ rtems_rtl_symbol_table_open()

bool rtems_rtl_symbol_table_open ( rtems_rtl_symbols symbols,
size_t  buckets 
)

Open a symbol table with the specified number of buckets.

Parameters
symbolsThe symbol table to open.
bucketsThe number of buckets in the hash table.
Return values
trueThe symbol is open.
falseThe symbol table could not created. The RTL error has the error.