public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Kai Tietz <ktietz70@googlemail.com>
To: Kai Tietz <ktietz70@googlemail.com>,
	Binutils <binutils@sourceware.org>,
		Nick Clifton <nickc@redhat.com>
Subject: Re: [patch ld]: Close BFDs before linker-plugin's atexit routine is called
Date: Mon, 14 Feb 2011 06:45:00 -0000	[thread overview]
Message-ID: <AANLkTinnQYxK25wU_hF8TMTuSUw+sBCtk-yDySVju4Gd@mail.gmail.com> (raw)
In-Reply-To: <20110213232528.GQ7651@bubble.grove.modra.org>

2011/2/14 Alan Modra <amodra@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.

Hi Alan,

> The fact that you need to patch three places to fix one problem
> says to me that this isn't the best fix..
Well, here I am not that sure about. I thought about fixing it just
within the atexit-handler of plugin, but well, next one trying to
opearate on files in a similar way, will have the same issues again. I
think it is simply bad style to exit a program without even try to
cleanup  opened file descriptors and used memory. This could even help
to use tools like valgrind on ld ...

>  Does a single
> bfd_cache_close_all at the start of plugin_call_cleanup fix your
> problem?
Yes, it does.

Regards,
Kai

  reply	other threads:[~2011-02-14  6:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-09 18:52 Kai Tietz
2011-02-13 10:40 ` Kai Tietz
2011-02-13 23:25 ` Alan Modra
2011-02-14  6:45   ` Kai Tietz [this message]
2011-02-14  9:22     ` Kai Tietz
2011-02-14  9:51       ` Alan Modra
2011-02-14 10:01         ` Kai Tietz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTinnQYxK25wU_hF8TMTuSUw+sBCtk-yDySVju4Gd@mail.gmail.com \
    --to=ktietz70@googlemail.com \
    --cc=binutils@sourceware.org \
    --cc=nickc@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).