aboutsummaryrefslogtreecommitdiff
path: root/gold
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2015-03-02 10:20:21 -0800
committerCary Coutant <ccoutant@google.com>2015-03-02 10:20:21 -0800
commit2c7b626ceef8ee50d6ef6fb575cfe55b93ef7a0f (patch)
tree69aaa16769b829dc75667bf1b1126b0cb4695ecd /gold
parent5b07cd848db1dbe9e3498e94bea5e69c8e438153 (diff)
downloadgdb-2c7b626ceef8ee50d6ef6fb575cfe55b93ef7a0f.zip
gdb-2c7b626ceef8ee50d6ef6fb575cfe55b93ef7a0f.tar.gz
gdb-2c7b626ceef8ee50d6ef6fb575cfe55b93ef7a0f.tar.bz2
Fix crash when processing merge section with entsize of 0.
2015-02-04 Peter Collingbourne <pcc@google.com> Cary Coutant <ccoutant@google.com> gold/ * output.cc (Output_section::add_merge_input_section): Do not attempt to merge sections with an entsize of 0.
Diffstat (limited to 'gold')
-rw-r--r--gold/ChangeLog6
-rw-r--r--gold/output.cc4
2 files changed, 10 insertions, 0 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index 10fc03b..d7dd903 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,9 @@
+2015-02-04 Peter Collingbourne <pcc@google.com>
+ Cary Coutant <ccoutant@google.com>
+
+ * output.cc (Output_section::add_merge_input_section): Do not
+ attempt to merge sections with an entsize of 0.
+
2015-02-02 Khem Raj <raj.khem@gmail.com>
* attributes.h (class Output_attributes_section_data ): Add
diff --git a/gold/output.cc b/gold/output.cc
index e9dd522..01838cc 100644
--- a/gold/output.cc
+++ b/gold/output.cc
@@ -2636,6 +2636,10 @@ Output_section::add_merge_input_section(Relobj* object, unsigned int shndx,
uint64_t addralign,
bool keeps_input_sections)
{
+ // We cannot merge sections with entsize == 0.
+ if (entsize == 0)
+ return false;
+
bool is_string = (flags & elfcpp::SHF_STRINGS) != 0;
// We cannot restore merged input section states.