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: Ian Lance Taylor <iant at google dot com>
- To: Cary Coutant <ccoutant at google dot com>
- Cc: Binutils <binutils at sourceware dot org>, Jan Hubicka <hubicka at ucw dot cz>, Diego Novillo <dnovillo at google dot com>
- Date: Thu, 15 Jul 2010 01:18:10 -0700
- Subject: Re: [gold][patch] Fix gold plugin: cleanup handler called too early
- References: <AANLkTikXOejwuNEY-qMEpLCD4xF3V5cBAjUxz-YbtAG8@mail.gmail.com>
Cary Coutant <ccoutant@google.com> writes:
> 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?
This is OK.
Thanks.
Ian