Hi Aaron,
On Mon, 2025-09-29 at 19:32 +0000, Aaron Merey wrote:
> Add man pages for gelf_update_versym, gelf_update_verdef,
> gelf_update_verdaux, gelf_update_verneed and gelf_update_vernaux.
>
> Signed-off-by: Aaron Merey <[email protected]>
> ---
> doc/Makefile.am | 5 ++
> doc/gelf_update_verdaux.3 | 1 +
> doc/gelf_update_verdef.3 | 1 +
> doc/gelf_update_vernaux.3 | 1 +
> doc/gelf_update_verneed.3 | 1 +
> doc/gelf_update_versym.3 | 145 ++++++++++++++++++++++++++++++++++++++
> 6 files changed, 154 insertions(+)
> create mode 100644 doc/gelf_update_verdaux.3
> create mode 100644 doc/gelf_update_verdef.3
> create mode 100644 doc/gelf_update_vernaux.3
> create mode 100644 doc/gelf_update_verneed.3
> create mode 100644 doc/gelf_update_versym.3
>
> diff --git a/doc/Makefile.am b/doc/Makefile.am
> index a2ada1b1..b6edb4ae 100644
> --- a/doc/Makefile.am
> +++ b/doc/Makefile.am
> @@ -108,6 +108,11 @@ notrans_dist_man3_MANS= elf32_checksum.3 \
> gelf_update_shdr.3 \
> gelf_update_rel.3 \
> gelf_update_rela.3 \
> + gelf_update_versym.3 \
> + gelf_update_verdef.3 \
> + gelf_update_verdaux.3 \
> + gelf_update_verneed.3 \
> + gelf_update_vernaux.3 \
> libelf.3
>
> # libdebuginfod man pages (also notrans)
OK.
> diff --git a/doc/gelf_update_verdaux.3 b/doc/gelf_update_verdaux.3
> new file mode 100644
> index 00000000..74185e59
> --- /dev/null
> +++ b/doc/gelf_update_verdaux.3
> @@ -0,0 +1 @@
> +.so man3/gelf_update_versym.3
> diff --git a/doc/gelf_update_verdef.3 b/doc/gelf_update_verdef.3
> new file mode 100644
> index 00000000..74185e59
> --- /dev/null
> +++ b/doc/gelf_update_verdef.3
> @@ -0,0 +1 @@
> +.so man3/gelf_update_versym.3
> diff --git a/doc/gelf_update_vernaux.3 b/doc/gelf_update_vernaux.3
> new file mode 100644
> index 00000000..74185e59
> --- /dev/null
> +++ b/doc/gelf_update_vernaux.3
> @@ -0,0 +1 @@
> +.so man3/gelf_update_versym.3
> diff --git a/doc/gelf_update_verneed.3 b/doc/gelf_update_verneed.3
> new file mode 100644
> index 00000000..74185e59
> --- /dev/null
> +++ b/doc/gelf_update_verneed.3
> @@ -0,0 +1 @@
> +.so man3/gelf_update_versym.3
OK.
> diff --git a/doc/gelf_update_versym.3 b/doc/gelf_update_versym.3
> new file mode 100644
> index 00000000..30d51ad1
> --- /dev/null
> +++ b/doc/gelf_update_versym.3
> @@ -0,0 +1,145 @@
> +.TH GELF_UPDATE_VERSYM 3 2025-09-27 "Libelf" "Libelf Programmer's Manual"
> +
> +.SH NAME
> +gelf_update_versym, gelf_update_verdef, gelf_update_verdaux,
> gelf_update_verneed, gelf_update_vernaux \- modify class\-independent symbol
> versioning records
> +
> +.SH SYNOPSIS
> +.nf
> +.B #include <gelf.h>
> +
> +.BI "int gelf_update_versym (Elf_Data *" data ", int " ndx ", GElf_Versym
> *" src ");"
> +.BI "int gelf_update_verdef (Elf_Data *" data ", off_t " offset ",
> GElf_Verdef *" src ");"
> +.BI "int gelf_update_verdaux(Elf_Data *" data ", off_t " offset ",
> GElf_Verdaux *" src ");"
> +.BI "int gelf_update_verneed(Elf_Data *" data ", off_t " offset ",
> GElf_Verneed *" src ");"
> +.BI "int gelf_update_vernaux(Elf_Data *" data ", off_t " offset ",
> GElf_Vernaux *" src ");"
> +.fi
Same as for the getter functions, where do the off_t offsets come from?
>
> +.SH DESCRIPTION
> +These functions provide class\-independent modification of GNU ELF
> +symbol versioning sections. Each function copies the contents of the
> +caller\-supplied
> +.I src
> +into the symbol versioning entry at the specified index or offset within
> +.IR data .
> +
> +.TP
> +.BR gelf_update_versym ()
> +Write a symbol version index into the
> +.B SHT_GNU_versym
> +section associated with
> +.I data
> +at index
> +.IR ndx .
> +
> +.TP
> +.BR gelf_update_verdef ()
> +Write a version definition entry into the
> +.B SHT_GNU_verdef
> +section associated with
> +.I data
> +at section offset
> +.IR offset .
> +
> +.TP
> +.BR gelf_update_verdaux ()
> +Write a version definition auxiliary entry into the
> +.B SHT_GNU_verdef
> +section associated with
> +.I data
> +at section offset
> +.IR offset .
> +
> +.TP
> +.BR gelf_update_verneed ()
> +Write a version needed entry into the
> +.B SHT_GNU_verneed
> +section associated with
> +.I data
> +at section offset
> +.IR offset .
> +
> +.TP
> +.BR gelf_update_vernaux ()
> +Write a version needed auxiliary entry into the
> +.B SHT_GNU_verneed
> +section associated with
> +.I data
> +at section offset
> +.IR offset .
OK, but like other gelf_update mention that the data section will be
marked dirty so it gets written out on elf_update. (We are lucky here
that the 32 and 64 bit variants are of equal size).
> +.SH PARAMETERS
> +.TP
> +.I data
> +.B Elf_Data
> +pointer corresponding to the appropriate GNU symbol versioning section.
> +
> +.TP
> +.I ndx
> +(For
> +.BR gelf_update_versym ()
> +only.)
hmmm?
> +Zero\-based index of the entry within
> +.IR data .
> +
> +.TP
> +.I offset
> +(For
> +.BR gelf_update_verdef (),
> +.BR gelf_update_verdaux (),
> +.BR gelf_update_verneed (),
> +and
> +.BR gelf_update_vernaux ().)
> +Section\-relative byte offset of the entry within
> +.IR data .
> +
> +.TP
> +.I src
> +Pointer to the caller\-supplied symbol:
> +.BR GElf_Versym ,
> +.BR GElf_Verdef ,
> +.BR GElf_Verdaux ,
> +.BR GElf_Verneed ,
> +or
> +.BR GElf_Vernaux
> +as appropriate.
> +This argument must not be NULL.
> +
> +.SH RETURN VALUE
> +On success, these functions store the requested entry in
> +.I src
> +and return 1. On failure, 0 is returned and elf_errno is set. If
> +.I data
> +is NULL, 0 is returned without setting elf_errno.
I think we should just mention that a zero return is failure and don't
promise 1 is success (even though it is in this implementation).
> +.SH SEE ALSO
> +.BR gelf_getverdaux (3),
> +.BR gelf_getverdef (3),
> +.BR gelf_getvernaux (3),
> +.BR gelf_getverneed (3),
> +.BR gelf_getversym (3),
> +.BR libelf (3),
> +.BR elf (5)
Where are the GElf_ datatypes described?
> +.SH ATTRIBUTES
> +.TS
> +allbox;
> +lbx lb lb
> +l l l.
> +Interface Attribute Value
> +T{
> +.na
> +.nh
> +.BR gelf_update_versym (),
> +.br
> +.BR gelf_update_verdef (),
> +.br
> +.BR gelf_update_verdaux (),
> +.br
> +.BR gelf_update_verneed (),
> +.br
> +.BR gelf_update_vernaux ()
> +T} Thread safety MT-Safe
> +.TE
> +
> +.SH REPORTING BUGS
> +Report bugs to <[email protected]> or
> https://sourceware.org/bugzilla/.
OK.
Thanks,
Mark