Environment variables

Updated: May 06, 2022

The following environment variables affect the operation of the runtime linker:

Note: For security reasons, the runtime linker unsets DL_DEBUG, LD_DEBUG, LD_DEBUG_OUTPUT, LD_LIBRARY_PATH, and LD_PRELOAD if the binary has the setuid bit set.
DL_DEBUG
Display diagnostic messages. The value can be a comma-separated list of the following:
  • all — display all debug messages.
  • help — display a help message, and then exit.
  • reloc — display relocation processing messages.
  • libs — display information about shared objects being opened.
  • statistics — display runtime linker statistics.
  • lazyload — print lazy-load debug messages.
  • debug — print various runtime linker debug messages.

A value of 1 (one) is the same as all.

LD_BIND_NOW
Affects lazy-load dependencies due to full symbol resolution. Typically, it forces the loading of all lazy-load dependencies (until all symbols have been resolved).
LD_DEBUG
A synonym for DL_DEBUG; if you set both variables, DL_DEBUG takes precedence.
LD_DEBUG_OUTPUT
The name of a file in which the runtime linker writes its output. By default, output is written to stderr.
LD_LIBRARY_PATH
A colon-separated list of paths that the runtime linker uses to search for shared libraries.
LD_PRELOAD
A colon-separated list of full paths to the shared libraries on an ELF system that you want to load before loading other libraries. You can use this environment variable to add or change functionality when you run a program.
LD_TRAP_ON_ERROR
If this environment variable is set, the runtime linker faults instead of exiting on fatal errors, so that you can examine the core file that's generated.