---
name: "ld.hugetlbfs"
section: "1"
platform: "linux"
package: "libhugetlbfs-bin"
version: "2.24-1+b1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/ld.hugetlbfs"
---

# ld.hugetlbfs(1)

link a program for huge pages

## NAME

ld.hugetlbfs - link a program for huge pages

## SYNOPSIS

**ld.hugetlbfs \[options\]**

## DESCRIPTION

**ld.hugetlbfs** replaces the normal **ld** command for linking programs to use hugepages.  Under gcc, you should use the option **-B /usr/share/libhugetlbfs** which tells gcc to look in a non-standard location for the linker.  This could be set in the **CFLAGS** environment variable.

- **-Wl,--hugetlbfs-align**

  This method of linking an application permits greater flexibility at runtime. Using HUGETLB\_ELFMAP, it is possible to control which program segments are placed in hugepages.  The following four settings will cause the indicated segments to be placed in hugepages:

          HUGETLB\_ELFMAP=R        Read-only segments (text)\
           HUGETLB\_ELFMAP=W        Writable segments (data/BSS)\
           HUGETLB\_ELFMAP=RW       All segments (text/data/BSS)\
           HUGETLB\_ELFMAP=no       No segments

  It is possible to select specific huge page sizes for read-only and writable segments by using the following advanced syntax:

          HUGETLB\_ELFMAP=\[R\[=\<pagesize\>\]:\[W\[=\<pagesize\>\]\]

  **-Wl,--hugetlbfs-link=B**

  Under binutils 2.16 or older, this option will link the application to store BSS data (only) into hugepages.

  **-Wl,--hugetlbfs-link=BDT**

  Under binutils 2.16 or older, this option will link the application to store text, initialized data and BSS data into hugepages.

## FILES

\[DESTDIR\|/usr/share\]/doc/libhugetlbfs/HOWTO

## SEE ALSO

*[libhugetlbfs(7)](/libhugetlbfs/7.md),* *[hugectl(8)](/hugectl/8.md),* *[hugeedit(8)](/hugeedit/8.md)*\

## AUTHORS

libhugetlbfs was written by various people on the libhugetlbfs-devel mailing list.
