Hi Aaron,

On Mon, 2025-09-29 at 19:32 +0000, Aaron Merey wrote:
> Signed-off-by: Aaron Merey <[email protected]>
> ---
>  doc/Makefile.am        |  2 +
>  doc/gelf_update_rel.3  | 91 ++++++++++++++++++++++++++++++++++++++++++
>  doc/gelf_update_rela.3 |  1 +
>  3 files changed, 94 insertions(+)
>  create mode 100644 doc/gelf_update_rel.3
>  create mode 100644 doc/gelf_update_rela.3
> 
> diff --git a/doc/Makefile.am b/doc/Makefile.am
> index aee5f2f1..153c05ba 100644
> --- a/doc/Makefile.am
> +++ b/doc/Makefile.am
> @@ -101,6 +101,8 @@ notrans_dist_man3_MANS= elf32_checksum.3 \
>                       gelf_offscn.3 \
>                       gelf_update_ehdr.3 \
>                       gelf_update_shdr.3 \
> +                     gelf_update_rel.3 \
> +                     gelf_update_rela.3 \
>                       libelf.3
> 

OK.

>  
>  # libdebuginfod man pages (also notrans)
> diff --git a/doc/gelf_update_rel.3 b/doc/gelf_update_rel.3
> new file mode 100644
> index 00000000..767b07ad
> --- /dev/null
> +++ b/doc/gelf_update_rel.3
> @@ -0,0 +1,91 @@
> +.TH GELF_UPDATE_REL 3 2025-09-27 "Libelf" "Libelf Programmer's Manual"
> +
> +.SH NAME
> +gelf_update_rel, gelf_update_rela \- copy class\-independent relocation 
> entries into a relocation section
> +
> +.SH SYNOPSIS
> +.nf
> +.B #include <gelf.h>
> +
> +.BI "int gelf_update_rel (Elf_Data *" data ", int " ndx ", GElf_Rel  *" src 
> ");"
> +.BI "int gelf_update_rela(Elf_Data *" data ", int " ndx ", GElf_Rela *" src 
> ");"
> +.fi

OK.

> +.SH DESCRIPTION
> +The
> +.BR gelf_update_rel ()
> +and
> +.BR gelf_update_rela ()
> +functions copy a class\-independent REL or RELA relocation entry from
> +.IR *src
> +into the SHT_REL or SHT_RELA section associated with
> +.I data
> +at entry index
> +.IR ndx .

It should probably mention that in the ELFCLASS32 case r_offset needs
to fit in (unsigned) 32bits, that r_addend in (signed) 32bits, and that
r_info can also only hold a 32bit value with GELF_R_SYM having to fit
in 24 bits and GELF_R_TYPE in just 8 bits. Also this will mark the
section with ELF_F_DIRTY so it gets written out on an elf_update.

> +.SH PARAMETERS
> +.TP
> +.I data
> +.B Elf_Data
> +for a relocation section.  The section must have sh_type
> +.B SHT_REL
> +for
> +.BR gelf_update_rel ()
> +or
> +.B SHT_RELA
> +for
> +.BR gelf_update_rela ().
> +
> +.TP
> +.I ndx
> +Zero\-based index of the relocation entry within
> +.IR data .
> +
> +.TP
> +.I src
> +Pointer to the caller\-provided source entry:
> +.B GElf_Rel
> +for
> +.BR gelf_update_rel ()
> +and
> +.B GElf_Rela
> +for
> +.BR gelf_update_rela ().
> +.I src
> +must not be NULL.

OK.

> +.SH RETURN VALUE
> +On success,
> +.BR gelf_update_rel ()
> +and
> +.BR gelf_update_rela ()
> +copy
> +.I src
> +into
> +.I data
> +and return 1. On failure, these functions return 0 and set elf_errno.  If
> +.I src
> +is NULL, then 0 is returned without setting elf_errno.

As with other gelf functions 0 means failure. Not sure it is just 1
that means success. It does in this implementation for this function
though.

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

Where are the GELF_R_SYM and GELF_R_TYPE decribed?

> +.SH ATTRIBUTES
> +.TS
> +allbox;
> +lbx lb lb
> +l l l.
> +Interface    Attribute       Value
> +T{
> +.na
> +.nh
> +.BR gelf_update_rel (),\~gelf_update_rela ()
> +T}   Thread safety   MT-Safe
> +.TE
> +
> +.SH REPORTING BUGS
> +Report bugs to <[email protected]> or 
> https://sourceware.org/bugzilla/.

OK.

> diff --git a/doc/gelf_update_rela.3 b/doc/gelf_update_rela.3
> new file mode 100644
> index 00000000..36db4a78
> --- /dev/null
> +++ b/doc/gelf_update_rela.3
> @@ -0,0 +1 @@
> +.so man3/gelf_update_rel.3

OK.

Thanks,

Mark

Reply via email to