Signed-off-by: Aaron Merey <[email protected]>
---
doc/Makefile.am | 3 ++-
doc/elf_getbase.3 | 55 +++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 57 insertions(+), 1 deletion(-)
create mode 100644 doc/elf_getbase.3
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 0dec1fc7..56c56b7b 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -60,7 +60,8 @@ notrans_dist_man3_MANS= elf_update.3 \
elf64_checksum.3 \
libelf.3 \
elf_end \
- elf_fill
+ elf_fill \
+ elf_getbase
# libdebuginfod man pages (also notrans)
# Note we include them even when not building them because we want
diff --git a/doc/elf_getbase.3 b/doc/elf_getbase.3
new file mode 100644
index 00000000..1934e1ac
--- /dev/null
+++ b/doc/elf_getbase.3
@@ -0,0 +1,55 @@
+.TH ELF_GETBASE 3 2025-03-31 "Libelf" "Libelf Programmer's Manual"
+
+.SH NAME
+elf_getbase \- Retrieve the base offset for an ELF object file.
+
+.SH SYNOPSIS
+.B #include <libelf.h>
+
+.BI "int64_t elf_getbase(Elf *" elf ");"
+
+.SH DESCRIPTION
+.B elf_getbase
+returns the file offset of the first byte of the ELF descriptor
+.IR elf .
+If
+.I elf
+is a member of an archive and has ELF kind
+.BR ELF_K_AR ,
+the base offset is the offset of the ELF object within the archive.
+For other ELF object types the base offset is 0.
+
+.SH PARAMETERS
+.TP
+.I elf
+The ELF descriptor.
+
+.SH RETURN VALUE
+Return the base offset of
+.IR elf .
+If
+.I elf
+is NULL, return -1.
+
+.SH SEE ALSO
+.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_getbase ()
+T} Thread safety MT-Safe
+.TE
+
+.SH REPORTING BUGS
+Report bugs to <[email protected]> or
https://sourceware.org/bugzilla/.
--
2.49.0