[lld] r203402 - [Mips] Do not inherit MipsDynamicLibraryWriter and MipsExecutableWriter
Simon Atanasyan
simon at atanasyan.com
Sun Mar 9 06:05:09 PDT 2014
Author: atanasyan
Date: Sun Mar 9 08:05:09 2014
New Revision: 203402
URL: http://llvm.org/viewvc/llvm-project?rev=203402&view=rev
Log:
[Mips] Do not inherit MipsDynamicLibraryWriter and MipsExecutableWriter
from MipsELFWriter class. MipsELFWriter is just a helper.
Modified:
lld/trunk/lib/ReaderWriter/ELF/Mips/MipsDynamicLibraryWriter.h
lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFWriters.h
lld/trunk/lib/ReaderWriter/ELF/Mips/MipsExecutableWriter.h
Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsDynamicLibraryWriter.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsDynamicLibraryWriter.h?rev=203402&r1=203401&r2=203402&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsDynamicLibraryWriter.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsDynamicLibraryWriter.h Sun Mar 9 08:05:09 2014
@@ -20,8 +20,7 @@ namespace elf {
template <typename ELFT> class MipsTargetLayout;
template <class ELFT>
-class MipsDynamicLibraryWriter : public DynamicLibraryWriter<ELFT>,
- public MipsELFWriter<ELFT> {
+class MipsDynamicLibraryWriter : public DynamicLibraryWriter<ELFT> {
public:
MipsDynamicLibraryWriter(MipsLinkingContext &context,
MipsTargetLayout<ELFT> &layout);
@@ -34,7 +33,7 @@ protected:
error_code setELFHeader() override {
DynamicLibraryWriter<ELFT>::setELFHeader();
- MipsELFWriter<ELFT>::setELFHeader(*this->_elfHeader);
+ _writeHelper.setELFHeader(*this->_elfHeader);
return error_code::success();
}
@@ -51,6 +50,7 @@ private:
}
}
+ MipsELFWriter<ELFT> _writeHelper;
std::unique_ptr<MipsRuntimeFile<ELFT>> _mipsRuntimeFile;
MipsLinkingContext &_mipsContext;
MipsTargetLayout<Mips32ElELFType> &_mipsTargetLayout;
@@ -60,7 +60,7 @@ template <class ELFT>
MipsDynamicLibraryWriter<ELFT>::MipsDynamicLibraryWriter(
MipsLinkingContext &context, MipsTargetLayout<ELFT> &layout)
: DynamicLibraryWriter<ELFT>(context, layout),
- MipsELFWriter<ELFT>(context, layout),
+ _writeHelper(context, layout),
_mipsRuntimeFile(new MipsRuntimeFile<ELFT>(context)),
_mipsContext(context), _mipsTargetLayout(layout) {}
@@ -78,7 +78,7 @@ template <class ELFT>
void MipsDynamicLibraryWriter<ELFT>::finalizeDefaultAtomValues() {
// Finalize the atom values that are part of the parent.
DynamicLibraryWriter<ELFT>::finalizeDefaultAtomValues();
- MipsELFWriter<ELFT>::finalizeMipsRuntimeAtomValues();
+ _writeHelper.finalizeMipsRuntimeAtomValues();
}
/// \brief create dynamic table
Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFWriters.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFWriters.h?rev=203402&r1=203401&r2=203402&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFWriters.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFWriters.h Sun Mar 9 08:05:09 2014
@@ -23,7 +23,6 @@ public:
MipsTargetLayout<ELFT> &targetLayout)
: _mipsLinkingContext(context), _mipsTargetLayout(targetLayout) {}
-protected:
bool setELFHeader(ELFHeader<ELFT> &elfHeader) {
elfHeader.e_version(1);
elfHeader.e_ident(llvm::ELF::EI_VERSION, llvm::ELF::EV_CURRENT);
Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsExecutableWriter.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsExecutableWriter.h?rev=203402&r1=203401&r2=203402&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsExecutableWriter.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsExecutableWriter.h Sun Mar 9 08:05:09 2014
@@ -20,8 +20,7 @@ namespace elf {
template <typename ELFT> class MipsTargetLayout;
template <class ELFT>
-class MipsExecutableWriter : public ExecutableWriter<ELFT>,
- public MipsELFWriter<ELFT> {
+class MipsExecutableWriter : public ExecutableWriter<ELFT> {
public:
MipsExecutableWriter(MipsLinkingContext &context,
MipsTargetLayout<ELFT> &layout);
@@ -36,7 +35,7 @@ protected:
error_code setELFHeader() override {
ExecutableWriter<ELFT>::setELFHeader();
- MipsELFWriter<ELFT>::setELFHeader(*this->_elfHeader);
+ _writeHelper.setELFHeader(*this->_elfHeader);
return error_code::success();
}
@@ -53,6 +52,7 @@ private:
}
}
+ MipsELFWriter<ELFT> _writeHelper;
std::unique_ptr<MipsRuntimeFile<ELFT>> _mipsRuntimeFile;
MipsLinkingContext &_mipsContext;
MipsTargetLayout<Mips32ElELFType> &_mipsTargetLayout;
@@ -62,7 +62,7 @@ template <class ELFT>
MipsExecutableWriter<ELFT>::MipsExecutableWriter(MipsLinkingContext &context,
MipsTargetLayout<ELFT> &layout)
: ExecutableWriter<ELFT>(context, layout),
- MipsELFWriter<ELFT>(context, layout),
+ _writeHelper(context, layout),
_mipsRuntimeFile(new MipsRuntimeFile<ELFT>(context)),
_mipsContext(context), _mipsTargetLayout(layout) {}
@@ -74,7 +74,7 @@ void MipsExecutableWriter<ELFT>::buildDy
// FIXME (simon): Consider to move this check to the
// MipsELFUndefinedAtom class method. That allows to
// handle more complex coditions in the future.
- if (this->hasGlobalGOTEntry(a))
+ if (_writeHelper.hasGlobalGOTEntry(a))
this->_dynamicSymbolTable->addSymbol(a, ELF::SHN_UNDEF);
ExecutableWriter<ELFT>::buildDynamicSymbolTable(file);
@@ -94,7 +94,7 @@ template <class ELFT>
void MipsExecutableWriter<ELFT>::finalizeDefaultAtomValues() {
// Finalize the atom values that are part of the parent.
ExecutableWriter<ELFT>::finalizeDefaultAtomValues();
- MipsELFWriter<ELFT>::finalizeMipsRuntimeAtomValues();
+ _writeHelper.finalizeMipsRuntimeAtomValues();
}
/// \brief create dynamic table
More information about the llvm-commits
mailing list