RTEMS 6.1-rc2
Loading...
Searching...
No Matches
rtl-elf.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
11/*
12 * COPYRIGHT (c) 2012-2018 Chris Johns <chrisj@rtems.org>
13 *
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions
16 * are met:
17 * 1. Redistributions of source code must retain the above copyright
18 * notice, this list of conditions and the following disclaimer.
19 * 2. Redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in the
21 * documentation and/or other materials provided with the distribution.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
34 */
35
36#if !defined (_RTEMS_RTL_ELF_H_)
37#define _RTEMS_RTL_ELF_H_
38
39#include <rtems/rtl/rtl-fwd.h>
41#include <rtems/rtl/rtl-sym.h>
42
43#ifdef __cplusplus
44extern "C" {
45#endif /* __cplusplus */
46
51/*
52 * Do not add '()'. Leave plain.
53 */
54#if defined(__powerpc64__) || defined(__aarch64__) || (__riscv_xlen == 64)
55#define ELFSIZE 64
56#else
57#define ELFSIZE 32
58#endif
59
60/*
61 * Define _STANDALONE then remove after.
62 */
63#define _STANDALONE 1
64
65#include <sys/cdefs.h>
66#include <sys/exec_elf.h>
67
68#undef _STANDALONE
69
78{
84
89{
90 bool parsing;
91 void* tampolines;
92 size_t size;
94
100#define RTEMS_RTL_ELF_STRING_MAX (256)
101
111uint32_t rtems_rtl_elf_section_flags (const rtems_rtl_obj* obj,
112 const Elf_Shdr* shdr);
113
126 int section,
127 const char* name,
128 const Elf_Shdr* shdr,
129 const uint32_t flags);
130
140 rtems_rtl_obj_sect* sect);
141
151 rtems_rtl_obj_sect* sect);
152
161bool rtems_rtl_elf_rel_resolve_sym (Elf_Word type);
162
170
185 const Elf_Rel* rel,
186 const rtems_rtl_obj_sect* sect,
187 const char* symname,
188 const Elf_Byte syminfo,
189 const Elf_Word symvalue);
190
205 const Elf_Rela* rela,
206 const rtems_rtl_obj_sect* sect,
207 const char* symname,
208 const Elf_Byte syminfo,
209 const Elf_Word symvalue);
210
225 const Elf_Rel* rel,
226 const rtems_rtl_obj_sect* sect,
227 const char* symname,
228 const Elf_Byte syminfo,
229 const Elf_Word symvalue);
230
245 const Elf_Rela* rela,
246 const rtems_rtl_obj_sect* sect,
247 const char* symname,
248 const Elf_Byte syminfo,
249 const Elf_Word symvalue);
250
257bool rtems_rtl_elf_file_check (rtems_rtl_obj* obj, int fd);
258
265bool rtems_rtl_elf_file_load (rtems_rtl_obj* obj, int fd);
266
273
280
281#ifdef __cplusplus
282}
283#endif /* __cplusplus */
284
285#endif
rtems_rtl_loader_format * rtems_rtl_elf_file_sig(void)
Definition: rtl-elf.c:1841
bool rtems_rtl_elf_file_unload(rtems_rtl_obj *obj)
Definition: rtl-elf.c:1833
bool rtems_rtl_elf_rel_resolve_sym(Elf_Word type)
Definition: rtl-mdreloc-aarch64.c:218
uint32_t rtems_rtl_elf_section_flags(const rtems_rtl_obj *obj, const Elf_Shdr *shdr)
Definition: rtl-mdreloc-aarch64.c:179
size_t rtems_rtl_elf_relocate_tramp_max_size(void)
Definition: rtl-mdreloc-aarch64.c:173
struct rtems_rtl_mdreloc_trmap rtems_rtl_mdreloc_tramp
bool rtems_rtl_elf_arch_section_alloc(const rtems_rtl_obj *obj, rtems_rtl_obj_sect *sect)
Definition: rtl-mdreloc-aarch64.c:200
bool rtems_rtl_elf_file_load(rtems_rtl_obj *obj, int fd)
Definition: rtl-elf.c:1674
bool rtems_rtl_elf_arch_section_free(const rtems_rtl_obj *obj, rtems_rtl_obj_sect *sect)
Definition: rtl-mdreloc-aarch64.c:209
rtems_rtl_elf_rel_status rtems_rtl_elf_relocate_rela_tramp(rtems_rtl_obj *obj, const Elf_Rela *rela, const rtems_rtl_obj_sect *sect, const char *symname, const Elf_Byte syminfo, const Elf_Word symvalue)
Definition: rtl-mdreloc-aarch64.c:520
rtems_rtl_elf_rel_status rtems_rtl_elf_relocate_rela(rtems_rtl_obj *obj, const Elf_Rela *rela, const rtems_rtl_obj_sect *sect, const char *symname, const Elf_Byte syminfo, const Elf_Word symvalue)
Definition: rtl-mdreloc-aarch64.c:537
bool rtems_rtl_elf_file_check(rtems_rtl_obj *obj, int fd)
Definition: rtl-elf.c:1536
rtems_rtl_elf_rel_status rtems_rtl_elf_relocate_rel_tramp(rtems_rtl_obj *obj, const Elf_Rel *rel, const rtems_rtl_obj_sect *sect, const char *symname, const Elf_Byte syminfo, const Elf_Word symvalue)
Definition: rtl-mdreloc-aarch64.c:554
rtems_rtl_elf_rel_status
Definition: rtl-elf.h:78
@ rtems_rtl_elf_rel_no_error
Definition: rtl-elf.h:79
@ rtems_rtl_elf_rel_failure
Definition: rtl-elf.h:80
@ rtems_rtl_elf_rel_tramp_cache
Definition: rtl-elf.h:81
@ rtems_rtl_elf_rel_tramp_add
Definition: rtl-elf.h:82
uint32_t rtems_rtl_elf_arch_parse_section(const rtems_rtl_obj *obj, int section, const char *name, const Elf_Shdr *shdr, const uint32_t flags)
Definition: rtl-mdreloc-aarch64.c:186
rtems_rtl_elf_rel_status rtems_rtl_elf_relocate_rel(rtems_rtl_obj *obj, const Elf_Rel *rel, const rtems_rtl_obj_sect *sect, const char *symname, const Elf_Byte syminfo, const Elf_Word symvalue)
Definition: rtl-mdreloc-aarch64.c:566
RTEMS Run-Time Linker ELF Headers.
RTEMS Run-Time Linker ELF Headers.
RTEMS Run-Time Linker Object File Symbol Table.
Definition: rtl-obj.h:58
Definition: rtl-elf.h:89
bool parsing
Definition: rtl-elf.h:90
void * tampolines
Definition: rtl-elf.h:91
size_t size
Definition: rtl-elf.h:92
Definition: rtl-obj.h:146
Definition: rtl-obj.h:200