[3/9] doc: Add elf32_getchdr.3 and elf64_getchdr.3
Commit Message
Signed-off-by: Aaron Merey <amerey@redhat.com>
---
doc/elf32_getchdr.3 | 48 +++++++++++++++++++++++++++++++++++++++++++++
doc/elf64_getchdr.3 | 48 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 96 insertions(+)
create mode 100644 doc/elf32_getchdr.3
create mode 100644 doc/elf64_getchdr.3
Comments
Hi Aaron,
On Wed, 2024-08-14 at 17:33 -0400, Aaron Merey wrote:
> diff --git a/doc/elf32_getchdr.3 b/doc/elf32_getchdr.3
> new file mode 100644
> index 00000000..902ae09c
> --- /dev/null
> +++ b/doc/elf32_getchdr.3
> @@ -0,0 +1,48 @@
> +.TH ELF32_GETCHDR 3 2024-08-14 "Libelf" "Libelf Programmer's Manual"
> +
> +.SH NAME
> +elf32_getchdr \- retrieve the compression header for a section from an ELF32 object file.
> +
> +.SH SYNOPSIS
> +.B #include <libelf.h>
> +
> +.BI "Elf32_Chdr *elf32_getchdr(Elf_Scn *" scn ");"
> +
> +.SH DESCRIPTION
> +Retrieve the compression header for a section with compressed data.
This should mention that this works only for sections that are
compressed and have the Shdr SHF_COMPRESSED flag set. Otherwise it will
return NULL. It should also mention what the Elf32_Chdr structure looks
like and what the meaning the fields have. What the legal values of
ch_type are, that ch_size is the uncompressed section data size, and
that ch_addralign is the alignment of the uncompressed data.
> +.SH PARAMETERS
> +.TP
> +.I scn
> +Section whose compression header will be retrieved.
> +
> +.SH RETURN VALUE
> +On success, return a pointer to the compression header. On failure, return NULL and set a libelf error code.
Probably should explicitly mention that one failure type is the section
not being compressed (the Shdr not having the SHF_COMPRESSED flag set).
> +.SH SEE ALSO
> +.BR elf_errno (3),
> +.BR elf64_getchdr (3),
> +.BR libelf (3),
> +.BR elf (5)
elf_compress (3) ?
> +.SH ATTRIBUTES
> +For an explanation of the terms used in this section, see
> +.BR attributes (7).
> +.TS
> +allbox;
> +lbx lb lb
> +l l l.
> +Interface Attribute Value
> +T{
> +.na
> +.nh
> +.BR elf32_getchdr ()
> +T} Thread safety MT-Safe
> +.TE
> +
> +.SH REPORTING BUGS
> +Report bugs to <elfutils-devel@sourceware.org> or https://sourceware.org/bugzilla/.
> +
> +.SH HISTORY
> +.B elf32_getchdr
> +first appeared in elfutils 0.165. This elfutils libelf function may not be found in other libelf implementations.
Yes, but it has been standardized:
http://www.linker-aliens.org/blogs/ali/entry/elf_section_compression/
Cheers,
Mark
new file mode 100644
@@ -0,0 +1,48 @@
+.TH ELF32_GETCHDR 3 2024-08-14 "Libelf" "Libelf Programmer's Manual"
+
+.SH NAME
+elf32_getchdr \- retrieve the compression header for a section from an ELF32 object file.
+
+.SH SYNOPSIS
+.B #include <libelf.h>
+
+.BI "Elf32_Chdr *elf32_getchdr(Elf_Scn *" scn ");"
+
+.SH DESCRIPTION
+Retrieve the compression header for a section with compressed data.
+
+.SH PARAMETERS
+.TP
+.I scn
+Section whose compression header will be retrieved.
+
+.SH RETURN VALUE
+On success, return a pointer to the compression header. On failure, return NULL and set a libelf error code.
+
+.SH SEE ALSO
+.BR elf_errno (3),
+.BR elf64_getchdr (3),
+.BR libelf (3),
+.BR elf (5)
+
+.SH ATTRIBUTES
+For an explanation of the terms used in this section, see
+.BR attributes (7).
+.TS
+allbox;
+lbx lb lb
+l l l.
+Interface Attribute Value
+T{
+.na
+.nh
+.BR elf32_getchdr ()
+T} Thread safety MT-Safe
+.TE
+
+.SH REPORTING BUGS
+Report bugs to <elfutils-devel@sourceware.org> or https://sourceware.org/bugzilla/.
+
+.SH HISTORY
+.B elf32_getchdr
+first appeared in elfutils 0.165. This elfutils libelf function may not be found in other libelf implementations.
new file mode 100644
@@ -0,0 +1,48 @@
+.TH ELF64_GETCHDR 3 2024-08-14 "Libelf" "Libelf Programmer's Manual"
+
+.SH NAME
+elf64_getchdr \- retrieve the compression header for a section from an ELF64 object file.
+
+.SH SYNOPSIS
+.B #include <libelf.h>
+
+.BI "Elf64_Chdr *elf64_getchdr(Elf_Scn *" scn ");"
+
+.SH DESCRIPTION
+Retrieve the compression header for a section with compressed data.
+
+.SH PARAMETERS
+.TP
+.I scn
+Section whose compression header will be retrieved.
+
+.SH RETURN VALUE
+On success, return a pointer to the compression header. On failure, return NULL and set a libelf error code.
+
+.SH SEE ALSO
+.BR elf_errno (3),
+.BR elf32_getchdr (3),
+.BR libelf (3),
+.BR elf (5)
+
+.SH ATTRIBUTES
+For an explanation of the terms used in this section, see
+.BR attributes (7).
+.TS
+allbox;
+lbx lb lb
+l l l.
+Interface Attribute Value
+T{
+.na
+.nh
+.BR elf64_getchdr ()
+T} Thread safety MT-Safe
+.TE
+
+.SH REPORTING BUGS
+Report bugs to <elfutils-devel@sourceware.org> or https://sourceware.org/bugzilla/.
+
+.SH HISTORY
+.B elf64_getchdr
+first appeared in elfutils 0.165. This elfutils libelf function may not be found in other libelf implementations.