gelf_getchdr(3)

gelf_getchdr3

Retrieve the compression header of a section

Usage

#include <libelf.h>

Elf32_Chdr *

elf32_getchdr(Elf_Scn *s);

Elf64_Chdr *

elf64_getchdr(Elf_Scn *s);

#include <gelf.h>

GElf_Chdr *

gelf_getchdr(Elf_Scn *scn, GElf_Chdr *chdr);

Library

library “libelf”

Overview

These functions return a pointer to the ELF Compression Header data structure associated with section descriptor scn.

Function elf32_getchdr() retrieves a pointer to an Elf32_Chdr structure. Section descriptor scn must be associated with an ELF descriptor of class ELFCLASS32.

Function elf64_getchdr() retrieves a pointer to an Elf64_Chdr structure. Section descriptor scn must be associated with an ELF descriptor of class ELFCLASS64.

Function gelf_getchdr() copies the values in the compression header associated with argument scn to the structure pointed to be argument dst. The GElf_Chdr data structure is described in gelf(3).

Return values

Functions elf32_getchdr() and elf64_getchdr() return a valid pointer to the appropriate compression header on success or NULL if an error was encountered.

Function gelf_getchdr() returns argument dst if successful, or NULL if an error was encountered.

Errors

These functions may fail with the following errors:

[ELF_E_INVALID_SECTION_FLAGS]

Arguments scn has invalid flags.

[ELF_E_INVALID_SECTION_TYPE]

Argument scn has invalid type.

[ELF_E_NOT_COMPRESSED]

Argument scn is not compressed.

Releases

Unchanged in 14 releases since FreeBSD 13.1-RELEASE.

  1. 13.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.