GELF\_GETLIB(3) Libelf Programmer's Manual GELF\_GETLIB(3)

# [NAME](#NAME)

gelf\_getlib - Get prelink library from table at the given index

# [SYNOPSIS](#SYNOPSIS)

```
#include <gelf.h>
GElf_Lib *gelf_getlib (Elf_Data *data, int ndx, GElf_Lib *dst);
```

# [DESCRIPTION](#DESCRIPTION)

Retrieve a prelink library table entry from *data* at index *ndx* and store it in the class-independent representation pointed to by *dst*.

*data* must be an **Elf\_Data\*** associated with a section of type **SHT\_GNU\_LIBLIST**. *data-&gt;d\_type* should be **ELF\_T\_LIB**. **SHT\_GNU\_LIBLIST** sections are used by the prelink utility. See https://sourceware.org/gnu-gabi/prelink.txt for more information.

# [PARAMETERS](#PARAMETERS)

[*data*](#data)

Pointer to an **Elf\_Data** of a section with type **SHT\_GNU\_LIBLIST**. *data-&gt;d\_type* should be **ELF\_T\_LIB**.

[*ndx*](#ndx)

Zero-based index of the requested prelink library table entry within *data*.

[*dst*](#dst)

Pointer to a caller-provided **GElf\_Lib** structure for storing the requested prelink library table entry. Must not be NULL.

# [RETURN VALUE](#RETURN_VALUE)

On success, this function updates *dst* with the requested prelink library table entry and returns *dst*. On failure, it returns NULL and sets elf\_errno. If *data* is NULL, then NULL is returned without setting elf\_errno.

# [SEE ALSO](#SEE_ALSO)

[**gelf\_update\_lib**(3)](/man/os/elfutils/gelf_update_lib.3), [**libelf**(3)](/man/os/elfutils/libelf.3), [**elf**(5)](/man/os/elfutils/elf.5)

# [ATTRIBUTES](#ATTRIBUTES)

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

# [REPORTING BUGS](#REPORTING_BUGS)

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

# [HISTORY](#HISTORY)

**gelf\_getlib** first appeared in elfutils 0.95. This function is an elfutils libelf extension and may not be available in other libelf implementations.

2025-12-31 Libelf

---

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