[6/6,v2] doc: Add elf_kind.3

Message ID 20250513003341.3234332-6-amerey@redhat.com
State Committed
Headers
Series [1/6] doc/Makefile.am: Sort manpages in alphabetical order |

Commit Message

Aaron Merey May 13, 2025, 12:33 a.m. UTC
  Signed-off-by: Aaron Merey <amerey@redhat.com>

v2: Mention ar(1) and that elfutils libelf does not support COFF object
files.

---

On Thu, May 1, 2025 at 1:17 PM Mark Wielaard <mark@klomp.org> wrote:
>
> > +.SH SEE ALSO
> > +.BR libelf (3),
> > +.BR elf (5)
>
> elf.5 doesn't describe the ar format, should it? Or should we have an
> ar.5 man page?

The ar format is part of the System V ABI so it would make sense for the
kernel man-pages project to include ar.5 along with elf.5.  For now I've
added ar(1) and ranlib(1) under SEE ALSO.

Aaron

 doc/Makefile.am |  1 +
 doc/elf_kind.3  | 73 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 74 insertions(+)
 create mode 100644 doc/elf_kind.3
  

Comments

Mark Wielaard May 14, 2025, 2:16 p.m. UTC | #1
Hi Aaron,

On Mon, 2025-05-12 at 20:33 -0400, Aaron Merey wrote:
> v2: Mention ar(1) and that elfutils libelf does not support COFF object
> files.
> 
> On Thu, May 1, 2025 at 1:17 PM Mark Wielaard <mark@klomp.org> wrote:
> > 
> > > +.SH SEE ALSO
> > > +.BR libelf (3),
> > > +.BR elf (5)
> > 
> > elf.5 doesn't describe the ar format, should it? Or should we have an
> > ar.5 man page?
> 
> The ar format is part of the System V ABI so it would make sense for the
> kernel man-pages project to include ar.5 along with elf.5.  For now I've
> added ar(1) and ranlib(1) under SEE ALSO.

OK, these refer to the binutils ar and ranlib versions. We do have eu-
ar and eu-ranlib but those don't have man pages (yet?).

Looks OK with one typo:

> +.TP
> +.B ELF_K_COFF
> +COFF object file. COFF is supported by elfutils libelf.

Missing a NOT.

Cheers,

Mark
  
Aaron Merey May 14, 2025, 6:48 p.m. UTC | #2
On Wed, May 14, 2025 at 10:16 AM Mark Wielaard <mark@klomp.org> wrote:
>
> Hi Aaron,
>
> On Mon, 2025-05-12 at 20:33 -0400, Aaron Merey wrote:
> > v2: Mention ar(1) and that elfutils libelf does not support COFF object
> > files.
> >
> > On Thu, May 1, 2025 at 1:17 PM Mark Wielaard <mark@klomp.org> wrote:
> > >
> > > > +.SH SEE ALSO
> > > > +.BR libelf (3),
> > > > +.BR elf (5)
> > >
> > > elf.5 doesn't describe the ar format, should it? Or should we have an
> > > ar.5 man page?
> >
> > The ar format is part of the System V ABI so it would make sense for the
> > kernel man-pages project to include ar.5 along with elf.5.  For now I've
> > added ar(1) and ranlib(1) under SEE ALSO.
>
> OK, these refer to the binutils ar and ranlib versions. We do have eu-
> ar and eu-ranlib but those don't have man pages (yet?).

That's right, once we have eu-ar and eu-ranlib man pages we can
mention those here.

>
> Looks OK with one typo:
>
> > +.TP
> > +.B ELF_K_COFF
> > +COFF object file. COFF is supported by elfutils libelf.
>
> Missing a NOT.

Oops, thanks for catching this. Fixed.

>
> Cheers,
>
> Mark
>
  

Patch

diff --git a/doc/Makefile.am b/doc/Makefile.am
index 343b5460..1ced7858 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -59,6 +59,7 @@  notrans_dist_man3_MANS= elf32_checksum.3 \
 			elf_getdata.3 \
 			elf_getscn.3 \
 			elf_hash.3 \
+			elf_kind.3 \
 			elf_ndxscn.3 \
 			elf_update.3 \
 			elf_version.3 \
diff --git a/doc/elf_kind.3 b/doc/elf_kind.3
new file mode 100644
index 00000000..5307d591
--- /dev/null
+++ b/doc/elf_kind.3
@@ -0,0 +1,73 @@ 
+.TH ELF_KIND 3 2025-03-31 "Libelf" "Libelf Programmer's Manual"
+
+.SH NAME
+elf_kind \- Determine the type of file represented by an ELF descriptor.
+
+.SH SYNOPSIS
+.nf
+#include <libelf.h>
+
+.BI "Elf_Kind elf_kind(Elf *" elf ");"
+
+.SH DESCRIPTION
+The
+.B elf_kind
+function determines the file type of the file represented by
+.IR elf .
+This type identifies whether the descriptor represents an
+ELF object, an archive member, or some other type of file.
+
+.SH PARAMETERS
+.TP
+.I elf
+The ELF descriptor.
+
+.SH RETURN VALUE
+The file type of the file represented by
+.IR elf .
+The possible return value are
+
+.RS
+.TP
+.PD 0
+.TP
+.TP
+.B ELF_K_NONE
+Unknown file type.
+
+.TP
+.B ELF_K_AR
+Archive member.
+
+.TP
+.B ELF_K_COFF
+COFF object file. COFF is supported by elfutils libelf.
+
+.TP
+.B ELF_K_ELF
+ELF object file.
+
+
+.SH SEE ALSO
+.BR ar (1),
+.BR ranlib (1),
+.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 elf_kind ()
+T}	Thread safety	MT-Safe
+.TE
+
+.SH REPORTING BUGS
+Report bugs to <elfutils-devel@sourceware.org> or https://sourceware.org/bugzilla/.