[binutils-gdb] PR 34985, ld fails to build on hosts without <dlfcn.h>
Alan Modra
amodra@sourceware.org
Wed Nov 11 00:44:45 GMT 2026
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=2de4446d9090b5773c863ab7bbdd95a5d4f81367
commit 2de4446d9090b5773c863ab7bbdd95a5d4f81367
Author: Alan Modra <amodra@gmail.com>
Date: Wed Nov 11 10:36:44 2026 +1030
PR 34985, ld fails to build on hosts 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.
Diff:
---
binutils/testsuite/binutils-all/x86-64/x86-64.exp | 14 ++++---
ld/plugin.c | 51 +++++++++++++++++++++--
2 files changed, 56 insertions(+), 9 deletions(-)
diff --git a/binutils/testsuite/binutils-all/x86-64/x86-64.exp b/binutils/testsuite/binutils-all/x86-64/x86-64.exp
index bb187b5805f..dbeacdc1d47 100644
--- a/binutils/testsuite/binutils-all/x86-64/x86-64.exp
+++ b/binutils/testsuite/binutils-all/x86-64/x86-64.exp
@@ -147,7 +147,11 @@ proc run_pr33198_test { fat strip_flags } {
if ![regexp "0+ T foo" $got] then {
send_log "$got\n"
verbose "$got" 1
- fail "$testname ($obj)"
+ if [regexp ".* without plugin support" $got] then {
+ untested "$testname (nm $obj)"
+ } else {
+ fail "$testname (nm $obj)"
+ }
return
}
@@ -183,7 +187,7 @@ proc run_pr33198_test { fat strip_flags } {
if [regexp "\.llvm\.lto *LLVM_LTO *" $got] then {
send_log "$got\n"
verbose "$got" 1
- fail "$testname (strip $obj)"
+ fail "$testname (nm stripped $obj)"
return
}
}
@@ -208,7 +212,7 @@ proc run_pr33198_test { fat strip_flags } {
if ![regexp "0+ T foo" $got] then {
send_log "$got\n"
verbose "$got" 1
- fail "$testname ($archive)"
+ fail "$testname (nm $archive)"
return
}
@@ -232,7 +236,7 @@ proc run_pr33198_test { fat strip_flags } {
if ![regexp "0+ T foo" $got] then {
send_log "$got\n"
verbose "$got" 1
- fail "$testname (strip $archive)"
+ fail "$testname (nm strip $archive)"
return
}
@@ -244,7 +248,7 @@ proc run_pr33198_test { fat strip_flags } {
if [regexp "\.llvm\.lto *LLVM_LTO *" $got] then {
send_log "$got\n"
verbose "$got" 1
- fail "$testname (strip $archive)"
+ fail "$testname (readelf strip $archive)"
return
}
}
diff --git a/ld/plugin.c b/ld/plugin.c
index 30066b2a318..fb624b33fbe 100644
--- a/ld/plugin.c
+++ b/ld/plugin.c
@@ -59,6 +59,12 @@ extern int errno;
/* Report plugin symbols. */
bool report_plugin_symbols;
+/* Set at all symbols read time, to avoid recursively offering the plugin
+ its own newly-added input files and libs to claim. */
+bool no_more_claiming = false;
+
+#if BFD_SUPPORTS_PLUGINS
+
/* The suffix to append to the name of the real (claimed) object file
when generating a dummy BFD to hold the IR symbols sent from the
plugin. For cosmetic use only; appears in maps, crefs etc. */
@@ -141,10 +147,6 @@ static bool orig_notice_all;
static const struct bfd_link_callbacks *orig_callbacks;
static struct bfd_link_callbacks plugin_callbacks;
-/* Set at all symbols read time, to avoid recursively offering the plugin
- its own newly-added input files and libs to claim. */
-bool no_more_claiming = false;
-
#if HAVE_MMAP && HAVE_GETPAGESIZE
/* Page size used by mmap. */
static off_t plugin_pagesize;
@@ -1540,3 +1542,44 @@ plugin_notice (struct bfd_link_info *info,
abfd, section, value, flags);
return true;
}
+
+#else /* !BFD_SUPPORTS_PLUGINS */
+
+void
+plugin_opt_plugin (const char *plugin ATTRIBUTE_UNUSED)
+{
+}
+
+int
+plugin_opt_plugin_arg (const char *arg ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+void
+plugin_load_plugins (void)
+{
+}
+
+const char *
+plugin_error_plugin (void)
+{
+ return "";
+}
+
+void
+plugin_maybe_claim (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
+{
+}
+
+int
+plugin_call_all_symbols_read (void)
+{
+ return 0;
+}
+
+void
+plugin_call_cleanup (void)
+{
+}
+#endif /* !BFD_SUPPORTS_PLUGINS */
More information about the Binutils-cvs
mailing list