forked from OSchip/llvm-project
[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:
parent
a27fe1c918
commit
2e36c8de3f
|
@ -101,8 +101,8 @@ public:
|
||||||
virtual Interposable interposable() const { return interposeNo; }
|
virtual Interposable interposable() const { return interposeNo; }
|
||||||
virtual Merge merge() const { return mergeNo; }
|
virtual Merge merge() const { return mergeNo; }
|
||||||
virtual Alignment alignment() const { return Alignment(0); }
|
virtual Alignment alignment() const { return Alignment(0); }
|
||||||
virtual SectionChoice sectionChoice() const { return sectionBasedOnContent; }
|
virtual SectionChoice sectionChoice() const = 0;
|
||||||
virtual StringRef customSectionName() const { return ""; }
|
virtual StringRef customSectionName() const { return ""; };
|
||||||
virtual SectionPosition sectionPosition() const { return sectionPositionAny; }
|
virtual SectionPosition sectionPosition() const { return sectionPositionAny; }
|
||||||
virtual DeadStripKind deadStrip() const { return deadStripNormal; }
|
virtual DeadStripKind deadStrip() const { return deadStripNormal; }
|
||||||
virtual bool isAlias() const { return false; }
|
virtual bool isAlias() const { return false; }
|
||||||
|
@ -160,7 +160,8 @@ public:
|
||||||
|
|
||||||
void setAlignment(Alignment val) { _alignment = val; };
|
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 Scope scope() const { return _scope; }
|
||||||
virtual ContentType contentType() const { return _contentType; }
|
virtual ContentType contentType() const { return _contentType; }
|
||||||
virtual ContentPermissions permissions() const { return _permissions; }
|
virtual ContentPermissions permissions() const { return _permissions; }
|
||||||
|
@ -227,6 +228,7 @@ private:
|
||||||
/// not read from file.
|
/// not read from file.
|
||||||
class COFFLinkerInternalAtom : public COFFBaseDefinedAtom {
|
class COFFLinkerInternalAtom : public COFFBaseDefinedAtom {
|
||||||
public:
|
public:
|
||||||
|
virtual SectionChoice sectionChoice() const { return sectionBasedOnContent; }
|
||||||
virtual uint64_t ordinal() const { return 0; }
|
virtual uint64_t ordinal() const { return 0; }
|
||||||
virtual Scope scope() const { return scopeGlobal; }
|
virtual Scope scope() const { return scopeGlobal; }
|
||||||
virtual Alignment alignment() const { return Alignment(0); }
|
virtual Alignment alignment() const { return Alignment(0); }
|
||||||
|
|
|
@ -78,7 +78,7 @@ private:
|
||||||
for (const DefinedAtom *atom : mutableFile.defined()) {
|
for (const DefinedAtom *atom : mutableFile.defined()) {
|
||||||
auto *coffAtom = dyn_cast<COFFDefinedAtom>((COFFBaseDefinedAtom *)atom);
|
auto *coffAtom = dyn_cast<COFFDefinedAtom>((COFFBaseDefinedAtom *)atom);
|
||||||
if (coffAtom && coffAtom->ordinal() == 0)
|
if (coffAtom && coffAtom->ordinal() == 0)
|
||||||
result[coffAtom->getSectionName()].push_back(coffAtom);
|
result[coffAtom->customSectionName()].push_back(coffAtom);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -699,7 +699,6 @@ void SectionChunk::buildContents(const File &linkedFile,
|
||||||
bool (*isEligible)(const DefinedAtom *)) {
|
bool (*isEligible)(const DefinedAtom *)) {
|
||||||
// Extract atoms from the linked file and append them to this section.
|
// Extract atoms from the linked file and append them to this section.
|
||||||
for (const DefinedAtom *atom : linkedFile.defined()) {
|
for (const DefinedAtom *atom : linkedFile.defined()) {
|
||||||
assert(atom->sectionChoice() == DefinedAtom::sectionBasedOnContent);
|
|
||||||
if (isEligible(atom))
|
if (isEligible(atom))
|
||||||
appendAtom(atom);
|
appendAtom(atom);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue