binutils Newspaper
NOVEMBER 30, 2026
binutils — Proposed

ld fails to build on hosts without dlfcn.h

Fixes ld build failure on systems lacking dlfcn.h by conditionally compiling plugin support.

This patch addresses a build failure in ld on systems that do not provide the <dlfcn.h> header, which is necessary for plugin support. The changes conditionally compile existing functions related to plugins and provide no-operation stubs when plugin support is unavailable. Additionally, it updates a test case to report “untested” instead of “fail” when plugin support is absent, differentiating between actual failures and lack of support.

In the Thread 1 participant
  1. Alan Modra <amodra@gmail.com> proposer

    Proposes changes to conditionally compile plugin functionality in ld and improve test suite reporting for systems without dlfcn.h.

    “ld/ * plugin.c: Wrap existing functions in #if BFD_SUPPORTS_PLUGINS. Provide do-nothin stubs for !BFD_SUPPORTS_PLUGINS. binutils/ * testsuite/binutils-all/x86-64/x86-64.exp (run_pr33198_test): Return "untested" rather than "fail" when no plugin support. Differentiate failure messages.”

In Details

This change modifies ld/plugin.c to conditionally compile plugin-related functions based on BFD_SUPPORTS_PLUGINS. When the header is unavailable, it provides stub functions. The testsuite in binutils/testsuite/binutils-all/x86-64/x86-64.exp is also updated to differentiate between test failures and environments lacking plugin support, avoiding incorrect failure reports.

Filed Under: buildldplugins