This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gold][patch] Fix gold plugin: cleanup handler called too early


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]