This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
PATH: Restore file cache for bfd_openr
- From: Mark Mitchell <mark at codesourcery dot com>
- To: binutils at sources dot redhat dot com
- Date: Wed, 8 Jun 2005 15:43:21 -0700
- Subject: PATH: Restore file cache for bfd_openr
- Reply-to: mark at codesourcery dot com
PR 996 is a problem caused by my recent patch to bfd_openr.
Unbeknownst to me, bfd_openr set the cacheable flag on BFDs it
created, while bfd_fdopenr did not. When I made them share common
code, I made all BFDs created by either function non-cacheable.
This patch restores the caching behavior in bfd_openr. I tested it
with the binutils testsuite and also by running strace with and
without the patch, and checking that indeed old object files were
being closed when using the patch, but were not closed without the
patch.
OK to apply?
--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
2005-06-08 Mark Mitchell <mark@codesourcery.com>
* opncls.c (bfd_openr): Call bfd_set_cacheable on returned BFDs.
Index: opncls.c
===================================================================
RCS file: /cvs/src/src/bfd/opncls.c,v
retrieving revision 1.37
diff -c -5 -p -r1.37 opncls.c
*** opncls.c 8 Jun 2005 03:51:32 -0000 1.37
--- opncls.c 8 Jun 2005 22:35:41 -0000
*************** DESCRIPTION
*** 222,232 ****
*/
bfd *
bfd_openr (const char *filename, const char *target)
{
! return bfd_fopen (filename, target, FOPEN_RB, -1);
}
/* Don't try to `optimize' this function:
o - We lock using stack space so that interrupting the locking
--- 222,236 ----
*/
bfd *
bfd_openr (const char *filename, const char *target)
{
! bfd *nbfd;
! nbfd = bfd_fopen (filename, target, FOPEN_RB, -1);
! if (nbfd)
! bfd_set_cacheable (nbfd, TRUE);
! return nbfd;
}
/* Don't try to `optimize' this function:
o - We lock using stack space so that interrupting the locking