]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
doc: Add gelf_getsym.3
authorAaron Merey <amerey@redhat.com>
Thu, 1 Jan 2026 02:50:30 +0000 (21:50 -0500)
committerAaron Merey <amerey@redhat.com>
Fri, 13 Mar 2026 16:18:59 +0000 (12:18 -0400)
Signed-off-by: Aaron Merey <amerey@redhat.com>
doc/Makefile.am
doc/gelf_getsym.3 [new file with mode: 0644]

index bf98382e7667a9b718bca51bb13acc7329be7920..255679846dd4843e8f0f79d98f23825d91881327 100644 (file)
@@ -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 \
diff --git a/doc/gelf_getsym.3 b/doc/gelf_getsym.3
new file mode 100644 (file)
index 0000000..1aee223
--- /dev/null
@@ -0,0 +1,94 @@
+.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 .
+
+The number of symbols in the symbol table can be calculated by dividing the
+size of the corresponding section (\fBsh_size\fP or \fBd_size\fP)
+by the size of a symbol table entry.  The size of a symbol table entry can be
+obtained from
+.B sh_entsize
+or
+.BR gelf_fsize (3).
+
+If the corresponding elf contains more than 64K sections then
+.BR gelf_getsymshndx
+should be used to retrieve a symbol's section index.  See
+.BR gelf_getsymshndx (3)
+for more information.
+
+.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.
+
+.SH SEE ALSO
+.BR gelf_getdyn (3),
+.BR gelf_getsymshndx (3),
+.BR gelf_update_sym (3),
+.BR libelf (3),
+.BR elf (5)
+
+.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 <elfutils-devel@sourceware.org> or https://sourceware.org/bugzilla/.