* gold.h (Incremental_argument_list): Remove (invalid) forward
[deliverable/binutils-gdb.git] / gold / merge.cc
index 75a3eeea924f48978174dfc52e0d63a5e96c6ef8..25ecc40c0e17c14b7ef6605a98ad6c3f7065912a 100644 (file)
@@ -1,6 +1,6 @@
 // merge.cc -- handle section merging for gold
 
-// Copyright 2006, 2007 Free Software Foundation, Inc.
+// Copyright 2006, 2007, 2008 Free Software Foundation, Inc.
 // Written by Ian Lance Taylor <iant@google.com>.
 
 // This file is part of gold.
@@ -140,7 +140,7 @@ Object_merge_map::add_mapping(const Merge_map* merge_map, unsigned int shndx,
 
 // Get the output offset for an input address.
 
-inline bool
+bool
 Object_merge_map::get_output_offset(const Merge_map* merge_map,
                                    unsigned int shndx,
                                    section_offset_type input_offset,
@@ -465,7 +465,7 @@ Output_merge_string<Char_type>::do_add_input_section(Relobj* object,
   const unsigned char* pdata = object->section_contents(shndx, &len, false);
 
   const Char_type* p = reinterpret_cast<const Char_type*>(pdata);
-  const Char_type* pend = p + len;
+  const Char_type* pend = p + len / sizeof(Char_type);
 
   if (len % sizeof(Char_type) != 0)
     {
@@ -485,8 +485,10 @@ Output_merge_string<Char_type>::do_add_input_section(Relobj* object,
        {
          if (pl >= pend)
            {
-             object->error(_("entry in mergeable string section "
-                             "not null terminated"));
+             gold_warning(_("%s: last entry in mergeable string section '%s' "
+                            "not null terminated"),
+                          object->name().c_str(),
+                          object->section_name(shndx).c_str());
              break;
            }
        }
@@ -528,7 +530,9 @@ Output_merge_string<Char_type>::finalize_merged_data()
       this->add_mapping(p->object, p->shndx, p->offset, p->length, offset);
     }
 
-  // Save some memory.
+  // Save some memory.  This also ensures that this function will work
+  // if called twice, as may happen if Layout::set_segment_offsets
+  // finds a better alignment.
   this->merged_strings_.clear();
 
   return this->stringpool_.get_strtab_size();
This page took 0.02378 seconds and 4 git commands to generate.