### 37.2 Dynamic Linker Environment Variables ¶

The behavior of the dynamic linker can be modified through various environment variables.

`LD_DEBUG` ¶

  The `LD_DEBUG` environment variable can be set to a comma-separated list of keywords to enable debugging output from the dynamic linker. Setting it to `help` will display a list of all available keywords. The output is written to standard output by default.

  `libs`

    Display library search paths.

  `reloc`

    Display relocation processing.

  `files`

    Display progress for input file processing.

  `symbols`

    Display symbol table processing.

  `bindings`

    Display information about symbol binding.

  `versions`

    Display version dependencies.

  `scopes`

    Display scope information.

  `tls`

    Display information about Thread-Local Storage (TLS) handling, including TCB allocation, deallocation, and reuse. This is useful for debugging issues related to thread creation and lifecycle.

  `security`

    Display security warnings that are related to loading binaries that lack certain target-dependent hardening features. This may be useful for audit purposes.

  `all`

    All previous options combined.

  `statistics`

    Display relocation statistics.

  `unused`

    Determined unused DSOs.

  `help`

    Display a help message with all available options and exit.

`LD_DEBUG_OUTPUT` ¶

  If `LD_DEBUG` is set, the output is written to standard output by default. If `LD_DEBUG_OUTPUT` is set, the output is written to the file specified by its value, with the process ID appended. For example, if `LD_DEBUG_OUTPUT` is set to `/tmp/glibc.debug`, the output will be written to a file named `/tmp/glibc.debug.12345`, where `12345` is the process ID.