Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ elf32_xlatetof(3E) — IRIX 6.5.3f

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

elf(3E)



ELFXLATE(3E)                                                    ELFXLATE(3E)



NAME
     elfxlate: elf32xlatetof, elf32xlatetom,elf64xlatetof, elf64xlatetom
     - class-dependent data translation

SYNOPSIS
     cc [flag ...] file ...  -lelf [library ...]

     #include <libelf.h>

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(3E)]. If the data can be translated, the functions return dst. Otherwise, they return null because an error occurred, such as incompatible types, destination buffer overflow, etc. elfgetdata(3E) 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 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. Page 1


ELFXLATE(3E)                                                    ELFXLATE(3E)



     dversion     This member holds 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

________________________________
|
ELFTADDR Elf32Addr
|
ELFTBYTE unsigned char
|
ELFTDYN Elf32Dyn
|
ELFTEHDR Elf32Ehdr
|
ELFTHALF Elf32Half
|
ELTTOFF 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. The 64-bit class works identically, simply replacing all instances of 32 in the description and table with 64. SEE ALSO elf(3E), elffsize(3E), elfgetdata(3E), elfgetident(3E). CAVEAT By default, the Elf_Data used for the 64-bit class in a 32-bit application restricts one to building 64-bit class applications with only 32-bit fields unless the entire application is compiled with _LIBELF_XTND_64 defined (see elf.3e). Page 2

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026