Add sections "GELF INTERFACE", "GELF NAMESPACE" and "GELF DATA
STRUCTURES".

Signed-off-by: Aaron Merey <[email protected]>
---

v2 changes:
Reposting due to commit squash error.

 doc/libelf.3 | 122 ++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 120 insertions(+), 2 deletions(-)

diff --git a/doc/libelf.3 b/doc/libelf.3
index e6fb1a1b..eb5d1c18 100644
--- a/doc/libelf.3
+++ b/doc/libelf.3
@@ -8,6 +8,7 @@ Elfutils library (\fBlibelf\fP, \fBlibelf.so\fP, \fB-lelf\fP)
 .SH SYNOPSIS
 .nf
 .B #include <libelf.h>
+.B #include <gelf.h>
 
 .SH DESCRIPTION
 The \fBlibelf\fP library provides an API for reading, writing, and manipulating
@@ -112,8 +113,8 @@ The application must not call
 on any memory allocated by \fBlibelf\fP.
 
 .SH NAMESPACE
-\fBlibelf\fP uses the following prefix format. See \fBlibelf.h\fP for more
-information.
+\fBlibelf\fP uses the following prefix format. See \fBlibelf.h\fP and
+\fBgelf.h\fP for more information.
 
 .RS
 .TP
@@ -359,5 +360,122 @@ Offset for this file in the archive.
 .I as_hash
 Hash value of the name.
 
+.SH GELF INTERFACE
+.B <gelf.h>
+provides an additional class-independent interface on top of libelf that 
supports
+both ELFCLASS32 and ELFCLASS64 binaries without specialization based on byte 
size.
+
+This interface provides
+.B GElf_*
+types that are sized according to the largest common denominator between the
+corresponding
+.B Elf32_*
+and
+.B Elf64_*
+types.
+.B gelf_*
+functions transparently handle any type conversions necessary to match
+the class of an ELF binary.
+
+Note that if an ELF binary has class
+.BR ELFCLASS32 ,
+then any
+.B GElf_*
+values and struct fields should be able to fit into the corresponding
+ELFCLASS32 values and struct fields.  For example, a
+.B GElf_Off
+value used with an
+.B ELFCLASS32
+binary should fit in a
+.B Elf32_Off
+value.
+
+.SH GELF NAMESPACE
+
+.RS
+.TP
+.PD 0
+.TP
+.B gelf_
+Class-independent libelf functions.
+
+.TP
+.B GElf_
+Types that represent class-independent data for ELF files.
+
+.TP
+.B GELF_
+Class-independent macros for manipulating particular GElf struct fields.
+
+.fi
+.PD
+.RE
+
+.SH GELF DATA STRUCTURES
+
+All GElf types are defined as aliases for their 64-bit ELF counterparts.
+See
+.B elf(5)
+for more information regarding the underlying types.
+
+.TS
+tab(:);
+lB lB
+l l.
+GElf type:Underlying 64-bit type
+_
+GElf_Half:Elf64_Half
+GElf_Word:Elf64_Word
+GElf_Sword:Elf64_Sword
+GElf_Xword:Elf64_Xword
+GElf_Sxword:Elf64_Sxword
+GElf_Addr:Elf64_Addr
+GElf_Off:Elf64_Off
+GElf_Ehdr:Elf64_Ehdr
+GElf_Shdr:Elf64_Shdr
+GElf_Section:Elf64_Section
+GElf_Sym:Elf64_Sym
+GElf_Syminfo:Elf64_Syminfo
+GElf_Rel:Elf64_Rel
+GElf_Rela:Elf64_Rela
+GElf_Relr:Elf64_Relr
+GElf_Phdr:Elf64_Phdr
+GElf_Chdr:Elf64_Chdr
+GElf_Dyn:Elf64_Dyn
+GElf_Verdef:Elf64_Verdef
+GElf_Verdaux:Elf64_Verdaux
+GElf_Verneed:Elf64_Verneed
+GElf_Vernaux:Elf64_Vernaux
+GElf_Versym:Elf64_Versym
+GElf_auxv_t:Elf64_auxv_t
+GElf_Nhdr:Elf64_Nhdr
+GElf_Move:Elf64_Move
+GElf_Lib:Elf64_Lib
+.TE
+
+.SH GELF MACROS
+All GElf macros are defined as aliases for their 64-bit ELF counterparts.
+See
+.B elf(5)
+for more information regarding the underlying macros.
+
+.TS
+tab(:);
+lB lB
+l l.
+GElf macro:Underlying 64-bit macro
+_
+GELF_ST_BIND:ELF64_ST_BIND
+GELF_ST_TYPE:ELF64_ST_TYPE
+GELF_ST_INFO:ELF64_ST_INFO
+GELF_ST_VISIBILITY:ELF64_ST_VISIBILITY
+GELF_M_INFO:ELF64_M_INFO
+GELF_M_SIZE:ELF64_M_SIZE
+GELF_M_SYM:ELF64_M_SYM
+GELF_R_INFO:ELF64_R_INFO
+GELF_R_TYPE:ELF64_R_TYPE
+GELF_R_SYM:ELF64_R_SYM
+.TE
+
 .SH REPORTING BUGS
 Report bugs to <[email protected]> or 
https://sourceware.org/bugzilla/.
-- 
2.51.1

Reply via email to