This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [patch ld]: Close BFDs before linker-plugin's atexit routine is called
- From: Alan Modra <amodra at gmail dot com>
- To: Kai Tietz <ktietz70 at googlemail dot com>
- Cc: Binutils <binutils at sourceware dot org>, Nick Clifton <nickc at redhat dot com>
- Date: Mon, 14 Feb 2011 09:55:28 +1030
- Subject: Re: [patch ld]: Close BFDs before linker-plugin's atexit routine is called
- References: <AANLkTimiNR+jQg2Hn5RfRuzp-uyF0xpvvHM+SmS_0=xv@mail.gmail.com>
On Wed, Feb 09, 2011 at 07:51:58PM +0100, Kai Tietz wrote:
> Hello,
>
> This is patch addresses the unlink call when lto linker-plugin is
> used. As windows
> native doesn't support to unlink still opened files, it fails to do so
> as file-descriptors
> of bfds aren't closed before atexit routine of plugin gets called.
>
> 2011-02-09 Kai Tietz
>
> * ldmain.c (remove_output): Set output_bfd
> of link_info to nil and close all cached bfds.
> (main): Close output_bfd of link_info and set
> it to nil. Additionally close all cached bfds.
The fact that you need to patch three places to fix one problem
says to me that this isn't the best fix.. Does a single
bfd_cache_close_all at the start of plugin_call_cleanup fix your
problem?
--
Alan Modra
Australia Development Lab, IBM