elf_newdata - Man Page
Add a new Elf_Data descriptor to a section
Synopsis
#include <libelf.h> Elf_Data * elf_newdata(Elf_Scn *scn);
Description
The elf_newdata() function creates a new Elf_Data descriptor and associates it with the section referred to by scn . This descriptor can be used to describe new section contents for an ELF object being constructed or modified.
The section must not be the null section (index 0). If the section has no data associated with it yet, or was created using elf_newscn(), this function creates the first Elf_Data descriptor for the section.
Subsequent calls to elf_newdata() will append new data descriptors to the section.
The returned descriptor is marked dirty so that it will be included during elf_update(). The returned descriptor is also initialized to represent no data with d_buf set to NULL, d_type set to ELF_T_BYTE, d_version set to EV_CURRENT, and d_size, d_off, and d_align set to zero.
Parameters
- scn
A section descriptor to which the new data descriptor should be attached. Must not be section zero, the null section. If scn is NULL this function returns NULL.
Return Value
On success, a pointer to a new, writable Elf_Data descriptor is returned. On failure, NULL is returned an elf_errno is set. If scn is NULL, then NULL is returned and elf_errno is not set.
The caller is responsible for configuring the return value (see Description for default field values).
See Also
elf_getdata(3), elf_newscn(3), elf_update(3), libelf(3), elf(5)
Attributes
| Interface | Attribute | Value |
|---|---|---|
| elf_newdata() | Thread safety | MT-Safe |
Reporting Bugs
Report bugs to <elfutils-devel@sourceware.org> or https://sourceware.org/bugzilla/.
Referenced By
elf_flagelf(3), elf_newscn(3).