Hi Aaron,

This one is slightly confusing since I believe this is an elfutils
extension for supporting prelink library lists, which uses a data
structure that the MIPS linker also used. But both prelink and the MIPS
linker aren't in use anymore as far as I know.

Below I am suggesting to add some references to prelink, but if there
is a good reference to the MIPS linker liblists then maybe that could
also be mentioned?

On Wed, 2025-12-31 at 21:50 -0500, Aaron Merey wrote:
> Signed-off-by: Aaron Merey <[email protected]>
> ---
>  doc/Makefile.am   |  1 +
>  doc/gelf_getlib.3 | 78 +++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 79 insertions(+)
>  create mode 100644 doc/gelf_getlib.3
> 
> diff --git a/doc/Makefile.am b/doc/Makefile.am
> index d648e669..9917d399 100644
> --- a/doc/Makefile.am
> +++ b/doc/Makefile.am
> @@ -96,6 +96,7 @@ notrans_dist_man3_MANS= elf32_checksum.3 \
>                       gelf_getclass.3 \
>                       gelf_getdyn.3 \
>                       gelf_getehdr.3 \
> +                     gelf_getlib.3 \
>                       gelf_getmove.3 \
>                       gelf_getphdr.3 \
>                       gelf_getrel.3 \

OK.

> diff --git a/doc/gelf_getlib.3 b/doc/gelf_getlib.3
> new file mode 100644
> index 00000000..75958663
> --- /dev/null
> +++ b/doc/gelf_getlib.3
> @@ -0,0 +1,78 @@
> +.TH GELF_GETLIB 3 2025-12-31 "Libelf" "Libelf Programmer's Manual"
> +
> +.SH NAME
> +gelf_getlib \- Get library from table at the given index

Get prelink library data from ... ?

> +
> +.SH SYNOPSIS
> +.nf
> +.B #include <gelf.h>
> +
> +.BI "GElf_Lib *gelf_getlib (Elf_Data *" data ", int " ndx ", GElf_Lib *" dst 
> ");"

OK.

> +.SH DESCRIPTION
> +Retrieve a library table entry from

insert ... prelink library ... ?

> +.I data
> +at index
> +.I ndx
> +and store it in the class\-independent representation pointed to by
> +.IR dst .

OK.

> +.PP
> +.I data
> +must be an
> +.B Elf_Data*
> +associated with a section of type
> +.BR SHT_MIPS_LIBLIST .

This is what the comment in elf.h says, but the code only recognizes
SHT_GNU_LIBLIST creating d_type ELF_T_LIB.

> +.SH PARAMETERS
> +.TP
> +.I data
> +Pointer to an
> +.B Elf_Data
> +of a section with type
> +.BR SHT_MIPS_LIBLIST .

Same as above.

> +.TP
> +.I ndx
> +Zero\-based index of the requested library table entry within
> +.IR data .
> +
> +.TP
> +.I dst
> +Pointer to a caller\-provided
> +.B GElf_Lib
> +structure for storing the requested library table entry.
> +
> +.SH RETURN VALUE
> +On success, this function updates
> +.I dst
> +with the requested library table entry and 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.

OK.

> +.SH SEE ALSO
> +.BR gelf_update_lib (3),
> +.BR libelf (3),
> +.BR elf (5)

Nothing seems to describe Elf32_Lib, Elf64_Lib or GElf_Lib.

> +.SH ATTRIBUTES
> +.TS
> +allbox;
> +lbx lb lb
> +l l l.
> +Interface    Attribute       Value
> +T{
> +.na
> +.nh
> +.BR gelf_getlib ()
> +T}   Thread safety   MT-Safe
> +.TE
> +
> +.SH REPORTING BUGS
> +Report bugs to <[email protected]> or 
> https://sourceware.org/bugzilla/.
> +
> +.SH HISTORY
> +.B gelf_getlib
> +first appeared in elfutils 0.95.

Probably should state that this is an elfutils libelf extension which
might not be provided by other libelf implementations.

Thanks,

Mark

Reply via email to