Two memory management questions in BFD - link hash tables

Daniel Jacobowitz drow@mvista.com
Sat Mar 30 20:02:00 GMT 2002


With a little prod from Alan in the right direction, I've almost got GDB
relocating debug info on demand now.  There's only one big problem
remaining... how to clean up afterwards.

In order to do this without poking around in bfd innards too much, I have to
use this sequence:
  - create a dummy link info
  - create a dummy hash table in the link info
  - create a dummy link order
  - set up all the needed output sections
  - call bfd_canonicalize_symtab to get a list of symbols
  - call bfd_get_relocated_section_contents

The problem is, there's no way to get rid of the hash table!  It's
bfd_alloc'd, and bfd_release is private to BFD.  I'm not sure I want to
violate that.

In addition, while I was doing this I noticed that a good chunk of the
bfd_link_hash_table_create implementations call free() rather than
bfd_release on error.  If the hash table really should be bfd_alloc'd, I'll
fix those - but it might be preferable to bfd_malloc it instead.

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer



More information about the Binutils mailing list