ELF Library Functions elf32xlatetof(3ELF)
NAME
elf32xlatetof, elf32xlatetom, elf64xlatetof,
elf64xlatetom - class-dependent data translation
SYNOPSIS
cc [ flag ... ] file... -lelf [ library ... ]
#include
ElfData *elf32xlatetof(ElfData *dst, const ElfData *src,
unsigned encode);
ElfData *elf32xlatetom(ElfData *dst, const ElfData *src,
unsigned encode);
ElfData *elf64xlatetof(ElfData *dst, const ElfData *src,
unsigned encode);
ElfData *elf64xlatetom(ElfData *dst, const ElfData *src,
unsigned encode);
DESCRIPTION
elf32xlatetom() translates various data structures from
their 32-bit class file representations to their memory
representations; elf32xlatetof() provides the inverse. This
conversion is particularly important for cross development
environments. src is a pointer to the source buffer that
holds the original data; dst is a pointer to a destination
buffer that will hold the translated copy. encode gives the
byte encoding in which the file objects are to be
represented and must have one of the encoding values defined
for the ELF header's eident[EIDATA] entry (see
elfgetident(3ELF)). If the data can be translated, the
functions return dst. Otherwise, they return NUL because an
error occurred, such as incompatible types, destination
buffer overflow, etc.
elfgetdata(3ELF) describes the ElfData descriptor, which
the translation routines use as follows:
dbuf Both the source and destination must have valid
buffer pointers.
dtype This member's value specifies the type of the
data to which dbuf points and the type of data
to be created in the destination. The program
supplies a dtype value in the source; the
SunOS 5.11 Last change: 11 Jul 2001 1
ELF Library Functions elf32xlatetof(3ELF)
library sets the destination's dtype to the
same value. These values are summarized below.
dsize This member holds the total size, in bytes, of
the memory occupied by the source data and the
size allocated for the destination data. If the
destination buffer is not large enough, the
routines do not change its original contents.
The translation routines reset the
destination's dsize member to the actual size
required, after the translation occurs. The
source and destination sizes may differ.
dversion This member holds the version number of the
objects (desired) in the buffer. The source and
destination versions are independent.
Translation routines allow the source and destination
buffers to coincide. That is, dst->dbuf may equal
src->dbuf. Other cases where the source and destination
buffers overlap give undefined behavior.
ElfType 32-Bit Memory Type
ELFTADR Elf32Addr
ELFTBYTE unsigned char
ELFTDYN Elf32Dyn
ELFTEHDR Elf32Ehdr
ELFTHALF Elf32Half
ELTOF Elf32Off
ELFTPHDR Elf32Phdr
ELFTREL Elf32Rel
ELFTRELA Elf32Rela
ELFTSHDR Elf32Shdr
ELFTSWORD Elf32Sword
ELFTSYM Elf32Sym
ELFTWORD Elf32Word
Translating buffers of type ELFTBYTE does not change the
byte order.
For the 64-bit class, replace 32 with 64 as appropriate.
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
SunOS 5.11 Last change: 11 Jul 2001 2
ELF Library Functions elf32xlatetof(3ELF)
ATRIBUTE TYPE ATRIBUTE VALUE
Interface Stability Stable
MT-Level MT-Safe
SEE ALSO
elf(3ELF), elf32fsize(3ELF), elfgetdata(3ELF),
elfgetident(3ELF), libelf(3LIB), attributes(5)
SunOS 5.11 Last change: 11 Jul 2001 3
|