* dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
	SYMNDX to off_t before comparing it to this->data_size().
	* output.cc (Output_symtab_xindex::endian_do_write): Likewise.
	* incremental.cc (Output_section_incremental_inputs::do_write):
	Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
This commit is contained in:
Roland McGrath 2012-11-01 22:35:06 +00:00
parent e5496e3ec6
commit 50ed5eb142
4 changed files with 23 additions and 15 deletions

View File

@ -1,3 +1,11 @@
2012-11-01 Roland McGrath <mcgrathr@google.com>
* dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
SYMNDX to off_t before comparing it to this->data_size().
* output.cc (Output_symtab_xindex::endian_do_write): Likewise.
* incremental.cc (Output_section_incremental_inputs::do_write):
Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
2012-11-01 Roland McGrath <mcgrathr@google.com>
* nacl.cc: Include "libiberty.h" for vasprintf declaration.

View File

@ -57,7 +57,7 @@ Sized_elf_reloc_mapper<size, big_endian>::symbol_section(
unsigned int symndx, Address* value, bool* is_ordinary)
{
const int symsize = elfcpp::Elf_sizes<size>::sym_size;
gold_assert((symndx + 1) * symsize <= this->symtab_size_);
gold_assert(static_cast<off_t>((symndx + 1) * symsize) <= this->symtab_size_);
elfcpp::Sym<size, big_endian> elfsym(this->symtab_ + symndx * symsize);
*value = elfsym.get_st_value();
return this->object_->adjust_sym_shndx(symndx, elfsym.get_st_shndx(),
@ -530,7 +530,7 @@ Dwarf_pubnames_table::read_header(off_t offset)
pinfo += 2;
if (version != 2)
return false;
// Skip the debug_info_offset and debug_info_size fields.
pinfo += 2 * this->offset_size_;

View File

@ -1432,7 +1432,7 @@ Output_section_incremental_inputs<size, big_endian>::do_write(Output_file* of)
gold_assert(pov - oview == oview_size);
// Write the .gnu_incremental_symtab section.
gold_assert(global_sym_count * 4 == symtab_size);
gold_assert(static_cast<off_t>(global_sym_count) * 4 == symtab_size);
this->write_symtab(symtab_view, global_syms, global_sym_count);
delete[] global_syms;

View File

@ -1935,7 +1935,7 @@ Output_symtab_xindex::endian_do_write(unsigned char* const oview)
++p)
{
unsigned int symndx = p->first;
gold_assert(symndx * 4 < this->data_size());
gold_assert(static_cast<off_t>(symndx) * 4 < this->data_size());
elfcpp::Swap<32, big_endian>::writeval(oview + symndx * 4, p->second);
}
}
@ -2765,7 +2765,7 @@ Output_section::convert_input_sections_in_list_to_relaxed_sections(
(*input_sections)[p->second].set_section_order_index(soi);
}
}
// Convert regular input sections into relaxed input sections. RELAXED_SECTIONS
// is a vector of pointers to Output_relaxed_input_section or its derived
// classes. The relaxed sections must correspond to existing input sections.
@ -2780,7 +2780,7 @@ Output_section::convert_input_sections_to_relaxed_sections(
// this. If there is no checkpoint active, just search the current
// input section list and replace the sections there. If there is
// a checkpoint, also replace the sections there.
// By default, we look at the whole list.
size_t limit = this->input_sections_.size();
@ -2893,13 +2893,13 @@ Output_section::build_lookup_maps() const
for (Output_merge_base::Input_sections::const_iterator is =
pomb->input_sections_begin();
is != pomb->input_sections_end();
++is)
++is)
{
const Const_section_id& csid = *is;
this->lookup_maps_->add_merge_input_section(csid.first,
csid.second, pomb);
}
}
else if (p->is_relaxed_input_section())
{
@ -2941,7 +2941,7 @@ Output_section::is_input_address_mapped(const Relobj* object,
{
section_offset_type output_offset;
bool found = posd->output_offset(object, shndx, offset, &output_offset);
gold_assert(found);
gold_assert(found);
return output_offset != -1;
}
@ -2976,13 +2976,13 @@ Output_section::output_offset(const Relobj* object, unsigned int shndx,
// Look at the Output_section_data_maps first.
const Output_section_data* posd = this->find_merge_section(object, shndx);
if (posd == NULL)
if (posd == NULL)
posd = this->find_relaxed_input_section(object, shndx);
if (posd != NULL)
{
section_offset_type output_offset;
bool found = posd->output_offset(object, shndx, offset, &output_offset);
gold_assert(found);
gold_assert(found);
return output_offset;
}
@ -3009,7 +3009,7 @@ Output_section::output_address(const Relobj* object, unsigned int shndx,
// Look at the Output_section_data_maps first.
const Output_section_data* posd = this->find_merge_section(object, shndx);
if (posd == NULL)
if (posd == NULL)
posd = this->find_relaxed_input_section(object, shndx);
if (posd != NULL && posd->is_address_valid())
{
@ -3495,7 +3495,7 @@ Output_section::Input_section_sort_section_order_index_compare::operator()(
// Keep input order if section ordering cannot determine order.
if (s1_secn_index == s2_secn_index)
return s1.index() < s2.index();
return s1_secn_index < s2_secn_index;
}
@ -3858,7 +3858,7 @@ Output_section::add_script_input_section(const Input_section& sis)
this->input_sections_.push_back(sis);
// Update fast lookup maps if necessary.
// Update fast lookup maps if necessary.
if (this->lookup_maps_->is_valid())
{
if (sis.is_merge_section())
@ -4173,7 +4173,7 @@ Output_segment::maximum_alignment()
if (!this->is_max_align_known_)
{
for (int i = 0; i < static_cast<int>(ORDER_MAX); ++i)
{
{
const Output_data_list* pdl = &this->output_lists_[i];
uint64_t addralign = Output_segment::maximum_alignment_list(pdl);
if (addralign > this->max_align_)