diff options
author | Rui Ueyama <ruiu@google.com> | 2017-06-26 17:11:36 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2017-06-26 17:11:36 +0000 |
commit | 82143d3fbba6d861fd0248f4d9df90f435a783e8 (patch) | |
tree | 4f40b081c1fb6a3d09aba40ecbc9b30c10d257f7 | |
parent | 71fab2f03b6136e8d6cc9974e5918132614af9b2 (diff) | |
download | bcm5719-llvm-82143d3fbba6d861fd0248f4d9df90f435a783e8.tar.gz bcm5719-llvm-82143d3fbba6d861fd0248f4d9df90f435a783e8.zip |
Move `assert` upwards so that it fails early if it fails.
llvm-svn: 306308
-rw-r--r-- | lld/ELF/LinkerScript.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp index 5f66712107c..d369a6f978a 100644 --- a/lld/ELF/LinkerScript.cpp +++ b/lld/ELF/LinkerScript.cpp @@ -949,6 +949,8 @@ static bool compareByFilePosition(InputSection *A, InputSection *B) { template <class ELFT> static void finalizeShtGroup(OutputSection *OS, ArrayRef<InputSection *> Sections) { + assert(Config->Relocatable && Sections.size() == 1); + // sh_link field for SHT_GROUP sections should contain the section index of // the symbol table. OS->Link = InX::SymTab->getParent()->SectionIndex; @@ -956,7 +958,6 @@ static void finalizeShtGroup(OutputSection *OS, // sh_info then contain index of an entry in symbol table section which // provides signature of the section group. elf::ObjectFile<ELFT> *Obj = Sections[0]->getFile<ELFT>(); - assert(Config->Relocatable && Sections.size() == 1); ArrayRef<SymbolBody *> Symbols = Obj->getSymbols(); OS->Info = InX::SymTab->getSymbolIndex(Symbols[Sections[0]->Info - 1]); } |