Rewrite CommonInputSection as a synthetic input section.

A CommonInputSection is a section containing all common symbols.
That was an input section but was abstracted in a different way
than the synthetic input sections because it was written before
the synthetic input section was invented.

This patch rewrites CommonInputSection as a synthetic input section
so that it behaves better with other sections.

llvm-svn: 286053
This commit is contained in:
Rui Ueyama
2016-11-05 23:05:47 +00:00
parent 9e0297b8bc
commit e8a6102fa9
9 changed files with 87 additions and 81 deletions

View File

@@ -202,13 +202,9 @@ void LinkerScript<ELFT>::computeInputSections(InputSectionDescription *I) {
if (elf::ObjectFile<ELFT> *F = S->getFile())
Filename = sys::path::filename(F->getName());
if (!I->FilePat.match(Filename) || Pat.ExcludedFilePat.match(Filename))
continue;
if (Pat.SectionPat.match(S->Name))
if (I->FilePat.match(Filename) && !Pat.ExcludedFilePat.match(Filename) &&
Pat.SectionPat.match(S->Name))
I->Sections.push_back(S);
if (Pat.SectionPat.match("COMMON"))
I->Sections.push_back(InputSection<ELFT>::CommonInputSection);
}
// Sort sections as instructed by SORT-family commands and --sort-section