who owns a BFD coming from an archive?
Alan Modra
amodra@gmail.com
Wed Aug 1 08:03:00 GMT 2012
More information about the Binutils mailing list
Wed Aug 1 08:03:00 GMT 2012
- Previous message (by thread): [PATCH, MIPS] Add 34Kn cpu
- Next message (by thread): who owns a BFD coming from an archive?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Mon, Jul 23, 2012 at 02:11:33PM -0600, Tom Tromey wrote:
> * For a thin archive, again according to valgrind and my reading, the
> opposite is true: the archive owns the BFDs, and if you close each
> one, you will see crashes.
Thin archives support nesting. I think the BFDs opened to access
nested archives are owned by the archive, BFDs returned for objects
are owned by you. However it is all quite nasty due to the archive
cache. Some binutils and ld don't bother with closing archive member
BFDs, trusting that when the process exits all sins will be forgiven.
See for example this comment in ld/plugin.c
/* BFD archive handling caches elements so we can't call
bfd_close for archives. */
I think you'll see crashes due to the cache with normal archives too,
eg. call get_elt_at_index, close the returned bfd, then call
get_elt_at_index with the same position again. You can also easily
crash with openr_next_archived_file if you close the current member
bfd before opening the next one..
--
Alan Modra
Australia Development Lab, IBM
- Previous message (by thread): [PATCH, MIPS] Add 34Kn cpu
- Next message (by thread): who owns a BFD coming from an archive?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list