[lld] r226259 - [ELF] Make `TargetRelocationHandler` a regular non-template class
Simon Atanasyan
simon at atanasyan.com
Fri Jan 16 00:57:58 PST 2015
Author: atanasyan
Date: Fri Jan 16 02:57:58 2015
New Revision: 226259
URL: http://llvm.org/viewvc/llvm-project?rev=226259&view=rev
Log:
[ELF] Make `TargetRelocationHandler` a regular non-template class
This class defines a relocation handler interface. The interface does
not depend on the template argument so the argument is redundant.
Modified:
lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64RelocationHandler.h
lld/trunk/lib/ReaderWriter/ELF/DefaultTargetHandler.h
lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonRelocationHandler.h
lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.h
lld/trunk/lib/ReaderWriter/ELF/PPC/PPCTargetHandler.h
lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h
lld/trunk/lib/ReaderWriter/ELF/TargetHandler.h
lld/trunk/lib/ReaderWriter/ELF/X86/X86RelocationHandler.h
lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64RelocationHandler.h
Modified: lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64RelocationHandler.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64RelocationHandler.h?rev=226259&r1=226258&r2=226259&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64RelocationHandler.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64RelocationHandler.h Fri Jan 16 02:57:58 2015
@@ -18,11 +18,10 @@ typedef llvm::object::ELFType<llvm::supp
template <class ELFT> class AArch64TargetLayout;
-class AArch64TargetRelocationHandler final
- : public TargetRelocationHandler<AArch64ELFType> {
+class AArch64TargetRelocationHandler final : public TargetRelocationHandler {
public:
AArch64TargetRelocationHandler(ELFLinkingContext &targetInfo)
- : TargetRelocationHandler<AArch64ELFType>(targetInfo) {}
+ : TargetRelocationHandler(targetInfo) {}
std::error_code applyRelocation(ELFWriter &, llvm::FileOutputBuffer &,
const lld::AtomLayout &,
Modified: lld/trunk/lib/ReaderWriter/ELF/DefaultTargetHandler.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/DefaultTargetHandler.h?rev=226259&r1=226258&r2=226259&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/DefaultTargetHandler.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/DefaultTargetHandler.h Fri Jan 16 02:57:58 2015
@@ -27,7 +27,7 @@ public:
DefaultTargetHandler(ELFLinkingContext &context)
: TargetHandler<ELFT>(context) {}
- const TargetRelocationHandler<ELFT> &getRelocationHandler() const = 0;
+ const TargetRelocationHandler &getRelocationHandler() const = 0;
virtual std::unique_ptr<Reader> getObjReader(bool atomizeStrings) = 0;
Modified: lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonRelocationHandler.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonRelocationHandler.h?rev=226259&r1=226258&r2=226259&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonRelocationHandler.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonRelocationHandler.h Fri Jan 16 02:57:58 2015
@@ -18,13 +18,11 @@ namespace elf {
class HexagonTargetHandler;
-class HexagonTargetRelocationHandler final :
- public TargetRelocationHandler<HexagonELFType> {
+class HexagonTargetRelocationHandler final : public TargetRelocationHandler {
public:
HexagonTargetRelocationHandler(HexagonTargetLayout<HexagonELFType> &layout,
ELFLinkingContext &targetInfo)
- : TargetRelocationHandler<HexagonELFType>(targetInfo),
- _hexagonTargetLayout(layout) {}
+ : TargetRelocationHandler(targetInfo), _hexagonTargetLayout(layout) {}
std::error_code applyRelocation(ELFWriter &, llvm::FileOutputBuffer &,
const lld::AtomLayout &,
Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.h?rev=226259&r1=226258&r2=226259&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.h Fri Jan 16 02:57:58 2015
@@ -16,13 +16,11 @@ namespace elf {
class MipsTargetHandler;
-class MipsTargetRelocationHandler final
- : public TargetRelocationHandler<Mips32ElELFType> {
+class MipsTargetRelocationHandler final : public TargetRelocationHandler {
public:
MipsTargetRelocationHandler(MipsTargetLayout<Mips32ElELFType> &layout,
ELFLinkingContext &targetInfo)
- : TargetRelocationHandler<Mips32ElELFType>(targetInfo),
- _mipsTargetLayout(layout) {}
+ : TargetRelocationHandler(targetInfo), _mipsTargetLayout(layout) {}
std::error_code applyRelocation(ELFWriter &, llvm::FileOutputBuffer &,
const lld::AtomLayout &,
Modified: lld/trunk/lib/ReaderWriter/ELF/PPC/PPCTargetHandler.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/PPC/PPCTargetHandler.h?rev=226259&r1=226258&r2=226259&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/PPC/PPCTargetHandler.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/PPC/PPCTargetHandler.h Fri Jan 16 02:57:58 2015
@@ -23,11 +23,10 @@ public:
PPCTargetLayout(PPCLinkingContext &context) : TargetLayout<ELFT>(context) {}
};
-class PPCTargetRelocationHandler final
- : public TargetRelocationHandler<PPCELFType> {
+class PPCTargetRelocationHandler final : public TargetRelocationHandler {
public:
PPCTargetRelocationHandler(ELFLinkingContext &context)
- : TargetRelocationHandler<PPCELFType>(context) {}
+ : TargetRelocationHandler(context) {}
std::error_code applyRelocation(ELFWriter &, llvm::FileOutputBuffer &,
const lld::AtomLayout &,
Modified: lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h?rev=226259&r1=226258&r2=226259&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h Fri Jan 16 02:57:58 2015
@@ -391,7 +391,7 @@ void AtomSection<ELFT>::write(ELFWriter
return;
uint8_t *atomContent = chunkBuffer + ai->_fileOffset;
std::memcpy(atomContent, content.data(), contentSize);
- const TargetRelocationHandler<ELFT> &relHandler =
+ const TargetRelocationHandler &relHandler =
this->_context.template getTargetHandler<ELFT>().getRelocationHandler();
for (const auto ref : *definedAtom)
relHandler.applyRelocation(*writer, buffer, *ai, *ref);
Modified: lld/trunk/lib/ReaderWriter/ELF/TargetHandler.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/TargetHandler.h?rev=226259&r1=226258&r2=226259&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/TargetHandler.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/TargetHandler.h Fri Jan 16 02:57:58 2015
@@ -40,7 +40,7 @@ template <class ELFT> class ELFHeader;
template <class ELFT> class Section;
template <class ELFT> class TargetLayout;
-template <class ELFT> class TargetRelocationHandler {
+class TargetRelocationHandler {
public:
/// Constructor
TargetRelocationHandler(ELFLinkingContext &targetInfo)
@@ -86,7 +86,7 @@ public:
virtual TargetLayout<ELFT> &getTargetLayout() = 0;
/// Determine how relocations need to be applied.
- virtual const TargetRelocationHandler<ELFT> &getRelocationHandler() const = 0;
+ virtual const TargetRelocationHandler &getRelocationHandler() const = 0;
/// How does the target deal with reading input files.
virtual std::unique_ptr<Reader> getObjReader(bool) = 0;
Modified: lld/trunk/lib/ReaderWriter/ELF/X86/X86RelocationHandler.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/X86/X86RelocationHandler.h?rev=226259&r1=226258&r2=226259&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/X86/X86RelocationHandler.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/X86/X86RelocationHandler.h Fri Jan 16 02:57:58 2015
@@ -14,14 +14,12 @@
namespace lld {
namespace elf {
-template <class ELFT> class X86TargetLayout;
typedef llvm::object::ELFType<llvm::support::little, 2, false> X86ELFType;
-class X86TargetRelocationHandler final
- : public TargetRelocationHandler<X86ELFType> {
+class X86TargetRelocationHandler final : public TargetRelocationHandler {
public:
X86TargetRelocationHandler(ELFLinkingContext &targetInfo)
- : TargetRelocationHandler<X86ELFType>(targetInfo) {}
+ : TargetRelocationHandler(targetInfo) {}
std::error_code applyRelocation(ELFWriter &, llvm::FileOutputBuffer &,
const lld::AtomLayout &,
Modified: lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64RelocationHandler.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64RelocationHandler.h?rev=226259&r1=226258&r2=226259&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64RelocationHandler.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64RelocationHandler.h Fri Jan 16 02:57:58 2015
@@ -18,13 +18,12 @@ typedef llvm::object::ELFType<llvm::supp
template <class ELFT> class X86_64TargetLayout;
-class X86_64TargetRelocationHandler final
- : public TargetRelocationHandler<X86_64ELFType> {
+class X86_64TargetRelocationHandler final : public TargetRelocationHandler {
public:
X86_64TargetRelocationHandler(X86_64TargetLayout<X86_64ELFType> &layout,
ELFLinkingContext &targetInfo)
- : TargetRelocationHandler<X86_64ELFType>(targetInfo),
- _tlsSize(0), _x86_64Layout(layout) {}
+ : TargetRelocationHandler(targetInfo), _tlsSize(0),
+ _x86_64Layout(layout) {}
std::error_code applyRelocation(ELFWriter &, llvm::FileOutputBuffer &,
const lld::AtomLayout &,
More information about the llvm-commits
mailing list