[gold][patch] Fix gold plugin: cleanup handler called too early
Cary Coutant
ccoutant@google.com
Wed Jul 14 22:37:00 GMT 2010
More information about the Binutils mailing list
Wed Jul 14 22:37:00 GMT 2010
- Previous message (by thread): PATCH: Add addr2line, objcopy and strip tests for compressed debug sections
- Next message (by thread): [gold][patch] Fix gold plugin: cleanup handler called too early
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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?
-cary
diff -u -p -r1.35 plugin.cc
--- plugin.cc 28 Jun 2010 21:03:49 -0000 1.35
+++ plugin.cc 14 Jul 2010 22:19:47 -0000
@@ -862,7 +862,10 @@ Sized_pluginobj<size, big_endian>::do_ge
}
// Class Plugin_finish. This task runs after all replacement files have
-// been added. It calls each plugin's cleanup handler.
+// been added. For now, it's a placeholder for a possible plugin API
+// to allow the plugin to release most of its resources. The cleanup
+// handlers must be called later, because they can remove the temporary
+// object files that are needed until the end of the link.
class Plugin_finish : public Task
{
@@ -892,9 +895,7 @@ class Plugin_finish : public Task
void
run(Workqueue*)
{
- Plugin_manager* plugins = parameters->options().plugins();
- gold_assert(plugins != NULL);
- plugins->cleanup();
+ // We could call early cleanup handlers here.
}
std::string
- Previous message (by thread): PATCH: Add addr2line, objcopy and strip tests for compressed debug sections
- Next message (by thread): [gold][patch] Fix gold plugin: cleanup handler called too early
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list