ELF_NEWDATA(3) Libelf Programmer's Manual ELF_NEWDATA(3) NAME elf_newdata - Add a new Elf_Data descriptor to a section SYNOPSIS #include 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 modi- fied. 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 func- tion 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 at- tached. 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 allbox; lbx lb lb l l l. Interface Attribute Value T{ elf_newdata() T} Thread safety MT-Safe REPORTING BUGS Report bugs to or https://source- ware.org/bugzilla/. Libelf 2025-06-30 ELF_NEWDATA(3)