This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [gold][patch] Fix gold plugin: cleanup handler called too early
- From: Rafael Espindola <espindola at google dot com>
- To: Cary Coutant <ccoutant at google dot com>
- Cc: Binutils <binutils at sourceware dot org>, Ian Lance Taylor <iant at google dot com>, Jan Hubicka <hubicka at ucw dot cz>, Diego Novillo <dnovillo at google dot com>, nlewycky at google dot com
- Date: Wed, 14 Jul 2010 19:06:31 -0400
- Subject: Re: [gold][patch] Fix gold plugin: cleanup handler called too early
- References: <AANLkTikXOejwuNEY-qMEpLCD4xF3V5cBAjUxz-YbtAG8@mail.gmail.com>
On 14 July 2010 18:37, Cary Coutant <ccoutant@google.com> wrote:
> This patch fixes a gold plugin problem where the plugin's cleanup
> handler is called too early. Gold calls the cleanup handler as soon as
> it has received all of the replacement files, but before it begins
> writing the output file. The goal was to let the plugin release its
> resources as soon as possible so that gold would have more memory
> available during the output phase, but the plugin also removes its
> temp files at cleanup time, and gold still needs them. Normally, gold
> has open file descriptors for them, so the early removal isn't a
> problem, but when gold runs low on file descriptors, it will close
> some and try to reopen them later. If that happens, the
> plugin-generated temp files can't be reopened.
>
> This patch simply removes the call to the plugin's cleanup handler
> from the Plugin_finish task. We still do plugin cleanup from gold_exit
> if it hasn't already been done, so this moves the cleanup from the end
> of the input phase to the end of the link.
>
> I could have removed the Plugin_finish class and corresponding task
> entirely, but its presence simplifies the management of task blockers,
> and it can serve as a place where we can add a future early-cleanup
> hook that would let the plugin release as much memory as it can.
>
> OK?
I think this is OK, since it is just putting less restrictions on an
existing API. The plugin can already cleanup most of its intermediate
state after adding the final objects to the link, since it knows that
that is the last thing it will do before the cleanup proper.
> -cary
Cheers,
--
Rafael Ãvila de EspÃndola