1elf32_xlatetof(3ELF)         ELF Library Functions        elf32_xlatetof(3ELF)
2
3
4

NAME

6       elf32_xlatetof, elf32_xlatetom, elf64_xlatetof, elf64_xlatetom - class-
7       dependent data translation
8

SYNOPSIS

10       cc [ flag ... ] file... -lelf [ library ... ]
11       #include <libelf.h>
12
13       Elf_Data *elf32_xlatetof(Elf_Data *dst, const Elf_Data *src,
14            unsigned encode);
15
16
17       Elf_Data *elf32_xlatetom(Elf_Data *dst, const Elf_Data *src,
18            unsigned encode);
19
20
21       Elf_Data *elf64_xlatetof(Elf_Data *dst, const Elf_Data *src,
22            unsigned encode);
23
24
25       Elf_Data *elf64_xlatetom(Elf_Data *dst, const Elf_Data *src,
26            unsigned encode);
27
28

DESCRIPTION

30       elf32_xlatetom() translates various data structures from  their  32-bit
31       class   file   representations   to   their   memory   representations;
32       elf32_xlatetof() provides the inverse. This conversion is  particularly
33       important  for  cross development environments. src is a pointer to the
34       source buffer that holds the original data; dst is a pointer to a  des‐
35       tination  buffer  that  will hold the translated copy. encode gives the
36       byte encoding in which the file objects are to be represented and  must
37       have   one  of  the  encoding  values  defined  for  the  ELF  header's
38       e_ident[EI_DATA] entry (see elf_getident(3ELF)). If  the  data  can  be
39       translated,  the  functions  return  dst.  Otherwise,  they return NULL
40       because an error occurred, such as incompatible types, destination buf‐
41       fer overflow, etc.
42
43
44       elf_getdata(3ELF) describes the Elf_Data descriptor, which the transla‐
45       tion routines use as follows:
46
47       d_buf        Both the source and destination  must  have  valid  buffer
48                    pointers.
49
50
51       d_type       This  member's  value  specifies  the  type of the data to
52                    which d_buf points and the type of data to be  created  in
53                    the  destination.  The  program supplies a d_type value in
54                    the source; the library sets the destination's  d_type  to
55                    the same value. These values are summarized below.
56
57
58       d_size       This  member holds the total size, in bytes, of the memory
59                    occupied by the source data and the size allocated for the
60                    destination  data.  If the destination buffer is not large
61                    enough, the routines do not change its original  contents.
62                    The  translation  routines  reset the destination's d_size
63                    member to the actual size required, after the  translation
64                    occurs. The source and destination sizes may differ.
65
66
67       d_version    This  member  holds  the  version  number  of  the objects
68                    (desired) in the buffer. The source and  destination  ver‐
69                    sions are independent.
70
71
72
73       Translation  routines allow the source and destination buffers to coin‐
74       cide. That is, dst→d_buf may equal src→d_buf.  Other  cases  where  the
75       source and destination buffers overlap give undefined behavior.
76
77         Elf_Type       32-Bit Memory Type
78         ELF_T_ADDR     Elf32_Addr
79         ELF_T_BYTE     unsigned char
80         ELF_T_DYN Elf32_Dyn
81         ELF_T_EHDR     Elf32_Ehdr
82         ELF_T_HALF     Elf32_Half
83         ELT_T_OFF Elf32_Off
84         ELF_T_PHDR     Elf32_Phdr
85         ELF_T_REL Elf32_Rel
86         ELF_T_RELA     Elf32_Rela
87         ELF_T_SHDR     Elf32_Shdr
88         ELF_T_SWORD    Elf32_Sword
89         ELF_T_SYM Elf32_Sym
90         ELF_T_WORD     Elf32_Word
91
92
93
94       Translating buffers of type ELF_T_BYTE does not change the byte order.
95
96
97       For the 64−bit class, replace 32 with 64 as appropriate.
98

ATTRIBUTES

100       See attributes(5) for descriptions of the following attributes:
101
102
103
104
105       ┌─────────────────────────────┬─────────────────────────────┐
106       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
107       ├─────────────────────────────┼─────────────────────────────┤
108       │Interface Stability          │Stable                       │
109       ├─────────────────────────────┼─────────────────────────────┤
110       │MT-Level                     │MT-Safe                      │
111       └─────────────────────────────┴─────────────────────────────┘
112

SEE ALSO

114       elf(3ELF),  elf32_fsize(3ELF),  elf_getdata(3ELF),  elf_getident(3ELF),
115       libelf(3LIB), attributes(5)
116
117
118
119SunOS 5.11                        11 Jul 2001             elf32_xlatetof(3ELF)
Impressum