plucky (3) elf32_xlatetof.3.gz

Provided by: libelf-dev_0.192-4_amd64 bug

NAME

       elf32_xlatetom, elf64_xlatetom - translate 32-bit or 64-bit ELF data from file
       representation to memory representation

       elf32_xlatetof, elf64_xlatetof - translate 32-bit or 64-bit ELF data from memory
       representation to file representation

SYNOPSIS

       #include <libelf.h>

       int elf32_xlatetom(Elf_Data *dst, const Elf_Data *src, unsigned int encoding);
       int elf64_xlatetom(Elf_Data *dst, const Elf_Data *src, unsigned int encoding);

       int elf32_xlatetof(Elf_Data *dst, const Elf_Data *src, unsigned int encoding);
       int elf64_xlatetof(Elf_Data *dst, const Elf_Data *src, unsigned int encoding);

DESCRIPTION

       Translate  ELF  data  from  file  representation to memory representation or vice versa.  File and memory
       representations of ELF data can differ in terms of endianness.   Data  in  file  representation  normally
       comes  from  elf_rawdata while data in memory representation normally comes from elf_getdata.  When there
       is no difference between file and memory representations, these functions simply copy the ELF  data  from
       src  to  dst.   Otherwise the encoding will swap between ELFDATA2LSB (two's complement little-endian) and
       ELFDATA2MSB (two's complement big-endian). The encoding of an ELF file is specified in the Elf32_Ehdr  or
       Elf64_Ehdr  e_ident[EI_DATA]  member.   To  know  the  memory  encoding  for  a  program you can #include
       <endian.h> and check  BYTE_ORDER  ==  LITTLE_ENDIAN  (corresponding  to  ELFDATA2LSB)  or  BYTE_ORDER  ==
       BIG_ENDIAN (corresponding to ELFDATA2MSB).

PARAMETERS

       dst    Destination where the translated data will be stored.  The d_size of dst should be at least as big
              as the d_size of src.

       src    Source data. For the xlatetom functions, the source data should be in  file  representation.   For
              the xlatetof functions, the source data should be in memory representation.

       encoding
              Specifies  an encoding.  Can be either ELFDATA2LSB (two's complement little-endian) or ELFDATA2MSB
              (two's complement big-endian).  For the xlatetom functions, this specifies the  encoding  of  src.
              For the xlatetof functions, this specifies the encoding of dst.

RETURN VALUE

       On  success,  return  dst, which will contain the translated data.  If there is no difference between the
       file and memory representations, dst will contain a copy of the source data.  The d_type  and  d_size  of
       dst will be set to those of src.

        If an error occurs, return NULL and set a libelf error code.

SEE ALSO

       elf_errno(3), elf_getdata(3), elf_rawdata(3), libelf(3), elf(5)

ATTRIBUTES

       For an explanation of the terms used in this section, see attributes(7).

       ┌──────────────────────────────────────────────────────────────────────────────┬───────────────┬─────────┐
       │InterfaceAttributeValue   │
       ├──────────────────────────────────────────────────────────────────────────────┼───────────────┼─────────┤
       │elf32_xlatetom(), elf64_xlatetom(), elf32_xlatetof(), elf64_xlatetof()        │ Thread safety │ MT-Safe │
       └──────────────────────────────────────────────────────────────────────────────┴───────────────┴─────────┘

REPORTING BUGS

       Report bugs to <elfutils-devel@sourceware.org> or https://sourceware.org/bugzilla/.