aboutsummaryrefslogtreecommitdiff
path: root/gold/output.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2007-10-18 17:46:23 +0000
committerIan Lance Taylor <iant@google.com>2007-10-18 17:46:23 +0000
commit87f9577614a90f155dcdf59864d21dbc3f106469 (patch)
treef8c50dbd3e92c4a509c500608e9510e666cc0904 /gold/output.cc
parentba32f9896b4b1e79f36ae03ac383869127a461e0 (diff)
downloadgdb-87f9577614a90f155dcdf59864d21dbc3f106469.zip
gdb-87f9577614a90f155dcdf59864d21dbc3f106469.tar.gz
gdb-87f9577614a90f155dcdf59864d21dbc3f106469.tar.bz2
Correctly handle alignment in merge sections.
Diffstat (limited to 'gold/output.cc')
-rw-r--r--gold/output.cc19
1 files changed, 10 insertions, 9 deletions
diff --git a/gold/output.cc b/gold/output.cc
index 9aaa7e9..acba77c 100644
--- a/gold/output.cc
+++ b/gold/output.cc
@@ -1137,17 +1137,18 @@ Output_section::add_merge_input_section(Relobj* object, unsigned int shndx,
uint64_t flags, uint64_t entsize,
uint64_t addralign)
{
- // We only merge constants if the alignment is not more than the
- // entry size. This could be handled, but it's unusual.
- if (addralign > entsize)
+ bool is_string = (flags & elfcpp::SHF_STRINGS) != 0;
+
+ // We only merge strings if the alignment is not more than the
+ // character size. This could be handled, but it's unusual.
+ if (is_string && addralign > entsize)
return false;
- bool is_string = (flags & elfcpp::SHF_STRINGS) != 0;
Input_section_list::iterator p;
for (p = this->input_sections_.begin();
p != this->input_sections_.end();
++p)
- if (p->is_merge_section(is_string, entsize))
+ if (p->is_merge_section(is_string, entsize, addralign))
break;
// We handle the actual constant merging in Output_merge_data or
@@ -1158,13 +1159,13 @@ Output_section::add_merge_input_section(Relobj* object, unsigned int shndx,
{
Output_section_data* posd;
if (!is_string)
- posd = new Output_merge_data(entsize);
+ posd = new Output_merge_data(entsize, addralign);
else if (entsize == 1)
- posd = new Output_merge_string<char>();
+ posd = new Output_merge_string<char>(addralign);
else if (entsize == 2)
- posd = new Output_merge_string<uint16_t>();
+ posd = new Output_merge_string<uint16_t>(addralign);
else if (entsize == 4)
- posd = new Output_merge_string<uint32_t>();
+ posd = new Output_merge_string<uint32_t>(addralign);
else
return false;