From d36e3a3f20e5a7ba8301a4f3e5f84b3c2fda1336 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 18 Jun 2014 09:51:10 +0930 Subject: [PATCH] Don't free linker hash table PR 17047 * ldlang.c (lang_finish): Don't free linker hash table. --- ld/ChangeLog | 5 +++++ ld/ldlang.c | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/ld/ChangeLog b/ld/ChangeLog index a6e8d3c7c3b..a8e4db6111e 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,8 @@ +2014-06-18 Alan Modra + + PR 17047 + * ldlang.c (lang_finish): Don't free linker hash table. + 2014-06-17 Alan Modra * scripttempl/elf.sc: Edit out __rela_iplt symbol assignments from diff --git a/ld/ldlang.c b/ld/ldlang.c index ba7f493bee1..9121aa2757a 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -1238,7 +1238,14 @@ lang_init (void) void lang_finish (void) { + /* Some targets require access to the linker hash table during the + _bfd_write_contents call in bfd_close, so it can't be freed + before bfd_close. It can't be freed after bfd_close either, + since bfd_alloc memory holding side data structures disappears + (PR17047). So don't free it. + bfd_link_hash_table_free (link_info.output_bfd, link_info.hash); + */ bfd_hash_table_free (&lang_definedness_table); output_section_statement_table_free (); } -- 2.47.3