This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Free linker hash table from bfd_close


>>>>> "Alan" == Alan Modra <amodra@gmail.com> 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.
See here:

    https://sourceware.org/ml/gdb-patches/2014-05/msg00294.html

... 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
more.

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).

thanks,
Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]