This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[gold patch RFC]: Release unused external member of thin archive
- From: Ian Lance Taylor <iant at google dot com>
- To: ccoutant at google dot com
- Cc: binutils at sourceware dot org
- Date: Mon, 12 Jul 2010 06:59:14 -0700
- Subject: [gold patch RFC]: Release unused external member of thin archive
Hi Cary, does this patch look correct to you? It explicitly unlocks an
external member of a thin archive if the member is not used. That
avoids locking up the descriptor and possibly eventually running out of
descriptors. I don't have a test case, but it seems like the right
thing. If this looks right to you, I'll commit it.
Ian
2010-07-12 Ian Lance Taylor <iant@google.com>
* archive.cc (Archive::include_member): Unlock an external member
of a thin archive. Don't bother to delete an object we know is
NULL.
? autom4te.cache
Index: archive.cc
===================================================================
RCS file: /cvs/src/src/gold/archive.cc,v
retrieving revision 1.53
diff -u -p -r1.53 archive.cc
--- archive.cc 7 Apr 2010 22:58:23 -0000 1.53
+++ archive.cc 12 Jul 2010 13:49:27 -0000
@@ -853,11 +853,7 @@ Archive::include_member(Symbol_table* sy
&& this->searched_for()
&& obj == NULL
&& unconfigured)
- {
- if (obj != NULL)
- delete obj;
- return false;
- }
+ return false;
if (obj == NULL)
return true;
@@ -874,7 +870,13 @@ Archive::include_member(Symbol_table* sy
}
if (!input_objects->add_object(obj))
- delete obj;
+ {
+ // If this is an external member of a thin archive, unlock the
+ // file.
+ if (obj->offset() == 0)
+ obj->unlock(this->task_);
+ delete obj;
+ }
else
{
{