GELF\_UPDATE\_SHDR(3) Libelf Programmer's Manual GELF\_UPDATE\_SHDR(3)

# [NAME](#NAME)

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

# [SYNOPSIS](#SYNOPSIS)

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

# [DESCRIPTION](#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](#PARAMETERS)

[*scn*](#scn)

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

[*src*](#src)

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

# [RETURN VALUE](#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](#SEE_ALSO)

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

# [ATTRIBUTES](#ATTRIBUTES)

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

# [REPORTING BUGS](#REPORTING_BUGS)

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

2025-09-23 Libelf

---

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