]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
doc: Add elf_getbase.3
authorAaron Merey <amerey@redhat.com>
Tue, 13 May 2025 00:33:39 +0000 (20:33 -0400)
committerAaron Merey <amerey@redhat.com>
Wed, 14 May 2025 18:47:46 +0000 (14:47 -0400)
Signed-off-by: Aaron Merey <amerey@redhat.com>
doc/Makefile.am
doc/elf_getbase.3 [new file with mode: 0644]

index e6f877c498416c12e32fa20c91d8e7ca0f01a327..00cdc25385cfde9cb4a59e7391318e26f669b60e 100644 (file)
@@ -55,6 +55,7 @@ notrans_dist_man3_MANS= elf32_checksum.3 \
                        elf_errmsg.3 \
                        elf_errno.3 \
                        elf_fill.3 \
+                       elf_getbase.3 \
                        elf_getdata.3 \
                        elf_getscn.3 \
                        elf_ndxscn.3 \
diff --git a/doc/elf_getbase.3 b/doc/elf_getbase.3
new file mode 100644 (file)
index 0000000..493d7a5
--- /dev/null
@@ -0,0 +1,59 @@
+.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 its ELF kind is
+.BR ELF_K_AR ,
+otherwise return 0.  If
+.I elf
+is NULL, return -1.
+
+.SH SEE ALSO
+.BR elf_getaroff (3),
+.BR elf_rawelf (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 elf_getbase ()
+T}     Thread safety   MT-Safe
+.TE
+
+.SH REPORTING BUGS
+Report bugs to <elfutils-devel@sourceware.org> or https://sourceware.org/bugzilla/.