[lld] r306308 - Move `assert` upwards so that it fails early if it fails.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 26 10:11:36 PDT 2017
Author: ruiu
Date: Mon Jun 26 10:11:36 2017
New Revision: 306308
URL: http://llvm.org/viewvc/llvm-project?rev=306308&view=rev
Log:
Move `assert` upwards so that it fails early if it fails.
Modified:
lld/trunk/ELF/LinkerScript.cpp
Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=306308&r1=306307&r2=306308&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Mon Jun 26 10:11:36 2017
@@ -949,6 +949,8 @@ static bool compareByFilePosition(InputS
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(OutputSecti
// 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]);
}
More information about the llvm-commits
mailing list