GELF\_GETSHDR(3) Libelf Programmer's Manual GELF\_GETSHDR(3)

# [NAME](#NAME)

gelf\_getshdr - retrieve a section header into a class-independent structure

# [SYNOPSIS](#SYNOPSIS)

```
#include <gelf.h>
GElf_Shdr *gelf_getshdr(Elf_Scn *scn, GElf_Shdr *dst);
```

# [DESCRIPTION](#DESCRIPTION)

**gelf\_getshdr**() retrieves the section header associated with the section descriptor *scn*, translating it into the class-independent **GElf\_Shdr** representation. The header is copied into the structure referenced by *dst*.

# [PARAMETERS](#PARAMETERS)

[*scn*](#scn)

Pointer to a section descriptor of type **Elf\_Scn**.

[*dst*](#dst)

Pointer to a caller-provided **GElf\_Shdr** structure to receive the section header.

# [RETURN VALUE](#RETURN_VALUE)

On success, **gelf\_getshdr()** stores the section header in *dst* and returns *dst*. On failure, NULL is returned and elf\_errno is set. If *scn* is NULL then NULL is returned without setting elf\_errno.

# [SEE ALSO](#SEE_ALSO)

[**elf32\_getshdr**(3)](/man/os/elfutils/elf32_getshdr.3), [**elf64\_getshdr**(3)](/man/os/elfutils/elf64_getshdr.3), [**gelf\_update\_shdr**(3)](/man/os/elfutils/gelf_update_shdr.3), [**libelf**(3)](/man/os/elfutils/libelf.3), [**elf**(5)](/man/os/elfutils/elf.5)

# [ATTRIBUTES](#ATTRIBUTES)

**Interface** **Attribute** **Value** gelf\_getshdr () Thread safety MT-Safe

# [REPORTING BUGS](#REPORTING_BUGS)

Report bugs to &lt;elfutils-devel@sourceware.org&gt; or https://sourceware.org/bugzilla/.

2025-09-22 Libelf

---

Document: gelf_getshdr(3) from elfutils 0.196-r1 (Chainguard OS)
Source: https://sourceware.org/git/elfutils.git
