This is the mail archive of the
mailing list for the binutils project.
Re: Free linker hash table from bfd_close
- From: Tom Tromey <tromey at redhat dot com>
- To: binutils at sourceware dot org
- Date: Wed, 18 Jun 2014 14:54:55 -0600
- Subject: Re: Free linker hash table from bfd_close
- Authentication-results: sourceware.org; auth=none
- References: <20140613095201 dot GH7683 at bubble dot grove dot modra dot org>
>>>>> "Alan" == Alan Modra <firstname.lastname@example.org> writes:
Alan> Also tidies numerous error exit paths in various link_hash_table_create
Alan> functions that failed to free memory.
Alan> * simple.c (bfd_simple_get_relocated_section_contents): Save and
Alan> clear link.next before creating linker hash table. Clean up on
Alan> errors, and restore link.next on exit.
We needed a variant of this code in our patches to reuse gcc from gdb.
... in particular in gdb/compile/compile-object-load.c.
After rebasing our branch didn't compile, because
bfd_link_hash_table_free and bfd_link_hash_table_create don't exist any
I worked around it for now by calling the _bfd_generic variants. This
is ugly, though, since presumably those functions are given the leading
underscore to indicate that they are private to BFD.
I was hoping you have some suggestion for how we could do this more
cleanly. I could rename and export those functions. Or maybe I could
introduce a variant of bfd_simple_get_relocated_section_contents that
works a bit better for our purposes (I didn't investigate this but I
guess at least a bfd_link_callbacks argument would be required).