---
name: "gelf_getchdr"
section: "3"
platform: "linux"
package: "libelf"
version: "0.197-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux", "freebsd"]
url: "https://new.carta.tech/gelf_getchdr"
---

# gelf\_getchdr(3)

retrieve the class-independent compression header for an ELF section with compressed data.

## NAME

gelf\_getchdr - retrieve the class-independent compression header for an ELF section with compressed data.

## SYNOPSIS

```
#include <gelf.h>
GElf_Chdr *gelf_getchdr (Elf_Scn *scn, GElf_Chdr *dest);
```

## DESCRIPTION

Retrieve the class-independent compression header for section *scn* with compressed data and store it in *dest*. Sections with compressed data are indicated with the **SHF\_COMPRESSED** flag.  See [**libelf**(3)](/libelf/3.md) for more information regarding the compression header.

## PARAMETERS

- *scn*

  Section whose compression header will be retrieved. The section's **SHF\_COMPRESSED** flag must be set.

- *dest*

  Pointer to a caller-provided **GElf\_Chdr** structure that will receive the class-independent compression header for *scn*.

## RETURN VALUE

On success, this function returns *dest*. On failure, it returns NULL and sets elf\_errno.  If *scn* is NULL, then NULL is returned and elf\_errno is not set.

## SEE ALSO

[**elf32\_getchdr**(3)](/elf32_getchdr/3.md), [**elf64\_getchdr**(3)](/elf64_getchdr/3.md), **elf\_compress**(3), [**libelf**(3)](/libelf/3.md), [**elf**(5)](/elf/5.md)

## ATTRIBUTES

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

## REPORTING BUGS

Report bugs to \<elfutils-devel@sourceware.org\> or https://sourceware.org/bugzilla/.

## HISTORY

**gelf\_getchdr** first appeared in elfutils 0.165.
