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 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
|
.TH ELF_RAWDATA 3 2025-06-30 "Libelf" "Libelf Programmer's Manual"
.SH NAME
elf_rawdata - Retrieve unprocessed section data from an ELF section.
.SH SYNOPSIS
.nf
#include <libelf.h>
.BI "Elf_Data *elf_rawdata(Elf_Scn *" scn ", Elf_Data *" data ");"
.fi
.SH DESCRIPTION
The
.BR elf_rawdata ()
function returns a pointer to an
.B Elf_Data
structure containing the unprocessed (raw) contents of the section
identified by
.IR scn .
This raw view reflects the exact on-disk binary layout of the ELF file
with no modifications made for endianness or memory alignment. Use
.BR elf_getdata (3)
to acquire a view of the data that has been translated to the in-memory
format.
If
.I data
is NULL,
the raw data of the section is returned. If
.I data
is not NULL and raw data has not been initialized, the call fails.
For compressed sections (i.e., with the
.B SHF_COMPRESSED
flag), the returned
.B Elf_Data
contains the compressed form, and its
.B d_type
is
.BR ELF_T_CHDR .
For sections of type
.B SHT_NOBITS ,
the
.B d_buf
pointer is NULL.
The
.I Elf_Data *
returned by this function and it's
.I d_buf
are owned by libelf and should not be freed. They are only valid until
.BR elf_end (3)
is called on the
.I Elf
descriptor associated with
.IR scn .
.SH PARAMETERS
.TP
.I scn
A section descriptor returned from
.BR elf_getscn (3)
or
.BR elf_nextscn (3) .
If NULL, then this function returns NULL.
.TP
.I data
Must be NULL on initial invocation. Any other use is not supported.
.SH RETURN VALUE
Returns a pointer to an
.B Elf_Data
descriptor describing the raw contents of the section. On failure, NULL
is returned and elf_errno is set.
.SH SEE ALSO
.BR elf_getdata (3),
.BR elf_getscn (3),
.BR elf_compress (3),
.BR libelf (3),
.BR elf (5)
.SH ATTRIBUTES
.TS
allbox;
lbx lb lb
l l l.
Interface Attribute Value
T{
.na
.nh
.BR elf_rawdata ()
T} Thread safety MT-Safe
.TE
.SH REPORTING BUGS
Report bugs to <elfutils-devel@sourceware.org> or https://sourceware.org/bugzilla/.
|