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 mingw/gold] Plugins cleanup fails on windows due to open handle

Attached patch fixes issue with gold on windows:

ld.exe: fatal error: could not unlink output file
collect2.exe: error: ld returned 1 exit status

It happens on any gold link (successful or not) with plugins when
plugins->cleanup() called on gold_exit() tries to remove temporary
files (cc2lB8c4.ltrans0.ltrans.o) but handle is still opened.
I'm fixing it via new property close_on_release which can be setup per
each descriptor and therefore control any descriptor release if


2013-01-20  Pavel Chupin  <>

        Enforce descriptor close on release when plugins used
        * Enforce close for plugins.
        * descriptors.h: Add close_on_release descriptor property.

Alternative simpler fix could be made to always call
release_descriptor with permanent=true. E.g. this patch fixes the
problem as well:

--- a/gold/
+++ b/gold/
@@ -280,7 +280,7 @@ File_read::release()
       if (this->is_descriptor_opened_)
-         release_descriptor(this->descriptor_, false);
+         release_descriptor(this->descriptor_, true);
          this->is_descriptor_opened_ = false;

Pavel Chupin
Intel Corporation

Attachment: gold-plugins-close-handle.patch
Description: Binary data

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