Signed-off-by: Aaron Merey <ame...@redhat.com> --- doc/Makefile.am | 1 + doc/gelf_newehdr.3 | 82 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 doc/gelf_newehdr.3
diff --git a/doc/Makefile.am b/doc/Makefile.am index c0d979ec..bc0ade8a 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_newehdr.3 \ gelf_update_ehdr.3 \ libelf.3 diff --git a/doc/gelf_newehdr.3 b/doc/gelf_newehdr.3 new file mode 100644 index 00000000..58ee910c --- /dev/null +++ b/doc/gelf_newehdr.3 @@ -0,0 +1,82 @@ +.TH GELF_NEWEHDR 3 2025-09-17 "Libelf" "Libelf Programmer's Manual" + +.SH NAME +gelf_newehdr \- allocate and initialize a new ELF file header + +.SH SYNOPSIS +.nf +.B #include <gelf.h> + +.BI "GElf_Ehdr *gelf_newehdr(Elf *" elf ", int " class ");" +.fi + +.SH DESCRIPTION +.BR gelf_newehdr () +allocates and initializes a new ELF header for +.IR elf , +if a header does not already exist. + +.PP +The caller must specify the ELF class via +.IR class , +which must be either: +.TP +.B ELFCLASS32 +Request a 32\-bit ELF file header. +.TP +.B ELFCLASS64 +Request a 64\-bit ELF file header. + +.SH PARAMETERS +.TP +.I elf +Pointer to an ELF descriptor of kind +.BR ELF_K_ELF . + +.TP +.I class +The requested ELF class for the new header. Must be +.B ELFCLASS32 +or +.BR ELFCLASS64 . + +.SH RETURN VALUE +On success, +.B gelf_newehdr() +will return a non-zero value. The ELF header of +.I elf +can be retrieved using +.BR gelf_getehdr (). +.BR elf32_getehdr () +or +.BR elf64_getehdr () +can also be used depending on the ELF class specified by +.IR class . + +On failure, NULL is returned and elf_errno is set. If +.I elf +is NULL then NULL is returned without setting elf_errno. + +.SH SEE ALSO +.BR elf32_getehdr () +.BR elf64_getehdr () +.BR gelf_getehdr (3), +.BR gelf_update_ehdr (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_newehdr () +T} Thread safety MT-Safe +.TE + +.SH REPORTING BUGS +Report bugs to <elfutils-devel@sourceware.org> or https://sourceware.org/bugzilla/. -- 2.51.0