Hi Aaron,
On Sun, 2025-09-21 at 21:30 -0400, Aaron Merey wrote:
> Signed-off-by: Aaron Merey <[email protected]>
> ---
> doc/Makefile.am | 1 +
> doc/gelf_update_ehdr.3 | 65 ++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 66 insertions(+)
> create mode 100644 doc/gelf_update_ehdr.3
>
> diff --git a/doc/Makefile.am b/doc/Makefile.am
> index 3c22f0aa..c0d979ec 100644
> --- a/doc/Makefile.am
> +++ b/doc/Makefile.am
> @@ -93,6 +93,7 @@ notrans_dist_man3_MANS= elf32_checksum.3 \
> elf_version.3 \
> gelf_getclass.3 \
> gelf_getehdr.3 \
> + gelf_update_ehdr.3 \
> libelf.3
OK.
>
> # libdebuginfod man pages (also notrans)
> diff --git a/doc/gelf_update_ehdr.3 b/doc/gelf_update_ehdr.3
> new file mode 100644
> index 00000000..07f8b58a
> --- /dev/null
> +++ b/doc/gelf_update_ehdr.3
> @@ -0,0 +1,65 @@
> +.TH GELF_UPDATE_EHDR 3 2025-09-17 "Libelf" "Libelf Programmer's Manual"
> +
> +.SH NAME
> +gelf_update_ehdr \- copy a class\-independent ELF header into an ELF
> descriptor
> +
> +.SH SYNOPSIS
> +.nf
> +.B #include <gelf.h>
> +
> +.BI "int gelf_update_ehdr(Elf *" elf ", GElf_Ehdr *" src ");"
> +.fi
OK.
> +.SH DESCRIPTION
> +.B gelf_update_ehdr()
> +copies the class\-independent ELF header from the structure pointed to by
> +.I src
> +into the ELF descriptor
> +.I elf .
> +The header is translated as necessary to match the class (
> +.B ELFCLASS32
> +or
> +.BR ELFCLASS64 )
> +of the underlying object.
Maybe add that when the elf descriptor is of ELFCLASS32 then e_entry,
e_phoff and e_shoff need to be expressible as 32bit value. And that the
ELF header already needs to exist (see elf_newehdr).
Also this will mark the Ehdr dirty (see elf_flagehdr).
> +.SH PARAMETERS
> +.TP
> +.I elf
> +Pointer to an ELF descriptor of kind
> +.BR ELF_K_ELF .
> +.TP
> +.I src
> +Pointer to a
> +.B GElf_Ehdr
> +structure that holds the caller’s desired header contents. Must not be NULL.
OK.
> +.SH RETURN VALUE
> +On success, returns
> +.B 1 .
> +On failure,
> +.B 0
> +is returned, and elf_errno is set. If
> +.I elf
> +is NULL, then 0 is returned without setting elf_errno.
OK.
> +.SH SEE ALSO
> +.BR gelf_getehdr (3),
> +.BR gelf_newehdr (3),
> +.BR libelf (3),
> +.BR elf (5)
Maybe add elf_flagehdr?
> +.SH ATTRIBUTES
> +.TS
> +allbox;
> +lbx lb lb
> +l l l.
> +Interface Attribute Value
> +T{
> +.na
> +.nh
> +.BR gelf_update_ehdr ()
> +T} Thread safety MT-Safe
> +.TE
> +
> +.SH REPORTING BUGS
> +Report bugs to <[email protected]> or
> https://sourceware.org/bugzilla/.
OK.
Thanks,
Mark