summaryrefslogtreecommitdiffstats
path: root/lld/ELF/Writer.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2016-11-11 21:36:25 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2016-11-11 21:36:25 +0000
commitd4372f783b52919c569f3e2007e3ba9edb45c7fb (patch)
treee2aedcf419ac2d03e54e26da2da5ee6a93999586 /lld/ELF/Writer.cpp
parent088faab429538c6123024f6f173ee6e35845f445 (diff)
downloadbcm5719-llvm-d4372f783b52919c569f3e2007e3ba9edb45c7fb.tar.gz
bcm5719-llvm-d4372f783b52919c569f3e2007e3ba9edb45c7fb.zip
Avoid a crash with -r and .comment.
We would create a MergeInputSection for the synthetic .comment and crash trying to add it to a regular output section. With this we just don't add the synthetic section with -r. That is consistent with gold that doesn't create .note.gnu.gold-version with -r. llvm-svn: 286635
Diffstat (limited to 'lld/ELF/Writer.cpp')
-rw-r--r--lld/ELF/Writer.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 941a6d81ff9..de9a2f9fe7d 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -267,7 +267,8 @@ template <class ELFT> void Writer<ELFT>::createSyntheticSections() {
Out<ELFT>::VerDef = make<VersionDefinitionSection<ELFT>>();
// Initialize linker generated sections
- Symtab<ELFT>::X->Sections.push_back(createCommentSection<ELFT>());
+ if (!Config->Relocatable)
+ Symtab<ELFT>::X->Sections.push_back(createCommentSection<ELFT>());
if (Config->BuildId == BuildIdKind::Fast)
In<ELFT>::BuildId = make<BuildIdFastHash<ELFT>>();
OpenPOWER on IntegriCloud