---
name: "elf32_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/elf32_getchdr"
---

# elf32\_getchdr(3)

retrieve the compression header for a section from a 32-bit or 64-bit ELF object file.

## NAME

elf32\_getchdr, elf64\_getchdr - retrieve the compression header for a section from a 32-bit or 64-bit ELF object file.

## SYNOPSIS

```
#include <libelf.h>
Elf32_Chdr *elf32_getchdr(Elf_Scn *scn);
Elf64_Chdr *elf64_getchdr(Elf_Scn *scn);
```

## DESCRIPTION

Retrieve the compression header for a section with compressed data. 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.

## RETURN VALUE

On success, return a pointer to the compression header. On failure, return NULL and set a libelf error code.

## SEE ALSO

**elf\_compress**(3), [**elf\_errno**(3)](/elf_errno/3.md), [**libelf**(3)](/libelf/3.md), [**elf**(5)](/elf/5.md)

## ATTRIBUTES

For an explanation of the terms used in this section, see [**attributes**(7)](/attributes/7.md).

| | | |
| --- | --- | --- |
| **Interface** | **Attribute** | **Value** |
| **elf32\_getchdr**(), **elf64\_getchdr**() | Thread safety | MT-Safe |

## REPORTING BUGS

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

## HISTORY

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