This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [RFA:] fix linker deallocation bug: link_info.hash deallocated too soon
- From: Alan Modra <amodra at gmail dot com>
- To: Hans-Peter Nilsson <hp at bitrange dot com>
- Cc: binutils at sourceware dot org
- Date: Fri, 9 May 2014 12:36:44 +0930
- Subject: Re: [RFA:] fix linker deallocation bug: link_info.hash deallocated too soon
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot BSF dot 2 dot 02 dot 1405080724020 dot 68053 at arjuna dot pair dot com>
On Thu, May 08, 2014 at 07:27:02AM -0400, Hans-Peter Nilsson wrote:
> At first I tried plainly moving the bfd_link_hash_table_free call into
> ld_cleanup, but valgrind alerted me that bfd_link_hash_table_free
> needs to deference the (deallocated) output_bfd. The hash_table_free
> function is "virtual"; it needs to dereference the BFD xvec "vtable".
I think it still makes sense to use ld_cleanup, simply to avoid
another atexit function. Also, set output_bfd_hash_table_free_fn
in open_output, after the hash table is created. The patch is OK with
those changes.
--
Alan Modra
Australia Development Lab, IBM