aboutsummaryrefslogtreecommitdiff
path: root/gold/archive.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2007-09-25 05:16:35 +0000
committerIan Lance Taylor <iant@google.com>2007-09-25 05:16:35 +0000
commitbae3688d8f8566ea43c712982cea95897ed359da (patch)
treeac5c9f93174c3fc5653fa990524be599924c637c /gold/archive.cc
parentba45d2478b259454e5b4c2d7dcaa7a35ecbf329c (diff)
downloadgdb-bae3688d8f8566ea43c712982cea95897ed359da.zip
gdb-bae3688d8f8566ea43c712982cea95897ed359da.tar.gz
gdb-bae3688d8f8566ea43c712982cea95897ed359da.tar.bz2
Remove get_view_and_size.
Diffstat (limited to 'gold/archive.cc')
-rw-r--r--gold/archive.cc18
1 files changed, 10 insertions, 8 deletions
diff --git a/gold/archive.cc b/gold/archive.cc
index f7194f8..5ab3696 100644
--- a/gold/archive.cc
+++ b/gold/archive.cc
@@ -328,10 +328,11 @@ Archive::include_all_members(Symbol_table* symtab, Layout* layout,
off_t off = sarmag;
while (true)
{
+ unsigned char hdr_buf[sizeof(Archive_header)];
off_t bytes;
- const unsigned char* p = this->get_view_and_size(off,
- sizeof(Archive_header),
- &bytes);
+ this->input_file_->file().read_up_to(off, sizeof(Archive_header),
+ hdr_buf, &bytes);
+
if (bytes < sizeof(Archive_header))
{
if (bytes != 0)
@@ -345,7 +346,8 @@ Archive::include_all_members(Symbol_table* symtab, Layout* layout,
break;
}
- const Archive_header* hdr = reinterpret_cast<const Archive_header*>(p);
+ const Archive_header* hdr =
+ reinterpret_cast<const Archive_header*>(hdr_buf);
std::string name;
off_t size = this->interpret_header(hdr, off, &name);
if (name.empty())
@@ -379,9 +381,9 @@ Archive::include_member(Symbol_table* symtab, Layout* layout,
// Read enough of the file to pick up the entire ELF header.
int ehdr_size = elfcpp::Elf_sizes<64>::ehdr_size;
+ unsigned char ehdr_buf[ehdr_size];
off_t bytes;
- const unsigned char* p =
- this->input_file_->file().get_view_and_size(memoff, ehdr_size, &bytes);
+ this->input_file_->file().read_up_to(memoff, ehdr_size, ehdr_buf, &bytes);
if (bytes < 4)
{
fprintf(stderr, _("%s: %s: member at %ld is not an ELF object"),
@@ -395,7 +397,7 @@ Archive::include_member(Symbol_table* symtab, Layout* layout,
elfcpp::ELFMAG0, elfcpp::ELFMAG1,
elfcpp::ELFMAG2, elfcpp::ELFMAG3
};
- if (memcmp(p, elfmagic, 4) != 0)
+ if (memcmp(ehdr_buf, elfmagic, 4) != 0)
{
fprintf(stderr, _("%s: %s: member at %ld is not an ELF object"),
program_name, this->name().c_str(),
@@ -405,7 +407,7 @@ Archive::include_member(Symbol_table* symtab, Layout* layout,
Object* obj = make_elf_object((std::string(this->input_file_->filename())
+ "(" + n + ")"),
- this->input_file_, memoff, p, bytes);
+ this->input_file_, memoff, ehdr_buf, bytes);
input_objects->add_object(obj);