This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH mingw/gold] Plugins cleanup fails on windows due to open handle
On Mon, Feb 11, 2013 at 2:11 AM, Pavel Chupin <pavel.v.chupin@gmail.com> wrote:
> On Sat, Feb 9, 2013 at 5:56 AM, Ian Lance Taylor <iant@google.com> wrote:
>> On Sun, Jan 20, 2013 at 1:08 AM, Pavel Chupin <pavel.v.chupin@gmail.com> wrote:
>>>
>>> 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
>>> needed.
>>
>> Sorry for the slow review. This approach does not look to me like a
>> good idea. It will force additional unnecessary file reopens in all
>> cases. You only care about input files added by the plugin, and you
>> only care about them at the end of the link.
>>
>> Does this patch fix the problem?
>>
>> Ian
>
> Hi Ian,
> Yes, it does fix the problem. Thanks a lot.
Thanks for testing it. Committed with this ChangeLog entry.
2013-02-11 Ian Lance Taylor <iant@google.com>
* descriptors.cc (Descriptors::close_all): New function.
* descriptors.h (class Descriptors): Declare close_all.
(close_all_descriptors): New inline function.
* plugin.cc: Include "descriptors.h".
(Plugin_manager::cleanup): Call close_all_descriptors.
Ian