Hi Aaron,

On Wed, 2025-12-31 at 21:50 -0500, Aaron Merey wrote:
> Signed-off-by: Aaron Merey <[email protected]>
> ---
>  doc/Makefile.am     |   2 +
>  doc/gelf_xlatetof.3 |   1 +
>  doc/gelf_xlatetom.3 | 151 ++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 154 insertions(+)
>  create mode 100644 doc/gelf_xlatetof.3
>  create mode 100644 doc/gelf_xlatetom.3
> 
> diff --git a/doc/Makefile.am b/doc/Makefile.am
> index 0c69859a..bf98382e 100644
> --- a/doc/Makefile.am
> +++ b/doc/Makefile.am
> @@ -117,6 +117,8 @@ notrans_dist_man3_MANS= elf32_checksum.3 \
>                       gelf_update_verdaux.3 \
>                       gelf_update_verneed.3 \
>                       gelf_update_vernaux.3 \
> +                     gelf_xlatetof.3 \
> +                     gelf_xlatetom.3 \
>                       libelf.3
>  
>  # libdebuginfod man pages (also notrans)

OK.

> diff --git a/doc/gelf_xlatetof.3 b/doc/gelf_xlatetof.3
> new file mode 100644
> index 00000000..3dcb085c
> --- /dev/null
> +++ b/doc/gelf_xlatetof.3
> @@ -0,0 +1 @@
> +.so man3/gelf_xlatetom.3

OK.

> diff --git a/doc/gelf_xlatetom.3 b/doc/gelf_xlatetom.3
> new file mode 100644
> index 00000000..5a977dad
> --- /dev/null
> +++ b/doc/gelf_xlatetom.3
> @@ -0,0 +1,151 @@
> +.TH GELF_XLATETOM 3 2025-12-28 "Libelf" "Libelf Programmer's Manual"
> +
> +.SH NAME
> +gelf_xlatetom \- Translate class-independent ELF data from file 
> representation
> +to memory representation
> +
> +gelf_xlatetof \- Translate class-independent ELF data from memory 
> representation
> +to file representation
> +
> +.SH SYNOPSIS
> +.nf
> +.B #include <gelf.h>
> +
> +.BI "Elf_Data gelf_xlatetom (Elf *" elf ", Elf_Data *" dest ", const 
> Elf_Data *" src ", unsigned int " encode ");"
> +.BI "Elf_Data gelf_xlatetof (Elf *" elf ", Elf_Data *" dest ", const 
> Elf_Data *" src ", unsigned int " encode ");"

OK.

> +.SH 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.
> +.BR gelf_xlatetom ()
> +acts as a wrapper around
> +.BR elf32_xlatetom ()
> +and
> +.BR elf64_xlatetom ().
> +.BR gelf_xlatetof ()
> +acts as a wrapper around
> +.BR elf32_xlatetof ()
> +and
> +.BR elf64_xlatetof ().
> +The binary class (\fBELFCLASS32\fP or \fBELFCLASS64\fP) of
> +.I elf
> +is used to automatically select between the elf32 and elf64 version of each
> +function.
> +
> +Data in file representation normally comes from
> +.B elf_rawdata
> +while data in memory representation normally comes from
> +.BR elf_getdata .
> +When there is no difference between file and memory representations,
> +these functions simply copy the ELF data from
> +.I src
> +to
> +.IR dest .
> +Otherwise the encoding will swap between
> +.B ELFDATA2LSB
> +(two's complement little-endian) and
> +.B ELFDATA2MSB
> +(two's complement big-endian). The encoding of an ELF file is specified
> +in the
> +.B Elf32_Ehdr
> +or
> +.B Elf64_Ehdr e_ident[EI_DATA]
> +member.  To know the memory encoding for a program you can
> +.B #include <endian.h>
> +and check BYTE_ORDER == LITTLE_ENDIAN (corresponding to
> +.BR ELFDATA2LSB )
> +or BYTE_ORDER == BIG_ENDIAN (corresponding to
> +.BR ELFDATA2MSB ).

OK.

> +.SH PARAMETERS
> +.TP
> +.I elf
> +The ELF descriptor that determines the binary class (\fBELFCLASS32\fP or
> +\fBELFCLASS64\fP) used to translate between file and memory representation.
> +
> +.TP
> +.I dest
> +Destination where the translated data will be stored.
> +The
> +.B d_size
> +of
> +.I dest
> +should be at least as big as the
> +.B d_size
> +of
> +.IR src .
> +
> +.TP
> +.I src
> +Source data. For the
> +.B xlatetom
> +functions, the source data should be in file representation.
> +For the
> +.B xlatetof
> +functions, the source data should be in memory representation.
> +
> +.TP
> +.I encode
> +Specifies an encoding.  Can be either
> +.B ELFDATA2LSB
> +(two's complement little-endian) or
> +.B ELFDATA2MSB
> +(two's complement big-endian).  For the
> +.B xlatetom
> +functions, this specifies the encoding of
> +.IR src .
> +For the
> +.B xlatetof
> +functions, this specifies the encoding of
> +.IR dest .

OK.

> +.SH RETURN VALUE
> +On success, return
> +.IR dest ,
> +which will contain the translated data.  If there is no difference
> +between the file and memory representations,
> +.I dest
> +will contain a copy of the source data.  The
> +.B d_type
> +and
> +.B d_size
> +of
> +.I dest
> +will be set to those of
> +.IR src .
> +
> +On failure, return NULL and set elf_errno.  If
> +.IR elf ,
> +.I src
> +or
> +.I dest
> +is NULL, then NULL is returned without setting elf_errno.

OK.

> +.SH SEE ALSO
> +.BR elf32_xlatetof (3),
> +.BR elf32_xlatetom (3),
> +.BR elf64_xlatetof (3),
> +.BR elf64_xlatetom (3),
> +.BR elf_getdata (3),
> +.BR elf_rawdata (3),
> +.BR libelf (3),
> +.BR elf (5)

OK.

> +.SH ATTRIBUTES
> +.TS
> +allbox;
> +lbx lb lb
> +l l l.
> +Interface    Attribute       Value
> +T{
> +.na
> +.nh
> +.BR gelf_xlatetom ()
> +.BR gelf_xlatetof ()
> +T}   Thread safety   MT-Safe
> +.TE
> +
> +.SH REPORTING BUGS
> +Report bugs to <[email protected]> or 
> https://sourceware.org/bugzilla/.

OK. Looks good.

Thanks,

Mark

Reply via email to