From 50ed5eb142b3246bd16be9626f0cf9565f44d8f9 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Thu, 1 Nov 2012 22:35:06 +0000 Subject: [PATCH] gold/ * 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. --- gold/ChangeLog | 8 ++++++++ gold/dwarf_reader.cc | 4 ++-- gold/incremental.cc | 2 +- gold/output.cc | 24 ++++++++++++------------ 4 files changed, 23 insertions(+), 15 deletions(-) diff --git a/gold/ChangeLog b/gold/ChangeLog index 632a9a3..af6c4f5 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,5 +1,13 @@ 2012-11-01 Roland McGrath + * 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 + * nacl.cc: Include "libiberty.h" for vasprintf declaration. 2012-10-30 Steve McIntyre diff --git a/gold/dwarf_reader.cc b/gold/dwarf_reader.cc index c80e8cb..ec0e845 100644 --- a/gold/dwarf_reader.cc +++ b/gold/dwarf_reader.cc @@ -57,7 +57,7 @@ Sized_elf_reloc_mapper::symbol_section( unsigned int symndx, Address* value, bool* is_ordinary) { const int symsize = elfcpp::Elf_sizes::sym_size; - gold_assert((symndx + 1) * symsize <= this->symtab_size_); + gold_assert(static_cast((symndx + 1) * symsize) <= this->symtab_size_); elfcpp::Sym 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_; diff --git a/gold/incremental.cc b/gold/incremental.cc index acabaea..714b198 100644 --- a/gold/incremental.cc +++ b/gold/incremental.cc @@ -1432,7 +1432,7 @@ Output_section_incremental_inputs::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(global_sym_count) * 4 == symtab_size); this->write_symtab(symtab_view, global_syms, global_sym_count); delete[] global_syms; diff --git a/gold/output.cc b/gold/output.cc index 6e5cd25..b47ad4d 100644 --- a/gold/output.cc +++ b/gold/output.cc @@ -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(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(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_) -- 2.7.4