source: rtems/cpukit/include/rtems/rtl/rtl-sym.h @ 03139d5b

5
Last change on this file since 03139d5b was 03139d5b, checked in by Chris Johns <chrisj@…>, on 11/20/18 at 03:56:11

libdl: Add object file dependencies to track references

Tracking references lets us manage when an object file can be
unloaded. If an object file has references to it, it cannot be
unloaded.

Modules that depend on each other cannot be unloaded.

Updates #3605

  • Property mode set to 100644
File size: 3.7 KB
Line 
1/*
2 *  COPYRIGHT (c) 2012-2014, 2018 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/**
9 * @file
10 *
11 * @ingroup rtems_rtl
12 *
13 * @brief RTEMS Run-Time Linker Object File Symbol Table.
14 */
15
16#if !defined (_RTEMS_RTL_SYM_H_)
17#define _RTEMS_RTL_SYM_H_
18
19#include <rtems.h>
20#include "rtl-obj-fwd.h"
21
22#ifdef __cplusplus
23extern "C" {
24#endif /* __cplusplus */
25
26/**
27 * An object file symbol.
28 */
29typedef struct rtems_rtl_obj_sym
30{
31  rtems_chain_node node;    /**< The node's link in the chain. */
32  const char*      name;    /**< The symbol's name. */
33  void*            value;   /**< The value of the symbol. */
34  uint32_t         data;    /**< Format specific data. */
35} rtems_rtl_obj_sym;
36
37/**
38 * Table of symbols stored in a hash table.
39 */
40typedef struct rtems_rtl_symbols
41{
42  rtems_chain_control* buckets;
43  size_t               nbuckets;
44} rtems_rtl_symbols;
45
46/**
47 * Open a symbol table with the specified number of buckets.
48 *
49 * @param symbols The symbol table to open.
50 * @param buckets The number of buckets in the hash table.
51 * @retval true The symbol is open.
52 * @retval false The symbol table could not created. The RTL
53 *               error has the error.
54 */
55bool rtems_rtl_symbol_table_open (rtems_rtl_symbols* symbols,
56                                  size_t             buckets);
57
58/**
59 * Close the table and erase the hash table.
60 *
61 * @param symbols Close the symbol table.
62 */
63void rtems_rtl_symbol_table_close (rtems_rtl_symbols* symbols);
64
65/**
66 * Add a table of exported symbols to the symbol table.
67 *
68 * The export table is a series of symbol records and each record has two
69 * fields:
70 *
71 *  1. label
72 *  2. address
73 *
74 * The 'label' is an ASCIIZ string of variable length. The address is of size
75 * of an unsigned long for the target running the link editor. The byte order
76 * is defined by the machine type because the table should be built by the
77 * target compiler.
78 *
79 * The table is terminated with a nul string followed by the bytes 0xDE, 0xAD,
80 * 0xBE, and 0xEF. This avoids alignments issues.
81 *
82 * @param obj The object table the symbols are for.
83 * @param esyms The exported symbol table.
84 * @param size The size of the table in bytes.
85 */
86bool rtems_rtl_symbol_global_add (rtems_rtl_obj*       obj,
87                                  const unsigned char* esyms,
88                                  unsigned int         size);
89
90/**
91 * Find a symbol given the symbol label in the global symbol table.
92 *
93 * @param name The name as an ASCIIZ string.
94 * @retval NULL No symbol found.
95 * @return rtems_rtl_obj_sym* Reference to the symbol.
96 */
97rtems_rtl_obj_sym* rtems_rtl_symbol_global_find (const char* name);
98
99/**
100 * Find a symbol given the symbol label in the local object file.
101 *
102 * @param obj The object file to search.
103 * @param name The name as an ASCIIZ string.
104 * @retval NULL No symbol found.
105 * @return rtems_rtl_obj_sym* Reference to the symbol.
106 */
107rtems_rtl_obj_sym* rtems_rtl_symbol_obj_find (rtems_rtl_obj* obj,
108                                              const char*    name);
109
110/**
111 * Add the object file's symbols to the global table.
112 *
113 * @param obj The object file the symbols are to be added.
114 */
115void rtems_rtl_symbol_obj_add (rtems_rtl_obj* obj);
116
117/**
118 * Erase the object file's local symbols.
119 *
120 * @param obj The object file the local symbols are to be erased from.
121 */
122void rtems_rtl_symbol_obj_erase_local (rtems_rtl_obj* obj);
123
124/**
125 * Erase the object file's symbols.
126 *
127 * @param obj The object file the symbols are to be erased from.
128 */
129void rtems_rtl_symbol_obj_erase (rtems_rtl_obj* obj);
130
131#ifdef __cplusplus
132}
133#endif /* __cplusplus */
134
135#endif
Note: See TracBrowser for help on using the repository browser.