Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ elf_xlate(3E) — DG/UX R4.11MU05

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

elf(3E)



elf_xlate(3E)                  DG/UX R4.11MU05                 elf_xlate(3E)


NAME
       elfxlate: elf32xlatetof, elf32xlatetom - 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);

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.

       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.

SEE ALSO
       elf(3E), elffsize(3E), elfgetdata(3E), elfgetident(3E).


Licensed material--property of copyright holder(s)

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