ELF_NEWDATA(3)

NAME
elf_newdata - 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, d_size, d_off, set to zero, and d_align set to one.

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
 | Thread safety | MT-Safe

REPORTING BUGS
Report bugs to <elfutils-devel@sourceware.org> or https://sourceware.org/bugzilla/.