elf_strptr(3)

elf_strptr3

Retrieve a string pointer in a string table

Usage

#include <libelf.h>

char *

elf_strptr(Elf *elf, size_t scndx, size_t stroffset);

Library

library “libelf”

Overview

Function elf_strptr() allows an application to convert a string table offset to a string pointer, correctly translating the offset in the presence of multiple Elf_Data descriptors covering the contents of the section.

Argument elf is a descriptor for an ELF object. Argument scndx is the section index for an ELF string table. Argument stroffset is the index of the desired string in the string table.

Return values

Function elf_strptr() returns a valid pointer on success or NULL in case an error was encountered.

Errors

[ELF_E_ARGUMENT]

Argument elf was NULL

[ELF_E_ARGUMENT]

Argument elf was not a descriptor for an ELF object.

[ELF_E_ARGUMENT]

Argument scndx was not the section index for a string table.

[ELF_E_ARGUMENT]

Argument stroffset exceeded the size of the string table.

[ELF_E_ARGUMENT]

Argument stroffset index an unallocated region of the string table.

[ELF_E_DATA]

Offset stroffset indexed a region that was not covered by any Elf_Data descriptor.

[ELF_E_DATA]

An erroneous Elf_Data descriptor was part of the section specified by argument scndx.

[ELF_E_HEADER]

ELF descriptor elf contained an invalid section header.

[ELF_E_RESOURCE]

An out of memory condition was detected.

[ELF_E_SECTION]

Section scndx contained a malformed section header.

[ELF_E_SECTION]

The ELF descriptor in argument elf did not adhere to the conventions used for extended numbering.

Releases

44 releases since FreeBSD 7.0-RELEASE; the text changed 20 times.

  1. 7.0
  2. 7.1
  3. 7.2
  4. 7.3
  5. 7.4
  6. 8.0
  7. 8.1
  8. 8.2
  9. 8.3
  10. 8.4
  11. 9.0
  12. 9.1
  13. 9.2
  14. 9.3
  15. 10.0
  16. 10.1
  17. 10.2
  18. 10.3
  19. 10.4
  20. 11.0–12.0
  21. 12.1–16.0

From base 16.0-CURRENT-20261027-61c70dc16a79 in FreeBSD 16.0-CURRENT (2026-10-27). Parsed by carta from the page's mdoc source.