source: mainline/uspace/lib/c/include/elf/elf_mod.h@ d7f7a4a

Last change on this file since d7f7a4a was d7f7a4a, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 3 years ago

Replace some license headers with SPDX identifier

Headers are replaced using tools/transorm-copyright.sh only
when it can be matched verbatim with the license header used
throughout most of the codebase.

  • Property mode set to 100644
File size: 1.7 KB
Line 
1/*
2 * SPDX-FileCopyrightText: 2006 Sergey Bondari
3 * SPDX-FileCopyrightText: 2008 Jiri Svoboda
4 *
5 * SPDX-License-Identifier: BSD-3-Clause
6 */
7
8/** @addtogroup libc
9 * @{
10 */
11/** @file
12 * @brief ELF loader structures and public functions.
13 */
14
15#ifndef ELF_MOD_H_
16#define ELF_MOD_H_
17
18#include <elf/elf.h>
19#include <stddef.h>
20#include <stdint.h>
21#include <loader/pcb.h>
22
23typedef enum {
24 /** Leave all segments in RW access mode. */
25 ELDF_RW = 1
26} eld_flags_t;
27
28/** TLS info for a module */
29typedef struct {
30 /** tdata section image */
31 void *tdata;
32 /** Size of tdata section image in bytes */
33 size_t tdata_size;
34 /** Size of tbss section */
35 size_t tbss_size;
36 /** Alignment of TLS initialization image */
37 size_t tls_align;
38} elf_tls_info_t;
39
40/**
41 * Some data extracted from the headers are stored here
42 */
43typedef struct {
44 /** Entry point */
45 entry_point_t entry;
46
47 /** The base address where the file has been loaded.
48 * Points to the ELF file header.
49 */
50 void *base;
51
52 /** ELF interpreter name or NULL if statically-linked */
53 const char *interp;
54
55 /** Pointer to the dynamic section */
56 void *dynamic;
57
58 /** TLS info */
59 elf_tls_info_t tls;
60} elf_finfo_t;
61
62/**
63 * Holds information about an ELF binary being loaded.
64 */
65typedef struct {
66 /** Filedescriptor of the file from which we are loading */
67 int fd;
68
69 /** Difference between run-time addresses and link-time addresses */
70 uintptr_t bias;
71
72 /** Flags passed to the ELF loader. */
73 eld_flags_t flags;
74
75 /** Store extracted info here */
76 elf_finfo_t *info;
77} elf_ld_t;
78
79extern errno_t elf_load_file(int, eld_flags_t, elf_finfo_t *);
80extern errno_t elf_load_file_name(const char *, eld_flags_t, elf_finfo_t *);
81
82#endif
83
84/** @}
85 */
Note: See TracBrowser for help on using the repository browser.