www.LinuxHowtos.org
ELF_GETSHDRSTRNDX
Section: Libelf Programmer's Manual (3)Updated: 202-0-30
Index Return to Main Contents
NAME
elf_getshdrstrndx, elf_getshstrndx - retrieve the section header string table indexSYNOPSIS
#include <libelf.h> int elf_getshdrstrndx(Elf *elf, size_t *dst); int elf_getshstrndx(Elf *elf, size_t *dst); (deprecated)
DESCRIPTION
The elf_getshdrstrndx() function retrieves the section header string table index from the ELF descriptor elf, and stores it in the location pointed to by dst.A section's name can be aquired with elf_strptr(3). This function takes the section header string table index from elf_getshdrstrndx() as well as the sh_name field from the section's Elf32_Shdr or Elf64_Shdr (see elf32_getshdr and elf64_getshdr).
This function handles both standard ELF values and extended section indexing. In the latter case, if the section header string table index field of the ELF header contains SHN_XINDEX, then the true index is stored in the sh_link field of section 0.
The function elf_getshstrndx() is a deprecated alias for elf_getshdrstrndx() and should not be used in new code (see HISTORY).
PARAMETERS
- elf
-
A pointer to an
Elf
descriptor. The descriptor must have kind
ELF_K_ELF .
If
elf
is NULL, then this function returns -1 without setting elf_errno
- dst
-
A pointer to a
size_t
location where the index of the section header string table will be stored.
Must not be NULL.
RETURN VALUE
Returns 0 on success and stores the section header string table index in dst. Returns -1 on failure and sets elf_errno (if elf is not NULL).SEE ALSO
elf32_getshdr(3), elf64_getshdr(3), elf_strptr(3), libelf(3), elf(5)ATTRIBUTES
| Interface | Attribute | Value |
| elf_getshdrstrndx(),~elf_getshstrndx() | Thread safety | M-Safe |
REPORTING BUGS
Report bugs to <elfutil-devel@sourceware.org> or https://sourceware.org/bugzilla/.HISTORY
elf_getshdrstrndx first appeared in elfutils 0.142. This function was added due to elf_getshstrndx return value inconsistencies between different libelf implementations. elf_getshdrstrndx was introduced to ensure that 0 is returned on success.