Correct handling of non-section symbol in merged section. Avoid some
authorIan Lance Taylor <iant@google.com>
Fri, 21 Dec 2007 23:08:25 +0000 (23:08 +0000)
committerIan Lance Taylor <iant@google.com>
Fri, 21 Dec 2007 23:08:25 +0000 (23:08 +0000)
64-bit signed/unsigned warnings.

gold/fileread.cc
gold/object.cc
gold/output.cc
gold/output.h
gold/reloc.cc

index baa681a24c0870fff559ee6cef91194e4567366f..defb3a02560f9a683ef3e2267c5958502af5d2c4 100644 (file)
@@ -288,7 +288,7 @@ File_read::find_or_make_view(off_t start, section_size_type size, bool cache)
 
   section_size_type psize = File_read::pages(size + (start - poff));
 
-  if (poff + psize >= this->size_)
+  if (poff + static_cast<off_t>(psize) >= this->size_)
     {
       psize = this->size_ - poff;
       gold_assert(psize >= size);
index e92a66d2e4948a175d2ab542358f721b6531413a..1a0d0647ebaa5a5400830c79a43d2cc1075d684d 100644 (file)
@@ -896,12 +896,13 @@ Sized_relobj<size, big_endian>::do_finalize_local_symbols(unsigned int index,
              // value.  If it is a section symbol, we can not, as in
              // that case we have to consider the addend to determine
              // the value to use in a relocation.
-             section_offset_type start =
-               os->starting_output_address(this, shndx);
              if (!lv.is_section_symbol())
-               lv.set_output_value(lv.input_value() + start);
+               lv.set_output_value(os->output_address(this, shndx,
+                                                       lv.input_value()));
              else
                {
+                  section_offset_type start =
+                    os->starting_output_address(this, shndx);
                  Merged_symbol_value<size>* msv =
                    new Merged_symbol_value<size>(lv.input_value(), start);
                  lv.set_merged_symbol_value(msv);
index 3d1d27e644acb631f2c72cc9d5f9f0ced51c43e4..8a9e9b3eec798bd076f7049753272e3a70695891 100644 (file)
@@ -1695,8 +1695,6 @@ Output_section::output_address(const Relobj* object, unsigned int shndx,
                               off_t offset) const
 {
   gold_assert(object->is_section_specially_mapped(shndx));
-  // This can only be called meaningfully when layout is complete.
-  gold_assert(Output_data::is_layout_complete());
 
   uint64_t addr = this->address() + this->first_input_offset_;
   for (Input_section_list::const_iterator p = this->input_sections_.begin();
index 3d1a44d9d545ab87b83c633cbda2c97794c73239..07a336dcd53cc7d3ea3d78c189610f2f61735106 100644 (file)
@@ -2323,7 +2323,8 @@ class Output_file
   unsigned char*
   get_output_view(off_t start, size_t size)
   {
-    gold_assert(start >= 0 && start + size <= this->file_size_);
+    gold_assert(start >= 0
+                && start + static_cast<off_t>(size) <= this->file_size_);
     return this->base_ + start;
   }
 
index e9c13266549b3f061292145bc7f3732464520ae8..f88151fb0ec19c86e57538867094efc86d4f7c6c 100644 (file)
@@ -459,7 +459,8 @@ Sized_relobj<size, big_endian>::write_sections(const unsigned char* pshdrs,
 
       gold_assert(output_offset == -1
                  || (output_offset >= 0
-                     && output_offset + view_size <= output_section_size));
+                     && (output_offset + static_cast<off_t>(view_size)
+                          <= output_section_size)));
 
       unsigned char* view;
       if (os->requires_postprocessing())