This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PATCH: Call set_plugin_error with dlerror ()
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: binutils at sourceware dot org
- Date: Wed, 21 Nov 2012 17:41:11 -0800
- Subject: PATCH: Call set_plugin_error with dlerror ()
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
Hi,
This patch changes linker error message from:
[hjl@gnu-mic-2 asan-1]$
/export/build/gnu/gcc-asan/build-x86_64-linux/gcc/xgcc -B/export/build/gnu/gcc-asan/build-x86_64-linux/gcc/ -flto -o x x.o
/usr/local/x86_64-unknown-linux-gnu/bin/ld: /export/build/gnu/gcc-asan/build-x86_64-linux/gcc/liblto_plugin.so: error in plugin cleanup (ignored)
/usr/local/x86_64-unknown-linux-gnu/bin/ld: /export/build/gnu/gcc-asan/build-x86_64-linux/gcc/liblto_plugin.so: error loading plugin
collect2: error: ld returned 1 exit status
[hjl@gnu-mic-2 asan-1]$
to
/export/home/hjl/bugs/gcc/asan-1/ld: /export/build/gnu/gcc-asan/build-x86_64-linux/gcc/liblto_plugin.so: undefined symbol: __asan_report_load8: error loading plugin
/export/home/hjl/bugs/gcc/asan-1/ld: /export/build/gnu/gcc-asan/build-x86_64-linux/gcc/liblto_plugin.so: undefined symbol: __asan_report_load8: error in plugin cleanup (ignored)
OK to install?
Thanks.
H.J.
---
2012-11-21 H.J. Lu <hongjiu.lu@intel.com>
* plugin.c (dlerror): New.
(plugin_opt_plugin): Call set_plugin_error with dlerror ().
diff --git a/ld/plugin.c b/ld/plugin.c
index 8902ef4..5b32660 100644
--- a/ld/plugin.c
+++ b/ld/plugin.c
@@ -153,6 +153,12 @@ dlclose (void *handle)
return 0;
}
+static const char *
+dlerror (void)
+{
+ return "Unable to load DLL.";
+}
+
#endif /* !defined (HAVE_DLFCN_H) && defined (HAVE_WINDOWS_H) */
/* Helper function for exiting with error status. */
@@ -188,7 +194,7 @@ plugin_opt_plugin (const char *plugin)
newplug->name = plugin;
newplug->dlhandle = dlopen (plugin, RTLD_NOW);
if (!newplug->dlhandle)
- return set_plugin_error (plugin);
+ return set_plugin_error (dlerror ());
/* Chain on end, so when we run list it is in command-line order. */
*plugins_tail_chain_ptr = newplug;