summaryrefslogtreecommitdiffstats
path: root/lld/ELF/InputFiles.cpp
diff options
context:
space:
mode:
authorGeorge Rimar <grimar@accesssoftek.com>2016-10-04 08:49:52 +0000
committerGeorge Rimar <grimar@accesssoftek.com>2016-10-04 08:49:52 +0000
commit0c82561c4c5aced6caaf3a1d56d7704d95e3eae8 (patch)
tree396e0e242fb58fb014be7292862160a6c360ea54 /lld/ELF/InputFiles.cpp
parent5cbf23664d7ad269b4c824ae3e86d6e9d1ec3c0a (diff)
downloadbcm5719-llvm-0c82561c4c5aced6caaf3a1d56d7704d95e3eae8.tar.gz
bcm5719-llvm-0c82561c4c5aced6caaf3a1d56d7704d95e3eae8.zip
[ELF] - Do not crash if common symbol has alignment 0.
Testcase contains a common symbol with zero alignment, previously lld would crash, patch fixes that. Differential revision: https://reviews.llvm.org/D25085 llvm-svn: 283197
Diffstat (limited to 'lld/ELF/InputFiles.cpp')
-rw-r--r--lld/ELF/InputFiles.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp
index 9d229564ade..0981e2cd48f 100644
--- a/lld/ELF/InputFiles.cpp
+++ b/lld/ELF/InputFiles.cpp
@@ -400,6 +400,9 @@ SymbolBody *elf::ObjectFile<ELFT>::createSymbolBody(const Elf_Sym *Sym) {
/*CanOmitFromDynSym*/ false, this)
->body();
case SHN_COMMON:
+ if (Sym->st_value == 0)
+ fatal(getFilename(this) + ": common symbol '" + Name +
+ "' alignment is 0");
return elf::Symtab<ELFT>::X->addCommon(Name, Sym->st_size, Sym->st_value,
Binding, Sym->st_other,
Sym->getType(), this)
OpenPOWER on IntegriCloud