summaryrefslogtreecommitdiffstats
path: root/doc/elf32_xlatetom.3
blob: 1996cf8e8a358534fca6ccf79d0a9d37037f1010 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
.TH ELF32_XLATETOM 3 "June 2024" "Elfutils" "Library Functions Manual"

.SH NAME
elf32_xlatetom \- translate ELF32 data to memory representation

.SH SYNOPSIS
.B #include <libelf.h>

.BI "int elf32_xlatetom(Elf_Data *" dst ", const Elf_Data *" src ", unsigned int " encoding ");"

.SH DESCRIPTION
The .B elf32_xlatetom function translates ELF32 data from its file representation to its memory representation. This function is typically used to convert data read from an ELF file into a format suitable for processing in memory.

.SH PARAMETERS
.TP
.I dst
An .I Elf_Data pointer to a structure where the translated data will be stored. The destination structure must be properly initialized.

.TP
.I src
A constant .I Elf_Data pointer to a structure containing the source data in its file representation.

.TP
.I encoding
An .I unsigned int value specifying the encoding of the source data. This parameter can be either .B ELFDATA2LSB (little-endian) or .B ELFDATA2MSB (big-endian).

.SH RETURN VALUE
The .B elf32_xlatetom function returns 0 on success. If an error occurs, it returns -1 and sets an appropriate error code.

.SH ERRORS
If .B elf32_xlatetom fails, it sets the following error codes:

.TP
.B ELFARG
One or more of the parameters are NULL or invalid.

.TP
.B ELFERR
An unspecified internal error occurred.

.SH EXAMPLES
.B "Example 1: Translate ELF32 data from file to memory representation"
.nf
.in +4
#include <libelf.h>

Elf_Data src; // Assume src is properly initialized and contains file representation data
Elf_Data dst;

if (elf32_xlatetom(&dst, &src, ELFDATA2LSB) != 0) {
    // Handle error
} else {
    // Process the translated data in dst
}
.in -4
.fi

.SH SEE ALSO
.BR elf (3),
.BR elf32_xlatetof (3),
.BR elf64_xlatetom (3),
.BR libelf (3)

.SH AUTHORS
Elfutils was written by the Elfutils development team.

.SH COPYRIGHT
Copyright © 2024 Elfutils Development Team.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.