HP-UX Reference (11i v2 03/08) - 3 Library Functions A-M (vol 6)
e
elf_getdata(3E) elf_getdata(3E)
ehdr = elf32_getehdr(elf);
scn = elf_getscn(elf, (size_t)ehdr->e_shstrndx);
shdr = elf32_getshdr(scn);
if (shdr->sh_type != SHT_STRTAB)
{
/* not a string table */
}
data = 0;
if ((data = elf_getdata(scn, data)) == 0
|| data->d_size == 0)
{
/* error or no data */
}
The e_shstrndx member in an ELF header holds the section table index of the string table. The pro-
gram gets a section descriptor for that section, verifies it is a string table, and then retrieves the data.
When this fragment finishes, data->d_buf
points at the first byte of the string table, and
data->d_size holds the string table’s size in bytes.
SEE ALSO
elf(3E), elf_cntl(3E), elf_fill(3E), elf_flag(3E), elf_getehdr(3E), elf_getscn(3E), elf_getshdr(3E),
elf_rawfile(3E), elf_strptr(3E), elf_version(3E), elf_xlate(3E).
HP-UX 11i Version 2: August 2003 − 3 − Hewlett-Packard Company Section 3−−235