diff options
Diffstat (limited to 'doc/elf_newdata.3')
| -rw-r--r-- | doc/elf_newdata.3 | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/doc/elf_newdata.3 b/doc/elf_newdata.3 new file mode 100644 index 00000000..f7f522fd --- /dev/null +++ b/doc/elf_newdata.3 @@ -0,0 +1,64 @@ +.TH ELF_NEWDATA 3 "June 2024" "Elfutils" "Library Functions Manual" + +.SH NAME +elf_newdata \- create a new data descriptor for an ELF section + +.SH SYNOPSIS +.B #include <libelf.h> + +.BI "Elf_Data *elf_newdata(Elf_Scn *" scn ");" + +.SH DESCRIPTION +The .B elf_newdata function creates a new data descriptor for the section descriptor referred to by .I scn in an ELF object. This new data descriptor can be used to add or modify the contents of the section. + +.SH PARAMETERS +.TP +.I scn +An .I Elf_Scn pointer to the section descriptor for which a new data descriptor is to be created. The section descriptor must be valid. + +.SH RETURN VALUE +The .B elf_newdata function returns a pointer to the newly created .I Elf_Data structure representing the data descriptor. If an error occurs, it returns NULL and sets an appropriate error code. + +.SH ERRORS +If .B elf_newdata fails, it sets the following error codes: + +.TP +.B ELFARG +The .I scn parameter is NULL or invalid. + +.TP +.B ELFERR +An unspecified internal error occurred. + +.SH EXAMPLES +.B "Example 1: Create a new data descriptor for a section" +.nf +.in +4 +#include <libelf.h> + +Elf *elf = ...; // Assume elf is a valid Elf pointer +Elf_Scn *scn = ...; // Assume scn is a valid section descriptor + +Elf_Data *data = elf_newdata(scn); +if (data == NULL) { + // Handle error +} else { + // Use the new data descriptor +} +.in -4 +.fi + +.SH SEE ALSO +.BR elf (3), +.BR elf_getscn (3), +.BR elf_getdata (3), +.BR elf_rawdata (3), +.BR libelf (3) + +.SH AUTHORS +Elfutils was written by the Elfutils development team. + +.SH COPYRIGHT +Copyright © 2024 Elfutils Development Team. +This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + |
