]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
doc: Add elf_scnshndx.3
authorAaron Merey <amerey@redhat.com>
Thu, 17 Jul 2025 21:01:08 +0000 (17:01 -0400)
committerAaron Merey <amerey@redhat.com>
Thu, 17 Jul 2025 21:01:08 +0000 (17:01 -0400)
Signed-off-by: Aaron Merey <amerey@redhat.com>
doc/Makefile.am
doc/elf_scnshndx.3 [new file with mode: 0644]

index 661df2c5c23c7baa818beef2cacb08f2100c2dbc..4e9bab50e10e4db6b05a7188eba2cfb815f0cf8b 100644 (file)
@@ -64,6 +64,7 @@ notrans_dist_man3_MANS= elf32_checksum.3 \
                        elf_ndxscn.3 \
                        elf_nextscn.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 (file)
index 0000000..8344df8
--- /dev/null
@@ -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.