PATCH: PR ld/12289: Plugin's cleanup hook should be probably registered with xatexit()

H.J. Lu hongjiu.lu@intel.com
Mon Dec 6 05:39:00 GMT 2010


Hi,

I checked in this patch as an obvious fix to call plugin_call_cleanup on
fatal error.


H.J.
---
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 63858ee..55e320e 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,5 +1,11 @@
 2010-12-05  H.J. Lu  <hongjiu.lu@intel.com>
 
+	PR ld/12289
+	* plugin.c (message): Call plugin_call_cleanup on fatal
+	error.
+
+2010-12-05  H.J. Lu  <hongjiu.lu@intel.com>
+
 	* plugin.c (message): Add a space after `:' in error message.
 
 2010-12-05  H.J. Lu  <hongjiu.lu@intel.com>
diff --git a/ld/plugin.c b/ld/plugin.c
index 34d76bd..3d7809c 100644
--- a/ld/plugin.c
+++ b/ld/plugin.c
@@ -590,6 +590,9 @@ message (int level, const char *format, ...)
 	  char *newfmt = ACONCAT ((level == LDPL_FATAL
 				   ? "%P%F: " : "%P%X: ",
 				   format, "\n", NULL));
+	  if (plugin_call_cleanup ())
+	    info_msg (_("%P: %s: error in plugin cleanup (ignored)\n"),
+		      plugin_error_plugin ());
 	  vfinfo (stderr, newfmt, args, TRUE);
 	}
       break;



More information about the Binutils mailing list