source: rtems/cpukit/libdl/rtl-elf.h @ d2e31f7

4.11
Last change on this file since d2e31f7 was d2e31f7, checked in by Chris Johns <chrisj@…>, on 03/28/17 at 06:23:05

libdl: Back port C++ exception throw and catch from 4.12.

Closes #2956.

  • Property mode set to 100644
File size: 5.5 KB
Line 
1/*
2 *  COPYRIGHT (c) 2012 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 ELF Headers
14 */
15
16#if !defined (_RTEMS_RTL_ELF_H_)
17#define _RTEMS_RTL_ELF_H_
18
19#include "rtl-fwd.h"
20#include "rtl-obj-fwd.h"
21#include "rtl-sym.h"
22
23#ifdef __cplusplus
24extern "C" {
25#endif /* __cplusplus */
26
27/**
28 ** Imported NetBSD ELF Specifics Start.
29 **/
30
31/*
32 * Always 32bit for RTEMS at the moment. Do not add '()'. Leave plain.
33 */
34#define ELFSIZE 32
35
36/*
37 * Define _STANDALONE then remove after.
38 */
39#define _STANDALONE 1
40
41#include <sys/cdefs.h>
42#include <sys/exec_elf.h>
43
44#undef _STANDALONE
45
46/**
47 ** Imported NetBSD ELF Specifics End.
48 **/
49
50/**
51 * Maximum string length. This a read buffering limit rather than a
52 * specific ELF length. I hope this is ok as I am concerned about
53 * some C++ symbol lengths.
54 */
55#define RTEMS_RTL_ELF_STRING_MAX (256)
56
57/**
58 * Architecture specific handler to translate unknown section flags to RTL
59 * section flags.
60 *
61 * @param obj The object file being relocated.
62 * @param shdr The ELF section header.
63 * @retval 0 Unknown or unsupported flags.
64 * @retval uint32_t RTL object file flags.
65 */
66uint32_t rtems_rtl_elf_section_flags (const rtems_rtl_obj_t* obj,
67                                      const Elf_Shdr*        shdr);
68
69/**
70 * Architecture specific handler to check is a relocation record's type is
71 * required to resolve a symbol.
72 *
73 * @param type The type field in the relocation record.
74 * @retval true The relocation record require symbol resolution.
75 * @retval false The relocation record does not require symbol resolution.
76 */
77bool rtems_rtl_elf_rel_resolve_sym (Elf_Word type);
78
79/**
80 * Architecture specific relocation handler compiled in for a specific
81 * architecture by the build system. The handler applies the relocation
82 * to the target.
83 *
84 * @param obj The object file being relocated.
85 * @param rel The ELF relocation record.
86 * @param sect The section of the object file the relocation is for.
87 * @param symname The symbol's name.
88 * @param syminfo The ELF symbol info field.
89 * @param symvalue If a symbol is referenced, this is the symbols value.
90 * @retval bool The relocation has been applied.
91 * @retval bool The relocation could not be applied.
92 */
93bool rtems_rtl_elf_relocate_rel (const rtems_rtl_obj_t*      obj,
94                                 const Elf_Rel*              rel,
95                                 const rtems_rtl_obj_sect_t* sect,
96                                 const char*                 symname,
97                                 const Elf_Byte              syminfo,
98                                 const Elf_Word              symvalue);
99
100/**
101 * Architecture specific relocation handler compiled in for a specific
102 * architecture by the build system. The handler applies the relocation
103 * to the target.
104 *
105 * @param obj The object file being relocated.
106 * @param rela The ELF addend relocation record.
107 * @param sect The section of the object file the relocation is for.
108 * @param symname The symbol's name.
109 * @param syminfo The ELF symbol info field.
110 * @param symvalue If a symbol is referenced, this is the symbols value.
111 * @retval bool The relocation has been applied.
112 * @retval bool The relocation could not be applied.
113 */
114bool rtems_rtl_elf_relocate_rela (const rtems_rtl_obj_t*      obj,
115                                  const Elf_Rela*             rela,
116                                  const rtems_rtl_obj_sect_t* sect,
117                                  const char*                 symname,
118                                  const Elf_Byte              syminfo,
119                                  const Elf_Word              symvalue);
120
121/**
122 * Find the symbol. The symbol is passed as an ELF type symbol with the name
123 * and the value returned is the absolute address of the symbol.
124 *
125 * If the symbol type is STT_NOTYPE the symbol references a global symbol. The
126 * gobal symbol table is searched to find it and that value returned. If the
127 * symbol is local to the object module the section for the symbol is located
128 * and it's base added to the symbol's value giving an absolute location.
129 *
130 * @param obj The object the symbol is being resolved for.
131 * @param sym The ELF type symbol.
132 * @param symname The sym's name read from the symbol string table.
133 * @param value Return the value of the symbol. Only valid if the return value
134 *              is true.
135 * @retval true The symbol resolved.
136 * @retval false The symbol could not be result. The RTL error is set.
137 */
138bool rtems_rtl_elf_find_symbol (rtems_rtl_obj_t* obj,
139                                const Elf_Sym*   sym,
140                                const char*      symname,
141                                Elf_Word*        value);
142
143/**
144 * The ELF format check handler.
145 *
146 * @param obj The object being checked.
147 * @param fd The file descriptor.
148 */
149bool rtems_rtl_elf_file_check (rtems_rtl_obj_t* obj, int fd);
150
151/**
152 * The ELF format load handler.
153 *
154 * @param obj The object to load.
155 * @param fd The file descriptor.
156 */
157bool rtems_rtl_elf_file_load (rtems_rtl_obj_t* obj, int fd);
158
159/**
160 * The ELF format unload handler.
161 *
162 * @param obj The object to unload.
163 */
164bool rtems_rtl_elf_file_unload (rtems_rtl_obj_t* obj);
165
166/**
167 * The ELF format signature handler.
168 *
169 * @return rtems_rtl_loader_format_t* The format's signature.
170 */
171rtems_rtl_loader_format_t* rtems_rtl_elf_file_sig (void);
172
173#ifdef __cplusplus
174}
175#endif /* __cplusplus */
176
177#endif
Note: See TracBrowser for help on using the repository browser.