]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
doc: Add gelf_newehdr.3 main
authorAaron Merey <amerey@redhat.com>
Mon, 3 Nov 2025 23:00:34 +0000 (18:00 -0500)
committerAaron Merey <amerey@redhat.com>
Mon, 3 Nov 2025 23:00:34 +0000 (18:00 -0500)
Signed-off-by: Aaron Merey <amerey@redhat.com>
doc/Makefile.am
doc/gelf_newehdr.3 [new file with mode: 0644]

index b212266b1629866624fa404cc5655286d60adc1c..3064e8ed2e6eea5af7defaf5a54d72f3b806c76c 100644 (file)
@@ -96,6 +96,7 @@ notrans_dist_man3_MANS= elf32_checksum.3 \
                        gelf_getrel.3 \
                        gelf_getrela.3 \
                        gelf_getshdr.3 \
+                       gelf_newehdr.3 \
                        gelf_newphdr.3 \
                        gelf_offscn.3 \
                        gelf_update_ehdr.3 \
diff --git a/doc/gelf_newehdr.3 b/doc/gelf_newehdr.3
new file mode 100644 (file)
index 0000000..bc24803
--- /dev/null
@@ -0,0 +1,87 @@
+.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 "void *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.  When a new ELF header is created,
+all of its fields are zero-initialized.
+
+.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,
+.BR 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.
+
+In other libelf implementations the
+.BR gelf_newehdr ()
+return value may be a different type.
+
+.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/.