[PECOFF] Change sectionChoice attribute.

Change the attribute from sectionBasedOnContent to sectionCustomRequired
because its the right attribute for atoms read from COFF files to have.
COFF atoms should basically be emitted to the section having the same name
as input. Permissions/attributes should not affect that.

There's no functionality change because the writer doesn't yet use the
section name. The writer will be modified in a following patch, so that atoms
are written to its customSectionName()'s section.

llvm-svn: 195595
This commit is contained in:
Rui Ueyama 2013-11-25 04:12:24 +00:00
parent a27fe1c918
commit 2e36c8de3f
3 changed files with 6 additions and 5 deletions

View File

@ -101,8 +101,8 @@ public:
virtual Interposable interposable() const { return interposeNo; }
virtual Merge merge() const { return mergeNo; }
virtual Alignment alignment() const { return Alignment(0); }
virtual SectionChoice sectionChoice() const { return sectionBasedOnContent; }
virtual StringRef customSectionName() const { return ""; }
virtual SectionChoice sectionChoice() const = 0;
virtual StringRef customSectionName() const { return ""; };
virtual SectionPosition sectionPosition() const { return sectionPositionAny; }
virtual DeadStripKind deadStrip() const { return deadStripNormal; }
virtual bool isAlias() const { return false; }
@ -160,7 +160,8 @@ public:
void setAlignment(Alignment val) { _alignment = val; };
virtual StringRef getSectionName() const { return _sectionName; }
virtual SectionChoice sectionChoice() const { return sectionCustomRequired; }
virtual StringRef customSectionName() const { return _sectionName; };
virtual Scope scope() const { return _scope; }
virtual ContentType contentType() const { return _contentType; }
virtual ContentPermissions permissions() const { return _permissions; }
@ -227,6 +228,7 @@ private:
/// not read from file.
class COFFLinkerInternalAtom : public COFFBaseDefinedAtom {
public:
virtual SectionChoice sectionChoice() const { return sectionBasedOnContent; }
virtual uint64_t ordinal() const { return 0; }
virtual Scope scope() const { return scopeGlobal; }
virtual Alignment alignment() const { return Alignment(0); }

View File

@ -78,7 +78,7 @@ private:
for (const DefinedAtom *atom : mutableFile.defined()) {
auto *coffAtom = dyn_cast<COFFDefinedAtom>((COFFBaseDefinedAtom *)atom);
if (coffAtom && coffAtom->ordinal() == 0)
result[coffAtom->getSectionName()].push_back(coffAtom);
result[coffAtom->customSectionName()].push_back(coffAtom);
}
return result;
}

View File

@ -699,7 +699,6 @@ void SectionChunk::buildContents(const File &linkedFile,
bool (*isEligible)(const DefinedAtom *)) {
// Extract atoms from the linked file and append them to this section.
for (const DefinedAtom *atom : linkedFile.defined()) {
assert(atom->sectionChoice() == DefinedAtom::sectionBasedOnContent);
if (isEligible(atom))
appendAtom(atom);
}