[PATCH 15/16] doc: Add elf_scnshndx.3

Mark Wielaard mark@klomp.org
Thu Jul 10 13:36:34 GMT 2025


Hi Aaron,

On Mon, 2025-06-30 at 23:12 -0400, Aaron Merey wrote:
> Signed-off-by: Aaron Merey <amerey@redhat.com>
> ---
>  doc/Makefile.am    |  1 +
>  doc/elf_scnshndx.3 | 68 ++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 69 insertions(+)
>  create mode 100644 doc/elf_scnshndx.3
> 
> diff --git a/doc/Makefile.am b/doc/Makefile.am
> index 50ab63ec..dc4a8b18 100644
> --- a/doc/Makefile.am
> +++ b/doc/Makefile.am
> @@ -85,6 +85,7 @@ notrans_dist_man3_MANS= elf32_checksum.3 \
>  			elf_rand.3 \
>  			elf_rawdata.3 \
>  			elf_rawfile.3 \
> +			elf_scnshndx.3 \
>  			elf_update.3 \
>  			elf_version.3 \
>  			libelf.3
> diff --git a/doc/elf_scnshndx.3 b/doc/elf_scnshndx.3
> new file mode 100644
> index 00000000..8344df89
> --- /dev/null
> +++ b/doc/elf_scnshndx.3
> @@ -0,0 +1,68 @@
> +.TH ELF_SCNSHNDX 3 2025-06-30 "Libelf" "Libelf Programmer's Manual"
> +
> +.SH NAME
> +elf_scnshndx \- Find the index of the SHT_SYMTAB_SHNDX section associated with a symbol table

Maybe say extended symbol table, or use associated with a SHT_SYMTAB
section?

> +.SH SYNOPSIS
> +.nf
> +#include <libelf.h>
> +
> +.BI "int elf_scnshndx(Elf_Scn *" scn ");"
> +.fi

OK.

> +.SH DESCRIPTION
> +The
> +.BR elf_scnshndx ()
> +function searches for the
> +.BR SHT_SYMTAB_SHNDX
> +section associated with a given symbol table section. It returns the section
> +index of the corresponding
> +.BR SHT_SYMTAB_SHNDX
> +section, or zero if none is found.

OK.

> +
> +This function is used for retrieving extended section indices in ELF files
> +with many sections, where standard symbol table entries cannot store all
> +possible section references directly.

OK.

> +The function only returns a valid result if
> +.IR scn
> +refers to a section of type
> +.BR SHT_SYMTAB .
> +Otherwise, the function returns 0.

Returns -1 on error?

> +.SH PARAMETERS
> +.TP
> +.I scn
> +An
> +.B Elf_Scn
> +pointer referencing a symbol table section.

OK.

> +.SH RETURN VALUE
> +Returns the section index of the
> +.BR SHT_SYMTAB_SHNDX
> +section if found. If no such section is found, returns 0. On error, returns \-1.

OK.

> +.SH SEE ALSO
> +.BR libelf (3),
> +.BR elf (5)
> +
> +.SH ATTRIBUTES
> +.TS
> +allbox;
> +lbx lb lb
> +l l l.
> +Interface	Attribute	Value
> +T{
> +.na
> +.nh
> +.BR elf_scnshndx ()
> +T}	Thread safety	MT-Safe
> +.TE
> +
> +.SH REPORTING BUGS
> +Report bugs to <elfutils-devel@sourceware.org> or https://sourceware.org/bugzilla/.
> +
> +.SH HISTORY
> +.B elf_scnshndx
> +first appeared in elfutils 0.132.  This function is a elfutils libelf extension and
> +may not be available in other libelf implementations.

OK.

Thanks,

Mark


More information about the Elfutils-devel mailing list