Main index | Section 3 | Options |
#include <libelf.h>
Function elf_getdata() will return the next data descriptor associated with section descriptor scn. The returned data descriptor will be setup to contain translated data. Argument data may be NULL, in which case the function returns the first data descriptor associated with section scn. If argument data is not NULL, it must be a pointer to a data descriptor associated with section descriptor scn, and function elf_getdata() will return a pointer to the next data descriptor for the section, or NULL when the end of the section's descriptor list is reached.
Function elf_newdata() will allocate a new data descriptor and append it to the list of data descriptors associated with section descriptor scn. The new data descriptor will be initialized as follows:
d_align | |
Set to 1. | |
d_buf | |
Initialized to NULL. | |
d_off | |
Set to (off_t) -1. This field is under application control if the ELF_F_LAYOUT flag was set on the ELF descriptor. | |
d_size | |
Set to zero. | |
d_type | |
Initialized to ELF_T_BYTE. | |
d_version | |
Set to the current working version of the library, as set by elf_version(3). | |
Function elf_rawdata() is used to step through the data descriptors associated with section scn. In contrast to function elf_getdata(), this function returns untranslated data. If argument data is NULL, the first data descriptor associated with section scn is returned. If argument data is not NULL, is must be a data descriptor associated with section scn, and function elf_rawdata() will return the next data descriptor in the list, or NULL if no further descriptors are present. Function elf_rawdata() always returns Elf_Data structures of type ELF_T_BYTE.
If an application wishes to create a section of type SHT_NOBITS, it should add a data buffer to the section using function elf_newdata(). It should then set the d_buf and d_size members of the returned Elf_Data structure to NULL and the desired size of the section respectively.
[ELF_E_ARGUMENT] | |
Either of the arguments scn or data was NULL. | |
[ELF_E_ARGUMENT] | |
The data descriptor referenced by argument data is not associated with section descriptor scn. | |
[ELF_E_ARGUMENT] | |
The section denoted by argument scn had no data associated with it. | |
[ELF_E_DATA] | Retrieval of data from the underlying object failed. |
[ELF_E_RESOURCE] | |
An out of memory condition was detected. | |
[ELF_E_SECTION] | Section scn had type SHT_NULL. |
[ELF_E_SECTION] | The type of the section scn was not recognized by the library. |
[ELF_E_SECTION] | The size of the section scn is not a multiple of the file size for its section type. |
[ELF_E_SECTION] | The file offset for section scn is incorrect. |
[ELF_E_UNIMPL] | The section type associated with section scn is not supported. |
[ELF_E_VERSION] | Section scn was associated with an ELF object with an unsupported version. |
ELF_GETDATA (3) | April 22, 2019 |
Main index | Section 3 | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.