Split addSection into two small functions. NFCI.

addSection function was hard to read because it behaves differently
depending on its arguments but what exactly it does is not clear.
Now it should be better. Still, it is not clear (not what but) why
it does what it does, but I'll take a look at it later.

llvm-svn: 315124
This commit is contained in:
Rui Ueyama
2017-10-06 23:06:40 +00:00
parent ba0f4339a7
commit edafba200f
4 changed files with 29 additions and 17 deletions

View File

@@ -458,7 +458,7 @@ void LinkerScript::addOrphanSections(OutputSectionFactory &Factory) {
});
log(toString(S) + " is being placed in '" + Name + "'");
if (I == End) {
Factory.addInputSec(S, Name);
Factory.addInputSec(S, Name, nullptr);
assert(S->getOutputSection()->SectionIndex == INT_MAX);
} else {
OutputSection *Sec = cast<OutputSection>(*I);