summaryrefslogtreecommitdiffstats
path: root/lld/ELF/InputSection.cpp
diff options
context:
space:
mode:
authorGeorge Rimar <grimar@accesssoftek.com>2016-11-29 16:11:09 +0000
committerGeorge Rimar <grimar@accesssoftek.com>2016-11-29 16:11:09 +0000
commit9b3ae73fc8bf5de598f9a56e9aeb8b0acd3fdaf0 (patch)
tree0759c91c737fa425402914c1c8e1c8ff4814f5d5 /lld/ELF/InputSection.cpp
parent3fb5a6dc9e0c30af868c85ac77c94ebec836b08a (diff)
downloadbcm5719-llvm-9b3ae73fc8bf5de598f9a56e9aeb8b0acd3fdaf0.tar.gz
bcm5719-llvm-9b3ae73fc8bf5de598f9a56e9aeb8b0acd3fdaf0.zip
[ELF] - Disable emiting multiple output sections when merging is disabled.
When -O0 is specified, we do not do section merging. Though before this patch several sections were generated instead of single, what is useless. Differential revision: https://reviews.llvm.org/D27041 llvm-svn: 288151
Diffstat (limited to 'lld/ELF/InputSection.cpp')
-rw-r--r--lld/ELF/InputSection.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp
index 2fcb39bfda2..a0190564633 100644
--- a/lld/ELF/InputSection.cpp
+++ b/lld/ELF/InputSection.cpp
@@ -80,6 +80,12 @@ InputSectionBase<ELFT>::InputSectionBase(elf::ObjectFile<ELFT> *File,
if (V > UINT32_MAX)
fatal(toString(File) + ": section sh_addralign is too large");
Alignment = V;
+
+ // If it is not a mergeable section, overwrite the flag so that the flag
+ // is consistent with the class. This inconsistency could occur when
+ // string merging is disabled using -O0 flag.
+ if (!Config->Relocatable && !isa<MergeInputSection<ELFT>>(this))
+ this->Flags &= ~(SHF_MERGE | SHF_STRINGS);
}
template <class ELFT>
OpenPOWER on IntegriCloud