From 8383303e0acce6e4332e2a2097b832e2deb880ec Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 18 Dec 2007 00:48:04 +0000 Subject: Add section_size_type and section_offset_type, use them to replace a lot of instances of off_t. --- gold/archive.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'gold/archive.cc') 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(pword + nsyms); - off_t names_size = reinterpret_cast(p) + size - pnames; + section_size_type names_size = + reinterpret_cast(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(pnames) - p > size) + if (static_cast(name_offset) > names_size) gold_error(_("%s: bad archive symbol table names"), this->name().c_str()); -- cgit v1.1