2 .\" Copyright 1989 AT&T Copyright (c) 2001, Sun Microsystems, Inc. All Rights Reserved
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH ELF32_XLATETOF 3ELF "Jul 11, 2001"
8 elf32_xlatetof, elf32_xlatetom, elf64_xlatetof, elf64_xlatetom \-
9 class-dependent data translation
13 cc [ \fIflag\fR ... ] \fIfile\fR... \fB-lelf\fR [ \fIlibrary\fR ... ]
16 \fBElf_Data *\fR\fBelf32_xlatetof\fR(\fBElf_Data *\fR\fIdst\fR, \fBconst Elf_Data *\fR\fIsrc\fR,
17 \fBunsigned\fR \fIencode\fR);
22 \fBElf_Data *\fR\fBelf32_xlatetom\fR(\fBElf_Data *\fR\fIdst\fR, \fBconst Elf_Data *\fR\fIsrc\fR,
23 \fBunsigned\fR \fIencode\fR);
28 \fBElf_Data *\fR\fBelf64_xlatetof\fR(\fBElf_Data *\fR\fIdst\fR, \fBconst Elf_Data *\fR\fIsrc\fR,
29 \fBunsigned\fR \fIencode\fR);
34 \fBElf_Data *\fR\fBelf64_xlatetom\fR(\fBElf_Data *\fR\fIdst\fR, \fBconst Elf_Data *\fR\fIsrc\fR,
35 \fBunsigned\fR \fIencode\fR);
41 \fBelf32_xlatetom()\fR translates various data structures from their 32-bit
42 class file representations to their memory representations;
43 \fBelf32_xlatetof()\fR provides the inverse. This conversion is particularly
44 important for cross development environments. \fIsrc\fR is a pointer to the
45 source buffer that holds the original data; \fIdst\fR is a pointer to a
46 destination buffer that will hold the translated copy. \fIencode\fR gives the
47 byte encoding in which the file objects are to be represented and must have one
48 of the encoding values defined for the \fBELF\fR header's
49 \fBe_ident[EI_DATA]\fR entry (see \fBelf_getident\fR(3ELF)). If the data can be
50 translated, the functions return \fIdst\fR. Otherwise, they return \fINULL\fR
51 because an error occurred, such as incompatible types, destination buffer
55 \fBelf_getdata\fR(3ELF) describes the \fBElf_Data\fR descriptor, which the
56 translation routines use as follows:
63 Both the source and destination must have valid buffer pointers.
72 This member's value specifies the type of the data to which \fBd_buf\fR points
73 and the type of data to be created in the destination. The program supplies a
74 \fBd_type\fR value in the source; the library sets the destination's
75 \fBd_type\fR to the same value. These values are summarized below.
84 This member holds the total size, in bytes, of the memory occupied by the
85 source data and the size allocated for the destination data. If the destination
86 buffer is not large enough, the routines do not change its original contents.
87 The translation routines reset the destination's \fBd_size\fR member to the
88 actual size required, after the translation occurs. The source and destination
98 This member holds the version number of the objects (desired) in the buffer.
99 The source and destination versions are independent.
104 Translation routines allow the source and destination buffers to coincide. That
105 is, \fBdst\(->d_buf\fR may equal \fBsrc\(->d_buf\fR. Other cases where the
106 source and destination buffers overlap give undefined behavior.
110 \fBElf_Type 32-Bit Memory Type
111 ELF_T_ADDR Elf32_Addr
112 ELF_T_BYTE unsigned char
114 ELF_T_EHDR Elf32_Ehdr
115 ELF_T_HALF Elf32_Half
117 ELF_T_PHDR Elf32_Phdr
119 ELF_T_RELA Elf32_Rela
120 ELF_T_SHDR Elf32_Shdr
121 ELF_T_SWORD Elf32_Sword
123 ELF_T_WORD Elf32_Word\fR
129 Translating buffers of type \fBELF_T_BYTE\fR does not change the byte order.
132 For the 64\(mibit class, replace 32 with 64 as appropriate.
136 See \fBattributes\fR(5) for descriptions of the following attributes:
144 ATTRIBUTE TYPE ATTRIBUTE VALUE
146 Interface Stability Stable
154 \fBelf\fR(3ELF), \fBelf32_fsize\fR(3ELF), \fBelf_getdata\fR(3ELF),
155 \fBelf_getident\fR(3ELF), \fBlibelf\fR(3LIB), \fBattributes\fR(5)