---
name: "gelf_update_rela"
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_rel"
---

# gelf\_update\_rela(3)

copy class-independent relocation entries into a relocation section

Part of [gelf\_update\_rel(3)](/gelf_update_rel/3.md).

## NAME

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

## 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

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

- *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*

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

- *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

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

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

## ATTRIBUTES

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

## REPORTING BUGS

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