---
name: "gelf_update_shdr"
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_update_shdr"
---

# gelf\_update\_shdr(3)

copy a class-independent section header into a section descriptor

## NAME

gelf\_update\_shdr - copy a class-independent section header into a section descriptor

## SYNOPSIS

```
#include <gelf.h>
int gelf_update_shdr(Elf_Scn *scn, GElf_Shdr *src);
```

## DESCRIPTION

**gelf\_update\_shdr**() copies the class-independent section header referenced by *src* into the section descriptor *scn*. The section header is translated as necessary to match the class ( **ELFCLASS32** or **ELFCLASS64**) of the underlying ELF object.  If the underlying ELF object has class **ELFCLASS32** then the struct members of *src* must fit into 32-bit field values.

## PARAMETERS

- *scn*

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

- *src*

  Pointer to a **GElf\_Shdr** structure containing the caller’s desired section header contents.

## RETURN VALUE

On success, **gelf\_update\_shdr**() returns a non-zero value and marks *scn* with the **ELF\_F\_DIRTY** flag.  On failure, this function returns 0 and elf\_errno is set. If *scn* or *src* are NULL, then 0 is returned without setting elf\_errno.

## SEE ALSO

[**gelf\_getshdr**(3)](/gelf_getshdr/3.md), [**elf\_getscn**(3)](/elf_getscn/3.md), [**elf\_nextscn**(3)](/elf_nextscn/3.md), [**libelf**(3)](/libelf/3.md), [**elf**(5)](/elf/5.md)

## ATTRIBUTES

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

## REPORTING BUGS

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