summaryrefslogtreecommitdiff
path: root/gold/descriptors.cc
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2009-01-15 01:29:25 +0000
committerCary Coutant <ccoutant@google.com>2009-01-15 01:29:25 +0000
commit0f7c0701ba26bd4c94e968f6be5c954819c97f81 (patch)
tree3ffcaaf955c71edad7e9d7b1965894a3e5e3d722 /gold/descriptors.cc
parentfa7f3e72292434483fbce576f8613a1af727df6c (diff)
downloadbinutils-gdb-0f7c0701ba26bd4c94e968f6be5c954819c97f81.tar.gz
* archive.cc (Archive::get_elf_object_for_member): Remove call
to File_read::claim_for_plugin. * descriptors.cc (Descriptors::open): Remove reference to is_claimed. (Descriptors::claim_for_plugin): Remove. * descriptors.h (Descriptors::claim_for_plugin): Remove. (Descriptors::is_claimed): Remove. (claim_descriptor_for_plugin): Remove. * fileread.cc (File_read::claim_for_plugin): Remove. * fileread.h (File_read::claim_for_plugin): Remove. (File_read::descriptor): Reopen descriptor if necessary. * plugin.cc (Plugin::load): Add two new APIs to transfer vector. (Plugin_manager::all_symbols_read): Add task parameter. Change all callers. (Plugin_manager::get_input_file): New function. (Plugin_manager::release_input_file): New function. (Pluginobj::Pluginobj): Add filesize parameter and initialize corresponding data member. (Sized_pluginobj::Sized_pluginobj): Add filesize parameter and pass to base constructor. Change all callers. (get_input_file, release_input_file): New functions. (make_sized_plugin_object): Add filesize parameter. Change all callers. * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member. (Plugin_manager::all_symbols_read): Add task parameter. (Plugin_manager::get_input_file): New function. (Plugin_manager::release_input_file): New function. (Plugin_manager::task_): New data member. (Pluginobj::Pluginobj): Add filesize parameter. (Pluginobj::filename): New function. (Pluginobj::descriptor): New function. (Pluginobj::filesize): New function. (Pluginobj::filesize_): New data member. (Sized_pluginobj::Sized_pluginobj): Add filesize parameter. * readsyms.cc (Read_symbols::do_read_symbols): Remove call to File_read::claim_for_plugin; use Object::unlock to unlock the file. * testsuite/Makefile.am (plugin_test_4): New test case for plugins with archive libraries. * testsuite/Makefile.in: Regenerate. * testsuite/plugin_test.c (struct sym_info): New type. (get_input_file, release_input_file): New static variables. (onload): Capture new transfer vector entries. (claim_file_hook): Stop reading at end of file according to filesize. Factor out parsing of readelf output into separate function. (all_symbols_read_hook): Exercise get_input_file and release_input_file APIs and get the source file name from the symbol table. Convert source file name to corresponding object file name. Print info message when adding new input files. (parse_readelf_line): New function. * testsuite/plugin_test_1.sh: Add checks for new info messages. * testsuite/plugin_test_2.sh: Likewise. * testsuite/plugin_test_3.sh: Likewise. * testsuite/plugin_test_4.sh: New test case.
Diffstat (limited to 'gold/descriptors.cc')
-rw-r--r--gold/descriptors.cc24
1 files changed, 2 insertions, 22 deletions
diff --git a/gold/descriptors.cc b/gold/descriptors.cc
index 73c03bf4a45..18498efd7c7 100644
--- a/gold/descriptors.cc
+++ b/gold/descriptors.cc
@@ -1,6 +1,6 @@
// descriptors.cc -- manage file descriptors for gold
-// Copyright 2008 Free Software Foundation, Inc.
+// Copyright 2008, 2009 Free Software Foundation, Inc.
// Written by Ian Lance Taylor <iant@google.com>.
// This file is part of gold.
@@ -115,9 +115,7 @@ Descriptors::open(int descriptor, const char* name, int flags, int mode)
pod->inuse = true;
pod->is_write = (flags & O_ACCMODE) != O_RDONLY;
- if (!pod->is_claimed)
- ++this->current_;
- pod->is_claimed = false;
+ ++this->current_;
if (this->current_ >= this->limit_)
this->close_some_descriptor();
@@ -168,24 +166,6 @@ Descriptors::release(int descriptor, bool permanent)
}
}
-// Claim the file descriptor DESCRIPTOR for a plugin. This effectively
-// removes the descriptor from the pool of linker-managed descriptors,
-// as the plugin will assume responsibility for closing it.
-// The IS_CLAIMED flag allows us to recognize when a file descriptor
-// has been reused after being closed by the plugin.
-
-void
-Descriptors::claim_for_plugin(int descriptor)
-{
- Hold_lock hl(*this->lock_);
-
- gold_assert(descriptor >= 0
- && (static_cast<size_t>(descriptor)
- < this->open_descriptors_.size()));
- Open_descriptor* pod = &this->open_descriptors_[descriptor];
- pod->is_claimed = true;
-}
-
// Close some descriptor. The lock is held when this is called. We
// close the descriptor on the top of the free stack. Note that this
// is the opposite of an LRU algorithm--we close the most recently