elf_rawfile - Man Page
Retrieve a pointer to the entire raw ELF file image
Synopsis
#include <libelf.h> char *elf_rawfile(Elf *elf, size_t *ptr);
Description
The elf_rawfile() function returns a pointer to the entire contents of the ELF file represented by 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 ptr is non-NULL, the total size in bytes of the raw file is stored in *ptr.
The returned buffer is read-only and managed internally by libelf. The application must not modify or free it.
Parameters
- elf
A handle previously returned by elf_begin(3).
- ptr
If not NULL, receives the size in bytes of the ELF file.
Return Value
Returns a pointer to the start of the ELF file data. On failure, NULL is returned and *ptr (if non-NULL) is set to 0.
See Also
Attributes
| Interface | Attribute | Value |
|---|---|---|
| elf_rawfile() | Thread safety | MT-Safe |
Reporting Bugs
Report bugs to <elfutils-devel@sourceware.org> or https://sourceware.org/bugzilla/.