This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [rfa] Add the bfd_iovec
- From: Aldy Hernandez <aldyh at redhat dot com>
- To: Andrew Cagney <cagney at gnu dot org>
- Cc: binutils at sources dot redhat dot com
- Date: 22 Apr 2004 08:34:41 -0400
- Subject: Re: [rfa] Add the bfd_iovec
- References: <407AC9D8.9040906@gnu.org> <4086AB17.50803@gnu.org>
Hi Andrew.
The patch below breaks powerpc-eabispe.
I found this out while building gcc on a combined tree with binutils
from CVS.
A call to "ar" while building libgcc core dumps because
bfd_cache_delete() is called with an "abfd" whose iostream field is
NULL. When abfd->iostream is dereferenced and passed to fclose(),
fclose complains very loudly. Here:
270 static bfd_boolean
271 bfd_cache_delete (bfd *abfd)
272 {
273 bfd_boolean ret;
274
275 if (fclose ((FILE *) abfd->iostream) == 0) <-- boo hiss
276 ret = TRUE;
You can reproduce by building GCC with:
--target=powerpc-eabispe
Cheers.
Aldy
> I've now checked this in. For reference I've attached the final version.
> Andrew
> 2004-04-21 Andrew Cagney <cagney@redhat.com>
> * opncls.c (_bfd_new_bfd_contained_in): Copy "iovec".
> (struct opncls, opncls_btell, opncls_bseek, opncls_bread)
> (opncls_bwrite, opncls_bclose, opncls_bflush)
> (opncls_bstat, opncls_iovec, bfd_openr_iovec): Implement a
> bfd iovec that uses function callbacks.
> (bfd_close): Use the iovec's bclose.
> * cache.c (cache_btell, cache_bseek, cache_bread, cache_bwrite)
> (cache_bclose, cache_bflush, cache_bstat)
> (cache_iovec): New functions and global variable, implement a
> cache "iovec", where applicable set bfd_error.
> (bfd_cache_init, bfd_cache_close): Set/test the bfd's iovec.
> * bfdio.c (struct bfd_iovec): Define.
> (real_read): Delete function.
> (bfd_bread, bfd_bread, bfd_bwrite, bfd_tell, bfd_flush, bfd_stat)
> (bfd_seek, bfd_get_mtime, bfd_get_size): Use the bfd's "iovec",
> assume that bread and bwrite set bfd_error.
> * bfd.c (struct bfd): Add "iovec", update comments.
> * bfd-in2.h, libbfd.h: Re-generate.