summaryrefslogtreecommitdiffstats
path: root/lld/ELF/Writer.cpp
diff options
context:
space:
mode:
authorEugene Leviant <evgeny.leviant@gmail.com>2016-10-05 10:10:45 +0000
committerEugene Leviant <evgeny.leviant@gmail.com>2016-10-05 10:10:45 +0000
commita8d12ef85323c0c425dd1724a494cb6b4184ecaa (patch)
treedc3f7a93a7636166e8d42681a1cbc5195516b5a2 /lld/ELF/Writer.cpp
parent0e1a50e9c459d46995ba0cc7f5ed1da535e1b70a (diff)
downloadbcm5719-llvm-a8d12ef85323c0c425dd1724a494cb6b4184ecaa.tar.gz
bcm5719-llvm-a8d12ef85323c0c425dd1724a494cb6b4184ecaa.zip
Do not join sections for relocatable object files
Differential revision: https://reviews.llvm.org/D25232 llvm-svn: 283307
Diffstat (limited to 'lld/ELF/Writer.cpp')
-rw-r--r--lld/ELF/Writer.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index d2ee56e74a2..dd29d5ef384 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -89,9 +89,10 @@ private:
};
} // anonymous namespace
-template <class ELFT>
-StringRef elf::getOutputSectionName(InputSectionBase<ELFT> *S) {
- StringRef Name = S->Name;
+StringRef elf::getOutputSectionName(StringRef Name) {
+ if (Config->Relocatable)
+ return Name;
+
for (StringRef V :
{".text.", ".rodata.", ".data.rel.ro.", ".data.", ".bss.",
".init_array.", ".fini_array.", ".ctors.", ".dtors.", ".tbss.",
@@ -712,7 +713,7 @@ template <class ELFT> void Writer<ELFT>::createSections() {
}
OutputSectionBase<ELFT> *Sec;
bool IsNew;
- std::tie(Sec, IsNew) = Factory.create(IS, getOutputSectionName(IS));
+ std::tie(Sec, IsNew) = Factory.create(IS, getOutputSectionName(IS->Name));
if (IsNew)
OutputSections.push_back(Sec);
Sec->addSection(IS);
@@ -1444,11 +1445,6 @@ template bool elf::isRelroSection<ELF32BE>(OutputSectionBase<ELF32BE> *);
template bool elf::isRelroSection<ELF64LE>(OutputSectionBase<ELF64LE> *);
template bool elf::isRelroSection<ELF64BE>(OutputSectionBase<ELF64BE> *);
-template StringRef elf::getOutputSectionName<ELF32LE>(InputSectionBase<ELF32LE> *);
-template StringRef elf::getOutputSectionName<ELF32BE>(InputSectionBase<ELF32BE> *);
-template StringRef elf::getOutputSectionName<ELF64LE>(InputSectionBase<ELF64LE> *);
-template StringRef elf::getOutputSectionName<ELF64BE>(InputSectionBase<ELF64BE> *);
-
template void elf::reportDiscarded<ELF32LE>(InputSectionBase<ELF32LE> *);
template void elf::reportDiscarded<ELF32BE>(InputSectionBase<ELF32BE> *);
template void elf::reportDiscarded<ELF64LE>(InputSectionBase<ELF64LE> *);
OpenPOWER on IntegriCloud