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

# [NAME](#NAME)

gelf\_update\_rel, gelf\_update\_rela - copy class-independent relocation entries into a relocation section

# [SYNOPSIS](#SYNOPSIS)

```
#include <gelf.h>
int gelf_update_rel (Elf_Data *data, int ndx, GElf_Rel  *src);
int gelf_update_rela(Elf_Data *data, int ndx, GElf_Rela *src);
```

# [DESCRIPTION](#DESCRIPTION)

The **gelf\_update\_rel**() and **gelf\_update\_rela**() functions copy a class-independent REL or RELA relocation entry from *\*src* into the SHT\_REL or SHT\_RELA section associated with *data* at entry index *ndx*.

# [PARAMETERS](#PARAMETERS)

[*data*](#data)

**Elf\_Data** for a relocation section. The section must have sh\_type **SHT\_REL** for **gelf\_update\_rel**() or **SHT\_RELA** for **gelf\_update\_rela**().

[*ndx*](#ndx)

Zero-based index of the relocation entry within *data*.

[*src*](#src)

Pointer to the caller-provided source entry: **GElf\_Rel** for **gelf\_update\_rel**() and **GElf\_Rela** for **gelf\_update\_rela**(). *src* must not be NULL.

For **ELFCLASS32** binaries, *r\_offset* should fit in unsigned 32 bits. *r\_addend* should fit in signed 32 bits. The **GELF\_R\_SYM** component of *r\_info* should fit in 24 bits and the **GELF\_R\_TYPE** component should fit in 8 bits.

# [RETURN VALUE](#RETURN_VALUE)

On success, **gelf\_update\_rel**() and **gelf\_update\_rela**() copy *src* into *data*, flag the corresponding section with **ELF\_F\_DIRTY** and return a non-zero value. On failure, these functions return 0 and set elf\_errno. If *src* is NULL, then 0 is returned without setting elf\_errno.

# [SEE ALSO](#SEE_ALSO)

[**gelf\_getrel**(3)](/man/os/elfutils/gelf_getrel.3), [**gelf\_getrela**(3)](/man/os/elfutils/gelf_getrela.3), [**libelf**(3)](/man/os/elfutils/libelf.3), [**elf**(5)](/man/os/elfutils/elf.5)

# [ATTRIBUTES](#ATTRIBUTES)

**Interface** **Attribute** **Value** gelf\_update\_rel (), gelf\_update\_rela () Thread safety MT-Safe

# [REPORTING BUGS](#REPORTING_BUGS)

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

2025-09-27 Libelf

---

Document: gelf_update_rel(3) from elfutils 0.197-r0 (Chainguard OS)
Source: https://sourceware.org/git/elfutils.git
