This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: Call set_plugin_error with dlerror ()


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/ error in plugin cleanup (ignored)
/usr/local/x86_64-unknown-linux-gnu/bin/ld: /export/build/gnu/gcc-asan/build-x86_64-linux/gcc/ error loading plugin
collect2: error: ld returned 1 exit status
[hjl@gnu-mic-2 asan-1]$ 


/export/home/hjl/bugs/gcc/asan-1/ld: /export/build/gnu/gcc-asan/build-x86_64-linux/gcc/ 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/ undefined symbol: __asan_report_load8: error in plugin cleanup (ignored)

OK to install?


2012-11-21  H.J. Lu  <>

	* 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;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]