RTEMS: cpukit/libdl/rtl-sym.c File Reference

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
Functions
rtl-sym.c File Reference
API » RTEMS Runtime Link Editor

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_obj_sym * | rtems_rtl_symbol_global_find (const char *name)
void | rtems_rtl_symbol_obj_sort (rtems_rtl_obj *obj)
rtems_rtl_obj_sym * | rtems_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
| ) |  |

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

  obj | The object table the symbols are for.
  esyms | The exported symbol table.
  size | The size of the table in bytes.

## ◆ 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

  name | The name as an ASCIIZ string.

Return values

  NULL | No 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

  obj | The 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

  obj | The 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

  obj | The 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

  obj | The object file to search.
  name | The name as an ASCIIZ string.

Return values

  NULL | No 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

  obj | The 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

  symbols | Close 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

  symbols | The symbol table to open.
  buckets | The number of buckets in the hash table.

Return values

  true | The symbol is open.
  false | The symbol table could not created. The RTL error has the error.