diff options
author | Alan Modra <amodra@gmail.com> | 2011-02-14 09:53:15 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2011-02-14 09:53:15 +0000 |
commit | 498cd2a0fdc89ee9a81ce4ad0019d64a1f6dbcd7 (patch) | |
tree | caa0fbf2a0481739b0df9aa5df7f604f75ae4a6e /ld/ldmain.c | |
parent | 298c1ec2a052b71bd60c244f2c3f8c6367214af1 (diff) | |
download | gdb-498cd2a0fdc89ee9a81ce4ad0019d64a1f6dbcd7.zip gdb-498cd2a0fdc89ee9a81ce4ad0019d64a1f6dbcd7.tar.gz gdb-498cd2a0fdc89ee9a81ce4ad0019d64a1f6dbcd7.tar.bz2 |
* ldmain.c (remove_output): Rename to..
(ld_cleanup): ..this. Call bfd_cache_close_all and plugin_call_cleanup.
(main): Adjust.
* plugin.c (plugin_call_cleanup): Make global.
(plugin_load_plugins): Don't register plugin_call_cleanup with xatexit.
* plugin.h (plugin_call_cleanup): Declare.
Diffstat (limited to 'ld/ldmain.c')
-rw-r--r-- | ld/ldmain.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/ld/ldmain.c b/ld/ldmain.c index 19c42d9..6e86c3d 100644 --- a/ld/ldmain.c +++ b/ld/ldmain.c @@ -174,15 +174,14 @@ static struct bfd_link_callbacks link_callbacks = struct bfd_link_info link_info; static void -remove_output (void) +ld_cleanup (void) { - if (output_filename) - { - if (link_info.output_bfd) - bfd_cache_close (link_info.output_bfd); - if (delete_output_file_on_failure) - unlink_if_ordinary (output_filename); - } + bfd_cache_close_all (); +#ifdef ENABLE_PLUGINS + plugin_call_cleanup (); +#endif + if (output_filename && delete_output_file_on_failure) + unlink_if_ordinary (output_filename); } int @@ -211,7 +210,7 @@ main (int argc, char **argv) bfd_set_error_program_name (program_name); - xatexit (remove_output); + xatexit (ld_cleanup); /* Set up the sysroot directory. */ ld_sysroot = get_sysroot (argc, argv); |