Line 404... |
Line 404... |
|
|
bool
|
bool
|
Output_merge_data::do_add_input_section(Relobj* object, unsigned int shndx)
|
Output_merge_data::do_add_input_section(Relobj* object, unsigned int shndx)
|
{
|
{
|
section_size_type len;
|
section_size_type len;
|
section_size_type uncompressed_size = 0;
|
bool is_new;
|
unsigned char* uncompressed_data = NULL;
|
const unsigned char* p = object->decompressed_section_contents(shndx, &len,
|
const unsigned char* p = object->section_contents(shndx, &len, false);
|
&is_new);
|
|
|
if (object->section_is_compressed(shndx, &uncompressed_size))
|
|
{
|
|
uncompressed_data = new unsigned char[uncompressed_size];
|
|
if (!decompress_input_section(p, len, uncompressed_data,
|
|
uncompressed_size))
|
|
object->error(_("could not decompress section %s"),
|
|
object->section_name(shndx).c_str());
|
|
p = uncompressed_data;
|
|
len = uncompressed_size;
|
|
}
|
|
|
|
section_size_type entsize = convert_to_section_size_type(this->entsize());
|
section_size_type entsize = convert_to_section_size_type(this->entsize());
|
|
|
if (len % entsize != 0)
|
if (len % entsize != 0)
|
{
|
{
|
if (uncompressed_data != NULL)
|
if (is_new)
|
delete[] uncompressed_data;
|
delete[] p;
|
return false;
|
return false;
|
}
|
}
|
|
|
this->input_count_ += len / entsize;
|
this->input_count_ += len / entsize;
|
|
|
Line 455... |
Line 444... |
|
|
// For script processing, we keep the input sections.
|
// For script processing, we keep the input sections.
|
if (this->keeps_input_sections())
|
if (this->keeps_input_sections())
|
record_input_section(object, shndx);
|
record_input_section(object, shndx);
|
|
|
if (uncompressed_data != NULL)
|
if (is_new)
|
delete[] uncompressed_data;
|
delete[] p;
|
|
|
return true;
|
return true;
|
}
|
}
|
|
|
// Set the final data size in a merged output section with fixed size
|
// Set the final data size in a merged output section with fixed size
|
Line 515... |
Line 504... |
bool
|
bool
|
Output_merge_string<Char_type>::do_add_input_section(Relobj* object,
|
Output_merge_string<Char_type>::do_add_input_section(Relobj* object,
|
unsigned int shndx)
|
unsigned int shndx)
|
{
|
{
|
section_size_type len;
|
section_size_type len;
|
section_size_type uncompressed_size = 0;
|
bool is_new;
|
unsigned char* uncompressed_data = NULL;
|
const unsigned char* pdata = object->decompressed_section_contents(shndx,
|
const unsigned char* pdata = object->section_contents(shndx, &len, false);
|
&len,
|
|
&is_new);
|
if (object->section_is_compressed(shndx, &uncompressed_size))
|
|
{
|
|
uncompressed_data = new unsigned char[uncompressed_size];
|
|
if (!decompress_input_section(pdata, len, uncompressed_data,
|
|
uncompressed_size))
|
|
object->error(_("could not decompress section %s"),
|
|
object->section_name(shndx).c_str());
|
|
pdata = uncompressed_data;
|
|
len = uncompressed_size;
|
|
}
|
|
|
|
const Char_type* p = reinterpret_cast<const Char_type*>(pdata);
|
const Char_type* p = reinterpret_cast<const Char_type*>(pdata);
|
const Char_type* pend = p + len / sizeof(Char_type);
|
const Char_type* pend = p + len / sizeof(Char_type);
|
const Char_type* pend0 = pend;
|
const Char_type* pend0 = pend;
|
|
|
if (len % sizeof(Char_type) != 0)
|
if (len % sizeof(Char_type) != 0)
|
{
|
{
|
object->error(_("mergeable string section length not multiple of "
|
object->error(_("mergeable string section length not multiple of "
|
"character size"));
|
"character size"));
|
if (uncompressed_data != NULL)
|
if (is_new)
|
delete[] uncompressed_data;
|
delete[] pdata;
|
return false;
|
return false;
|
}
|
}
|
|
|
if (pend[-1] != 0)
|
if (pend[-1] != 0)
|
{
|
{
|
Line 604... |
Line 583... |
|
|
// For script processing, we keep the input sections.
|
// For script processing, we keep the input sections.
|
if (this->keeps_input_sections())
|
if (this->keeps_input_sections())
|
record_input_section(object, shndx);
|
record_input_section(object, shndx);
|
|
|
if (uncompressed_data != NULL)
|
if (is_new)
|
delete[] uncompressed_data;
|
delete[] pdata;
|
|
|
return true;
|
return true;
|
}
|
}
|
|
|
// Finalize the mappings from the input sections to the output
|
// Finalize the mappings from the input sections to the output
|