// 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.
// 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,
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)
{
{
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;
}
}
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();