summaryrefslogtreecommitdiffstats
path: root/lld/ELF/InputFiles.cpp
diff options
context:
space:
mode:
authorGeorge Rimar <grimar@accesssoftek.com>2016-10-10 10:31:03 +0000
committerGeorge Rimar <grimar@accesssoftek.com>2016-10-10 10:31:03 +0000
commit27e651d4f69527b12d02e1f02dd6da9f423f1d4d (patch)
tree541f2f409df34f51417f1bc6bb1a28933f3d7995 /lld/ELF/InputFiles.cpp
parenta1b82456541f1dd47cf01d42754c227270b472b4 (diff)
downloadbcm5719-llvm-27e651d4f69527b12d02e1f02dd6da9f423f1d4d.tar.gz
bcm5719-llvm-27e651d4f69527b12d02e1f02dd6da9f423f1d4d.zip
Recommit r283733 "[ELF] - Do not crash if common symbol alignment set to value greater than UINT32_MAX.
With fix: commit changes from InputFiles.cpp too. Original commit message: We have following code in lld, that truncates the alignment value to 32 bit. Big alignment in this case may give result 0 and crash later. template <class ELFT> CommonInputSection<ELFT>::CommonInputSection(std::vector<DefinedCommon *> Syms) : InputSection<ELFT>(nullptr, &Hdr, "") { .... for (DefinedCommon *Sym : Syms) { this->Alignment = std::max<uintX_t>(this->Alignment, Sym->Alignment); ... } } Patch fixes the issue. Differential revision: https://reviews.llvm.org/D25235 llvm-svn: 283738
Diffstat (limited to 'lld/ELF/InputFiles.cpp')
-rw-r--r--lld/ELF/InputFiles.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp
index cc8a8492327..e3266f17634 100644
--- a/lld/ELF/InputFiles.cpp
+++ b/lld/ELF/InputFiles.cpp
@@ -437,9 +437,9 @@ SymbolBody *elf::ObjectFile<ELFT>::createSymbolBody(const Elf_Sym *Sym) {
/*CanOmitFromDynSym*/ false, this)
->body();
case SHN_COMMON:
- if (Sym->st_value == 0)
+ if (Sym->st_value == 0 || Sym->st_value >= UINT32_MAX)
fatal(getFilename(this) + ": common symbol '" + Name +
- "' alignment is 0");
+ "' has invalid alignment: " + Twine(Sym->st_value));
return elf::Symtab<ELFT>::X->addCommon(Name, Sym->st_size, Sym->st_value,
Binding, Sym->st_other,
Sym->getType(), this)
OpenPOWER on IntegriCloud