binutils Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
ld

ld build failure on hosts without dlfcn.h fixed

ld now builds on systems lacking dlfcn.h by providing stub functions for plugin support.

This change addresses a build failure in ld that occurred on hosts without the dlfcn.h header, which is necessary for plugin support. The linker now wraps existing plugin functions in a conditional check for BFD_SUPPORTS_PLUGINS and provides do-nothing stubs when plugins are not supported. Additionally, the testsuite was updated to correctly report untested cases instead of outright failures when plugin support is absent.

In Details

ld's plugin infrastructure relies on dlfcn.h for dynamic loading. On systems without this header, compilation failed. This commit introduces conditional compilation around plugin-related functions in ld/plugin.c, ensuring that ld can be built even without dlfcn.h by providing stub implementations when BFD_SUPPORTS_PLUGINS is not defined. This maintains buildability on a wider range of host configurations.

For Context
ld
The GNU linker, responsible for combining object files and libraries into an executable or shared library.
dlfcn.h
A POSIX header file that defines the interface for dynamic loading of shared libraries. It's not available on all systems.
BFD_SUPPORTS_PLUGINS
A preprocessor macro used within the BFD library to conditionally compile code related to its plugin system.
stub function
A placeholder function that performs a minimal or no operation, often used to satisfy linking requirements when the actual functionality is not present or not needed.
Filed Under: ldbuildplugins