aboutsummaryrefslogtreecommitdiff
path: root/gold/archive.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2007-12-18 00:48:04 +0000
committerIan Lance Taylor <iant@google.com>2007-12-18 00:48:04 +0000
commit8383303e0acce6e4332e2a2097b832e2deb880ec (patch)
tree6ccbc99caa33528817ffef492de98dfd19262563 /gold/archive.cc
parent3d372cd7a1b4639eed8fc062829a97b67a1342bf (diff)
downloadgdb-8383303e0acce6e4332e2a2097b832e2deb880ec.zip
gdb-8383303e0acce6e4332e2a2097b832e2deb880ec.tar.gz
gdb-8383303e0acce6e4332e2a2097b832e2deb880ec.tar.bz2
Add section_size_type and section_offset_type, use them to replace a
lot of instances of off_t.
Diffstat (limited to 'gold/archive.cc')
-rw-r--r--gold/archive.cc12
1 files changed, 7 insertions, 5 deletions
diff --git a/gold/archive.cc b/gold/archive.cc
index b80dea5..53b5cd0 100644
--- a/gold/archive.cc
+++ b/gold/archive.cc
@@ -84,7 +84,8 @@ Archive::setup(Task* task)
// The first member of the archive should be the symbol table.
std::string armap_name;
- off_t armap_size = this->read_header(sarmag, &armap_name);
+ section_size_type armap_size =
+ convert_to_section_size_type(this->read_header(sarmag, &armap_name));
off_t off = sarmag;
if (armap_name.empty())
{
@@ -115,7 +116,7 @@ Archive::setup(Task* task)
// Read the archive symbol map.
void
-Archive::read_armap(off_t start, off_t size)
+Archive::read_armap(off_t start, section_size_type size)
{
// Read in the entire armap.
const unsigned char* p = this->get_view(start, size, false);
@@ -127,12 +128,13 @@ Archive::read_armap(off_t start, off_t size)
// Note that the addition is in units of sizeof(elfcpp::Elf_Word).
const char* pnames = reinterpret_cast<const char*>(pword + nsyms);
- off_t names_size = reinterpret_cast<const char*>(p) + size - pnames;
+ section_size_type names_size =
+ reinterpret_cast<const char*>(p) + size - pnames;
this->armap_names_.assign(pnames, names_size);
this->armap_.resize(nsyms);
- off_t name_offset = 0;
+ section_offset_type name_offset = 0;
for (unsigned int i = 0; i < nsyms; ++i)
{
this->armap_[i].name_offset = name_offset;
@@ -141,7 +143,7 @@ Archive::read_armap(off_t start, off_t size)
++pword;
}
- if (reinterpret_cast<const unsigned char*>(pnames) - p > size)
+ if (static_cast<section_size_type>(name_offset) > names_size)
gold_error(_("%s: bad archive symbol table names"),
this->name().c_str());