1 .\" Copyright (c) 2006,2008 Joseph Koshy. All rights reserved.
3 .\" Redistribution and use in source and binary forms, with or without
4 .\" modification, are permitted provided that the following conditions
6 .\" 1. Redistributions of source code must retain the above copyright
7 .\" notice, this list of conditions and the following disclaimer.
8 .\" 2. Redistributions in binary form must reproduce the above copyright
9 .\" notice, this list of conditions and the following disclaimer in the
10 .\" documentation and/or other materials provided with the distribution.
12 .\" This software is provided by Joseph Koshy ``as is'' and
13 .\" any express or implied warranties, including, but not limited to, the
14 .\" implied warranties of merchantability and fitness for a particular purpose
15 .\" are disclaimed. in no event shall Joseph Koshy be liable
16 .\" for any direct, indirect, incidental, special, exemplary, or consequential
17 .\" damages (including, but not limited to, procurement of substitute goods
18 .\" or services; loss of use, data, or profits; or business interruption)
19 .\" however caused and on any theory of liability, whether in contract, strict
20 .\" liability, or tort (including negligence or otherwise) arising in any way
21 .\" out of the use of this software, even if advised of the possibility of
33 .Nd translate data between files and memory
39 .Fn elf32_xlatetof "Elf_Data *dst" "Elf_Data *src" "unsigned int encode"
41 .Fn elf32_xlatetom "Elf_Data *dst" "Elf_Data *src" "unsigned int encode"
43 .Fn elf64_xlatetof "Elf_Data *dst" "Elf_Data *src" "unsigned int encode"
45 .Fn elf64_xlatetom "Elf_Data *dst" "Elf_Data *src" "unsigned int encode"
52 .Fa "unsigned int encode"
59 .Fa "unsigned int encode"
62 These functions translate between the file and memory representations
63 of ELF data structures.
64 The in-memory representation of an ELF data structure would confirm to
65 the byte ordering and data alignment restrictions dictated by the host
67 A file representation of the same data structure could use a non-native byte
68 ordering and in addition may be laid out differently with the file.
75 translate data from file representations to native, in-memory representations.
81 translate data from in-memory representations to file representations.
87 descriptor describing the source to be translated.
88 The following elements of the descriptor need to be set before
89 invoking these functions:
90 .Bl -hang -offset indent
92 Set to a valid pointer value denoting the beginning of the data area
95 Set to the total size in bytes of the source data area to be
98 Set to the type of the source data being translated.
99 This value is one of the values defined in the
104 enumeration is described in
107 Set to the version number of the ELF data structures being
109 Currently only version
116 describes the destination buffer.
117 The following elements of the
119 descriptor need to be set before invoking these functions:
120 .Bl -hang -offset indent
122 Set to a valid pointer value that denotes the start of the destination
123 buffer that will hold translated data.
124 This value may be the same as that of the source buffer, in which case
125 an in-place conversion will be attempted.
127 Set to the size of the destination buffer in bytes.
128 This value will be modified if the function call succeeds.
130 Set to the desired version number of the destination.
131 Currently only version
136 These translations routines allow the source and destination buffers
137 to coincide, in which case an in-place translation will be done
138 if the destination is large enough to hold the translated data.
139 Other kinds of overlap between the source and destination buffers
142 On successful completion of the translation request the following
145 descriptor would be modified:
146 .Bl -hang -offset indent
148 Set to the size in bytes of the translated data.
152 value of the source data descriptor.
157 specifies the encoding in which the file objects are represented.
159 .Bl -hang -offset indent
161 File objects use the library's native byte ordering.
163 File objects use a little-endian ordering.
165 File objects use a big-endian ordering.
172 select the appropriate 32 or 64 bit translations based on the class of argument
175 These functions return argument
177 if successful, or NULL in case of an error.
181 These functions may fail with the following errors:
182 .Bl -tag -width "[ELF_E_RESOURCE]"
183 .It Bq Er ELF_E_ARGUMENT
190 .It Bq Er ELF_E_ARGUMENT
196 .It Bq Er ELF_E_ARGUMENT
197 The desired encoding parameter was not one of
202 .It Bq Er ELF_E_ARGUMENT
207 specified an unsupported type.
211 argument specified a buffer size that was not an integral multiple of
216 argument specified a buffer size that was too small.
220 specified a destination buffer that overlaps with the source
223 The destination buffer for a conversion to memory had an alignment
224 inappropriate for the underlying ELF type.
226 The source buffer for a conversion to file had an alignment
227 inappropriate for the underlying ELF type.
228 .It Bq Er ELF_E_UNIMPL
229 The version numbers for arguments
234 .It Bq Er ELF_E_UNIMPL
237 requested conversion for a type which is not currently
239 .It Bq Er ELF_E_VERSION
242 specified an unsupported version number.