Hi Aaron,

On Wed, 2025-12-31 at 21:50 -0500, Aaron Merey wrote:
> Signed-off-by: Aaron Merey <[email protected]>
> ---
>  doc/Makefile.am   |  1 +
>  doc/gelf_getsym.3 | 79 +++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 80 insertions(+)
>  create mode 100644 doc/gelf_getsym.3
> 
> diff --git a/doc/Makefile.am b/doc/Makefile.am
> index bf98382e..25567984 100644
> --- a/doc/Makefile.am
> +++ b/doc/Makefile.am
> @@ -98,6 +98,7 @@ notrans_dist_man3_MANS= elf32_checksum.3 \
>                       gelf_getphdr.3 \
>                       gelf_getrel.3 \
>                       gelf_getrela.3 \
> +                     gelf_getsym.3 \
>                       gelf_getversym.3 \
>                       gelf_getverdef.3 \
>                       gelf_getverdaux.3 \

OK.

> diff --git a/doc/gelf_getsym.3 b/doc/gelf_getsym.3
> new file mode 100644
> index 00000000..7c1f946c
> --- /dev/null
> +++ b/doc/gelf_getsym.3
> @@ -0,0 +1,79 @@
> +.TH GELF_GETSYM 3 2025-12-29 "Libelf" "Libelf Programmer's Manual"
> +
> +.SH NAME
> +gelf_getsym \- Retrieve class\-independent symbol information from the symbol
> +table at the given index
> +
> +.SH SYNOPSIS
> +.nf
> +.B #include <gelf.h>
> +
> +.BI "GElf_Sym *gelf_getsym (Elf_Data *" data ", int " ndx ", GElf_Sym *" dst 
> ");"
> +
> +.SH DESCRIPTION
> +Translate the symbol table entry at index
> +.I ndx
> +from
> +.I data
> +into a class\-independent representation stored in
> +.IR *dst .
> +
> +.PP
> +.I data
> +must be the
> +.B Elf_Data
> +of a section with type
> +.B SHT_SYMTAB
> +or
> +.BR SHT_DYNSYM .

Probably should mention how to find the size of the table
(sh_size [or d_size] / sh_entsize [or gelf_fsize ELF_T_SYM])

And that you probably should use gelf_getsymshndx instead if you are
interested in the section index of the symbol and Elf contains more
than 65536 (0xfff0?) sections.

> +.SH PARAMETERS
> +.TP
> +.I data
> +Pointer to an
> +.B Elf_Data
> +of a
> +.B SHT_SYMTAB
> +or
> +.B SHT_DYNSYM
> +section.
> +
> +.TP
> +.I ndx
> +Zero\-based index of the symbol table entry within
> +.IR data .
> +
> +.TP
> +.I dst
> +Pointer to a caller\-provided structure for storing the symbol table entry.
> +.I dst
> +must not be NULL.
> +
> +.SH RETURN VALUE
> +On success, this function returns
> +.IR dst .
> +On failure, it returns NULL and sets elf_errno.  If
> +.I data
> +is NULL, then NULL is returned without setting elf_errno.

OK.

> +.SH SEE ALSO
> +.BR gelf_getdyn (3),
> +.BR gelf_update_sym (3),
> +.BR libelf (3),
> +.BR elf (5)

gelf_getsymshndx ?

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

OK.

Thanks,

Mark

Reply via email to