[ELF] Remove redundant GOTFile classes

llvm-svn: 234397
This commit is contained in:
Simon Atanasyan 2015-04-08 10:06:28 +00:00
parent 8e951ce392
commit d42488a637
5 changed files with 16 additions and 50 deletions

View File

@ -25,13 +25,6 @@ public:
protected:
// Add any runtime files and their atoms to the output
void createImplicitFiles(std::vector<std::unique_ptr<File>> &) override;
private:
class GOTFile : public SimpleFile {
public:
GOTFile(const ELFLinkingContext &eti) : SimpleFile("GOTFile") {}
llvm::BumpPtrAllocator _alloc;
};
};
template <class ELFT>
@ -43,9 +36,9 @@ template <class ELFT>
void AArch64DynamicLibraryWriter<ELFT>::createImplicitFiles(
std::vector<std::unique_ptr<File>> &result) {
DynamicLibraryWriter<ELFT>::createImplicitFiles(result);
auto gotFile = llvm::make_unique<GOTFile>(this->_ctx);
gotFile->addAtom(*new (gotFile->_alloc) GlobalOffsetTableAtom(*gotFile));
gotFile->addAtom(*new (gotFile->_alloc) DynamicAtom(*gotFile));
auto gotFile = llvm::make_unique<SimpleFile>("GOTFile");
gotFile->addAtom(*new (gotFile->allocator()) GlobalOffsetTableAtom(*gotFile));
gotFile->addAtom(*new (gotFile->allocator()) DynamicAtom(*gotFile));
result.push_back(std::move(gotFile));
}

View File

@ -24,13 +24,6 @@ public:
protected:
// Add any runtime files and their atoms to the output
void createImplicitFiles(std::vector<std::unique_ptr<File>> &) override;
private:
class GOTFile : public SimpleFile {
public:
GOTFile(const ELFLinkingContext &eti) : SimpleFile("GOTFile") {}
llvm::BumpPtrAllocator _alloc;
};
};
template <class ELFT>
@ -42,10 +35,10 @@ template <class ELFT>
void AArch64ExecutableWriter<ELFT>::createImplicitFiles(
std::vector<std::unique_ptr<File>> &result) {
ExecutableWriter<ELFT>::createImplicitFiles(result);
auto gotFile = llvm::make_unique<GOTFile>(this->_ctx);
gotFile->addAtom(*new (gotFile->_alloc) GlobalOffsetTableAtom(*gotFile));
auto gotFile = llvm::make_unique<SimpleFile>("GOTFile");
gotFile->addAtom(*new (gotFile->allocator()) GlobalOffsetTableAtom(*gotFile));
if (this->_ctx.isDynamic())
gotFile->addAtom(*new (gotFile->_alloc) DynamicAtom(*gotFile));
gotFile->addAtom(*new (gotFile->allocator()) DynamicAtom(*gotFile));
result.push_back(std::move(gotFile));
}

View File

@ -23,13 +23,6 @@ public:
protected:
// Add any runtime files and their atoms to the output
void createImplicitFiles(std::vector<std::unique_ptr<File>> &) override;
private:
class GOTFile : public SimpleFile {
public:
GOTFile(const ELFLinkingContext &eti) : SimpleFile("GOTFile") {}
llvm::BumpPtrAllocator _alloc;
};
};
template <class ELFT>
@ -41,9 +34,9 @@ template <class ELFT>
void X86DynamicLibraryWriter<ELFT>::createImplicitFiles(
std::vector<std::unique_ptr<File>> &result) {
DynamicLibraryWriter<ELFT>::createImplicitFiles(result);
auto gotFile = llvm::make_unique<GOTFile>(this->_ctx);
gotFile->addAtom(*new (gotFile->_alloc) GlobalOffsetTableAtom(*gotFile));
gotFile->addAtom(*new (gotFile->_alloc) DynamicAtom(*gotFile));
auto gotFile = llvm::make_unique<SimpleFile>("GOTFile");
gotFile->addAtom(*new (gotFile->allocator()) GlobalOffsetTableAtom(*gotFile));
gotFile->addAtom(*new (gotFile->allocator()) DynamicAtom(*gotFile));
result.push_back(std::move(gotFile));
}

View File

@ -25,13 +25,6 @@ public:
protected:
// Add any runtime files and their atoms to the output
void createImplicitFiles(std::vector<std::unique_ptr<File>> &) override;
private:
class GOTFile : public SimpleFile {
public:
GOTFile(const ELFLinkingContext &eti) : SimpleFile("GOTFile") {}
llvm::BumpPtrAllocator _alloc;
};
};
X86_64DynamicLibraryWriter::X86_64DynamicLibraryWriter(
@ -41,9 +34,9 @@ X86_64DynamicLibraryWriter::X86_64DynamicLibraryWriter(
void X86_64DynamicLibraryWriter::createImplicitFiles(
std::vector<std::unique_ptr<File>> &result) {
DynamicLibraryWriter::createImplicitFiles(result);
auto gotFile = llvm::make_unique<GOTFile>(this->_ctx);
gotFile->addAtom(*new (gotFile->_alloc) GlobalOffsetTableAtom(*gotFile));
gotFile->addAtom(*new (gotFile->_alloc) DynamicAtom(*gotFile));
auto gotFile = llvm::make_unique<SimpleFile>("GOTFile");
gotFile->addAtom(*new (gotFile->allocator()) GlobalOffsetTableAtom(*gotFile));
gotFile->addAtom(*new (gotFile->allocator()) DynamicAtom(*gotFile));
result.push_back(std::move(gotFile));
}

View File

@ -26,19 +26,13 @@ protected:
void
createImplicitFiles(std::vector<std::unique_ptr<File>> &result) override {
ExecutableWriter::createImplicitFiles(result);
auto gotFile = llvm::make_unique<GOTFile>(this->_ctx);
gotFile->addAtom(*new (gotFile->_alloc) GlobalOffsetTableAtom(*gotFile));
auto gotFile = llvm::make_unique<SimpleFile>("GOTFile");
gotFile->addAtom(*new (gotFile->allocator())
GlobalOffsetTableAtom(*gotFile));
if (this->_ctx.isDynamic())
gotFile->addAtom(*new (gotFile->_alloc) DynamicAtom(*gotFile));
gotFile->addAtom(*new (gotFile->allocator()) DynamicAtom(*gotFile));
result.push_back(std::move(gotFile));
}
private:
class GOTFile : public SimpleFile {
public:
GOTFile(const ELFLinkingContext &eti) : SimpleFile("GOTFile") {}
llvm::BumpPtrAllocator _alloc;
};
};
} // namespace elf