Merge commit 'dc97a43d4a70c8773a619f11b95b07a787f6f5b7' into merges
[unleashed.git] / share / man / man3elf / elf32_xlatetof.3elf
blob7e113bddc89e5b6acbd02dbb46814186a9326b34
1 '\" te
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"
7 .SH NAME
8 elf32_xlatetof, elf32_xlatetom, elf64_xlatetof, elf64_xlatetom \-
9 class-dependent data translation
10 .SH SYNOPSIS
11 .LP
12 .nf
13 cc [ \fIflag\fR ... ] \fIfile\fR... \fB-lelf\fR [ \fIlibrary\fR ... ]
14 #include <libelf.h>
16 \fBElf_Data *\fR\fBelf32_xlatetof\fR(\fBElf_Data *\fR\fIdst\fR, \fBconst Elf_Data *\fR\fIsrc\fR,
17      \fBunsigned\fR \fIencode\fR);
18 .fi
20 .LP
21 .nf
22 \fBElf_Data *\fR\fBelf32_xlatetom\fR(\fBElf_Data *\fR\fIdst\fR, \fBconst Elf_Data *\fR\fIsrc\fR,
23      \fBunsigned\fR \fIencode\fR);
24 .fi
26 .LP
27 .nf
28 \fBElf_Data *\fR\fBelf64_xlatetof\fR(\fBElf_Data *\fR\fIdst\fR, \fBconst Elf_Data *\fR\fIsrc\fR,
29      \fBunsigned\fR \fIencode\fR);
30 .fi
32 .LP
33 .nf
34 \fBElf_Data *\fR\fBelf64_xlatetom\fR(\fBElf_Data *\fR\fIdst\fR, \fBconst Elf_Data *\fR\fIsrc\fR,
35      \fBunsigned\fR \fIencode\fR);
36 .fi
38 .SH DESCRIPTION
39 .sp
40 .LP
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
52 overflow, etc.
53 .sp
54 .LP
55 \fBelf_getdata\fR(3ELF) describes the \fBElf_Data\fR descriptor, which the
56 translation routines use as follows:
57 .sp
58 .ne 2
59 .na
60 \fB\fBd_buf\fR\fR
61 .ad
62 .RS 13n
63 Both the source and destination must have valid buffer pointers.
64 .RE
66 .sp
67 .ne 2
68 .na
69 \fB\fBd_type\fR\fR
70 .ad
71 .RS 13n
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.
76 .RE
78 .sp
79 .ne 2
80 .na
81 \fB\fBd_size\fR\fR
82 .ad
83 .RS 13n
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
89 sizes may differ.
90 .RE
92 .sp
93 .ne 2
94 .na
95 \fB\fBd_version\fR\fR
96 .ad
97 .RS 13n
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.
108 .in +2
110 \fBElf_Type     32-Bit Memory Type
111 ELF_T_ADDR      Elf32_Addr
112 ELF_T_BYTE      unsigned char
113 ELF_T_DYN       Elf32_Dyn
114 ELF_T_EHDR      Elf32_Ehdr
115 ELF_T_HALF      Elf32_Half
116 ELT_T_OFF       Elf32_Off
117 ELF_T_PHDR      Elf32_Phdr
118 ELF_T_REL       Elf32_Rel
119 ELF_T_RELA      Elf32_Rela
120 ELF_T_SHDR      Elf32_Shdr
121 ELF_T_SWORD     Elf32_Sword
122 ELF_T_SYM       Elf32_Sym
123 ELF_T_WORD      Elf32_Word\fR
125 .in -2
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.
133 .SH ATTRIBUTES
136 See \fBattributes\fR(5) for descriptions of the following attributes:
141 box;
142 c | c
143 l | l .
144 ATTRIBUTE TYPE  ATTRIBUTE VALUE
146 Interface Stability     Stable
148 MT-Level        MT-Safe
151 .SH SEE ALSO
154 \fBelf\fR(3ELF), \fBelf32_fsize\fR(3ELF), \fBelf_getdata\fR(3ELF),
155 \fBelf_getident\fR(3ELF), \fBlibelf\fR(3LIB), \fBattributes\fR(5)