Signed-off-by: Aaron Merey <ame...@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
+
+.SH SYNOPSIS
+.nf
+#include <libelf.h>
+
+.BI "int elf_scnshndx(Elf_Scn *" scn ");"
+.fi
+
+.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.
+
+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.
+
+The function only returns a valid result if
+.IR scn
+refers to a section of type
+.BR SHT_SYMTAB .
+Otherwise, the function returns 0.
+
+.SH PARAMETERS
+.TP
+.I scn
+An
+.B Elf_Scn
+pointer referencing a symbol table section.
+
+.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.
+
+.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.
-- 
2.49.0

Reply via email to