Revert "[PECOFF] Add atoms to the PassManager file"

This reverts commit r193479.

The atoms are already added to the file, so re-adding them caused the YAML
writer to write the same atoms twice. That made the YAML reader to fail with
"duplicate atom name" error.

This is not the only error we've got for RoundTripYAMLPass for PECOFF, so we
cannot enable the test yet. More fixes will come.

Differential Revision: http://llvm-reviews.chandlerc.com/D2069

llvm-svn: 193762
This commit is contained in:
Rui Ueyama 2013-10-31 16:59:49 +00:00
parent dc25a0bc64
commit bad4565be0
2 changed files with 17 additions and 11 deletions

View File

@ -265,20 +265,13 @@ public:
createImportDirectory(context, loadName, atoms);
}
auto nidatom = new (_alloc) NullImportDirectoryAtom(context);
context.file.addAtom(*nidatom);
// All atoms, including those of tyep NullImportDirectoryAtom, are added to
// context.file in the IdataAtom's constructor.
new (_alloc) NullImportDirectoryAtom(context);
connectAtoms(context);
createDataDirectoryAtoms(context);
replaceSharedLibraryAtoms(context);
for (auto id : context.importDirectories)
context.file.addAtom(*id);
for (auto ilt : context.importLookupTables)
context.file.addAtom(*ilt);
for (auto iat : context.importAddressTables)
context.file.addAtom(*iat);
for (auto hna : context.hintNameAtoms)
context.file.addAtom(*hna);
}
private:
@ -314,7 +307,6 @@ private:
appendAtoms(atoms, context.importAddressTables);
appendAtoms(atoms, context.dllNameAtoms);
appendAtoms(atoms, context.hintNameAtoms);
coff::connectAtomsWithLayoutEdge(atoms);
}

View File

@ -802,6 +802,19 @@ public:
: _PECOFFLinkingContext(context), _numSections(0),
_imageSizeInMemory(PAGE_SIZE), _imageSizeOnDisk(0) {}
// Make sure there are no duplicate atoms in the file. RoundTripYAMLPass also
// fails if there are duplicate atoms. This is a temporary measure until we
// enable the pass for PECOFF port.
void verifyFile(const File &linkedFile) {
#ifndef NDEBUG
std::set<const DefinedAtom *> set;
for (const DefinedAtom *atom : linkedFile.defined()) {
assert(set.count(atom) == 0);
set.insert(atom);
}
#endif
}
// Create all chunks that consist of the output file.
void build(const File &linkedFile) {
// Create file chunks and add them to the list.
@ -872,6 +885,7 @@ public:
}
virtual error_code writeFile(const File &linkedFile, StringRef path) {
verifyFile(linkedFile);
this->build(linkedFile);
uint64_t totalSize = _chunks.back()->fileOffset() + _chunks.back()->size();