1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
.TH ELF_RAWFILE 3 2025-06-30 "Libelf" "Libelf Programmer's Manual"
.SH NAME
elf_rawfile \- Retrieve a pointer to the entire raw ELF file image
.SH SYNOPSIS
.nf
#include <libelf.h>
.BI "char *elf_rawfile(Elf *" elf ", size_t *" ptr ");"
.fi
.SH DESCRIPTION
The
.BR elf_rawfile ()
function returns a pointer to the entire contents of the ELF file represented by
.IR elf .
This data is unprocessed and includes everything from the ELF header to the
final byte.
If the ELF descriptor was opened from memory or the file has already been
memory-mapped or fully read, this function returns a pointer to the internal buffer.
If the ELF data has not yet been read or mapped, it is loaded on demand.
If
.I ptr
is non-NULL, the total size in bytes of the raw file is stored in
.IR *ptr .
The returned buffer is read-only and managed internally by libelf.
The application must not modify or free it.
.SH PARAMETERS
.TP
.I elf
A handle previously returned by
.BR elf_begin (3) .
.TP
.I ptr
If not
.BR NULL ,
receives the size in bytes of the ELF file.
.SH RETURN VALUE
Returns a pointer to the start of the ELF file data. On failure,
.B NULL
is returned and
.I *ptr
(if non-NULL) is set to 0.
.SH SEE ALSO
.BR libelf (3),
.BR elf (5)
.SH ATTRIBUTES
.TS
allbox;
lbx lb lb
l l l.
Interface Attribute Value
T{
.na
.nh
.BR elf_rawfile ()
T} Thread safety MT-Safe
.TE
.SH REPORTING BUGS
Report bugs to <elfutils-devel@sourceware.org> or https://sourceware.org/bugzilla/.
|