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

ld: Fix build on hosts without dlfcn.h

Binutils linker now builds correctly on systems lacking the dlfcn.h header.

This commit resolves an issue where the GNU linker (ld) failed to build on hosts that do not provide the <dlfcn.h> header. It conditionally compiles plugin-related code and provides stub functions when plugin support is not available, ensuring that ld can be built even in minimal environments. Test cases are also adjusted to reflect this change.

In Details

The ld linker's build process failed on systems without <dlfcn.h> because the plugin infrastructure code was not guarded by BFD_SUPPORTS_PLUGINS. This commit wraps the existing plugin functions in #if BFD_SUPPORTS_PLUGINS and provides no-op stubs when this macro is undefined. This allows ld to build on hosts lacking dlfcn.h. The test suite is also updated to mark relevant tests as 'untested' when plugin support is unavailable.

For Context
ld
The GNU linker, responsible for combining object files and libraries into an executable or shared library.
dlfcn.h
A C header file that provides an interface for dynamically loading and linking shared libraries at runtime.
BFD
Binutils Format Description. A library used by GNU Binutils to support various object file formats.
plugin
A modular piece of code that can be loaded at runtime to extend the functionality of a program, such as the linker.
Filed Under: binutilsldbuildplugins