PATCH: Call set_plugin_error with dlerror ()

H.J. Lu hongjiu.lu@intel.com
Thu Nov 22 01:41:00 GMT 2012


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;



More information about the Binutils mailing list