Index: lib/ReaderWriter/ELF/AArch64/AArch64ELFFile.h =================================================================== --- lib/ReaderWriter/ELF/AArch64/AArch64ELFFile.h +++ lib/ReaderWriter/ELF/AArch64/AArch64ELFFile.h @@ -29,12 +29,6 @@ } }; -template class AArch64DynamicFile : public DynamicFile { -public: - AArch64DynamicFile(const AArch64LinkingContext &context, StringRef name) - : DynamicFile(context, name) {} -}; - } // elf } // lld Index: lib/ReaderWriter/ELF/AArch64/AArch64ELFReader.h =================================================================== --- lib/ReaderWriter/ELF/AArch64/AArch64ELFReader.h +++ lib/ReaderWriter/ELF/AArch64/AArch64ELFReader.h @@ -18,16 +18,6 @@ typedef llvm::object::ELFType AArch64ELFType; -struct AArch64DynamicFileCreateELFTraits { - typedef llvm::ErrorOr> result_type; - - template - static result_type create(std::unique_ptr mb, - AArch64LinkingContext &ctx) { - return lld::elf::AArch64DynamicFile::create(std::move(mb), ctx); - } -}; - struct AArch64ELFFileCreateELFTraits { typedef llvm::ErrorOr> result_type; @@ -48,11 +38,10 @@ }; class AArch64ELFDSOReader - : public ELFDSOReader { + : public ELFDSOReader { public: AArch64ELFDSOReader(AArch64LinkingContext &ctx) - : ELFDSOReader(ctx, llvm::ELF::EM_AARCH64) {} }; Index: lib/ReaderWriter/ELF/ARM/ARMELFFile.h =================================================================== --- lib/ReaderWriter/ELF/ARM/ARMELFFile.h +++ lib/ReaderWriter/ELF/ARM/ARMELFFile.h @@ -121,12 +121,6 @@ } }; -template class ARMDynamicFile : public DynamicFile { -public: - ARMDynamicFile(const ARMLinkingContext &context, StringRef name) - : DynamicFile(context, name) {} -}; - } // elf } // lld Index: lib/ReaderWriter/ELF/ARM/ARMELFReader.h =================================================================== --- lib/ReaderWriter/ELF/ARM/ARMELFReader.h +++ lib/ReaderWriter/ELF/ARM/ARMELFReader.h @@ -18,16 +18,6 @@ typedef llvm::object::ELFType ARMELFType; -struct ARMDynamicFileCreateELFTraits { - typedef llvm::ErrorOr> result_type; - - template - static result_type create(std::unique_ptr mb, - ARMLinkingContext &ctx) { - return lld::elf::ARMDynamicFile::create(std::move(mb), ctx); - } -}; - struct ARMELFFileCreateELFTraits { typedef llvm::ErrorOr> result_type; @@ -48,12 +38,10 @@ }; class ARMELFDSOReader - : public ELFDSOReader { + : public ELFDSOReader { public: ARMELFDSOReader(ARMLinkingContext &ctx) - : ELFDSOReader(ctx, llvm::ELF::EM_ARM) {} + : ELFDSOReader(ctx, llvm::ELF::EM_ARM) {} }; } // namespace elf Index: lib/ReaderWriter/ELF/ELFReader.h =================================================================== --- lib/ReaderWriter/ELF/ELFReader.h +++ lib/ReaderWriter/ELF/ELFReader.h @@ -57,7 +57,17 @@ uint64_t _machine; }; -template +struct DynamicFileCreateELFTraits { + typedef llvm::ErrorOr> result_type; + + template + static result_type create(std::unique_ptr mb, + ContextT &ctx) { + return DynamicFile::create(std::move(mb), ctx); + } +}; + +template class ELFDSOReader : public Reader { public: typedef llvm::object::Elf_Ehdr_Impl Elf_Ehdr; @@ -76,9 +86,9 @@ std::vector> &result) const override { std::size_t maxAlignment = 1ULL << llvm::countTrailingZeros(uintptr_t(mb->getBufferStart())); - auto f = - createELF(llvm::object::getElfArchType(mb->getBuffer()), - maxAlignment, std::move(mb), _ctx); + auto f = createELF( + llvm::object::getElfArchType(mb->getBuffer()), + maxAlignment, std::move(mb), _ctx); if (std::error_code ec = f.getError()) return ec; result.push_back(std::move(*f)); Index: lib/ReaderWriter/ELF/Hexagon/HexagonELFFile.h =================================================================== --- lib/ReaderWriter/ELF/Hexagon/HexagonELFFile.h +++ lib/ReaderWriter/ELF/Hexagon/HexagonELFFile.h @@ -153,12 +153,6 @@ } }; -template class HexagonDynamicFile : public DynamicFile { -public: - HexagonDynamicFile(const HexagonLinkingContext &context, StringRef name) - : DynamicFile(context, name) {} -}; - } // elf } // lld Index: lib/ReaderWriter/ELF/Hexagon/HexagonELFReader.h =================================================================== --- lib/ReaderWriter/ELF/Hexagon/HexagonELFReader.h +++ lib/ReaderWriter/ELF/Hexagon/HexagonELFReader.h @@ -18,16 +18,6 @@ typedef llvm::object::ELFType HexagonELFType; -struct HexagonDynamicFileCreateELFTraits { - typedef llvm::ErrorOr> result_type; - - template - static result_type create(std::unique_ptr mb, - HexagonLinkingContext &ctx) { - return lld::elf::HexagonDynamicFile::create(std::move(mb), ctx); - } -}; - struct HexagonELFFileCreateELFTraits { typedef llvm::ErrorOr> result_type; @@ -48,11 +38,10 @@ }; class HexagonELFDSOReader - : public ELFDSOReader { + : public ELFDSOReader { public: HexagonELFDSOReader(HexagonLinkingContext &ctx) - : ELFDSOReader(ctx, llvm::ELF::EM_HEXAGON) {} }; Index: lib/ReaderWriter/ELF/Mips/MipsELFFile.h =================================================================== --- lib/ReaderWriter/ELF/Mips/MipsELFFile.h +++ lib/ReaderWriter/ELF/Mips/MipsELFFile.h @@ -323,12 +323,6 @@ } }; -template class MipsDynamicFile : public DynamicFile { -public: - MipsDynamicFile(const MipsLinkingContext &context, StringRef name) - : DynamicFile(context, name) {} -}; - } // elf } // lld Index: lib/ReaderWriter/ELF/Mips/MipsELFReader.h =================================================================== --- lib/ReaderWriter/ELF/Mips/MipsELFReader.h +++ lib/ReaderWriter/ELF/Mips/MipsELFReader.h @@ -27,16 +27,6 @@ } }; -struct MipsDynamicFileCreateELFTraits { - typedef llvm::ErrorOr> result_type; - - template - static result_type create(std::unique_ptr mb, - MipsLinkingContext &ctx) { - return lld::elf::MipsDynamicFile::create(std::move(mb), ctx); - } -}; - template class MipsELFObjectReader : public ELFObjectReader -class MipsELFDSOReader - : public ELFDSOReader { - typedef ELFDSOReader - BaseReaderType; +class MipsELFDSOReader : public ELFDSOReader { + typedef ELFDSOReader BaseReaderType; public: MipsELFDSOReader(MipsLinkingContext &ctx) Index: lib/ReaderWriter/ELF/X86/X86ELFFile.h =================================================================== --- lib/ReaderWriter/ELF/X86/X86ELFFile.h +++ lib/ReaderWriter/ELF/X86/X86ELFFile.h @@ -29,12 +29,6 @@ } }; -template class X86DynamicFile : public DynamicFile { -public: - X86DynamicFile(const X86LinkingContext &context, StringRef name) - : DynamicFile(context, name) {} -}; - } // elf } // lld Index: lib/ReaderWriter/ELF/X86/X86ELFReader.h =================================================================== --- lib/ReaderWriter/ELF/X86/X86ELFReader.h +++ lib/ReaderWriter/ELF/X86/X86ELFReader.h @@ -18,16 +18,6 @@ typedef llvm::object::ELFType X86ELFType; -struct X86DynamicFileCreateELFTraits { - typedef llvm::ErrorOr> result_type; - - template - static result_type create(std::unique_ptr mb, - X86LinkingContext &ctx) { - return lld::elf::X86DynamicFile::create(std::move(mb), ctx); - } -}; - struct X86ELFFileCreateELFTraits { typedef llvm::ErrorOr> result_type; @@ -48,11 +38,10 @@ }; class X86ELFDSOReader - : public ELFDSOReader { + : public ELFDSOReader { public: X86ELFDSOReader(X86LinkingContext &ctx) - : ELFDSOReader(ctx, llvm::ELF::EM_386) {} }; Index: lib/ReaderWriter/ELF/X86_64/X86_64ELFFile.h =================================================================== --- lib/ReaderWriter/ELF/X86_64/X86_64ELFFile.h +++ lib/ReaderWriter/ELF/X86_64/X86_64ELFFile.h @@ -29,12 +29,6 @@ } }; -template class X86_64DynamicFile : public DynamicFile { -public: - X86_64DynamicFile(const X86_64LinkingContext &context, StringRef name) - : DynamicFile(context, name) {} -}; - } // elf } // lld Index: lib/ReaderWriter/ELF/X86_64/X86_64ELFReader.h =================================================================== --- lib/ReaderWriter/ELF/X86_64/X86_64ELFReader.h +++ lib/ReaderWriter/ELF/X86_64/X86_64ELFReader.h @@ -18,16 +18,6 @@ typedef llvm::object::ELFType X86_64ELFType; -struct X86_64DynamicFileCreateELFTraits { - typedef llvm::ErrorOr> result_type; - - template - static result_type create(std::unique_ptr mb, - X86_64LinkingContext &ctx) { - return lld::elf::X86_64DynamicFile::create(std::move(mb), ctx); - } -}; - struct X86_64ELFFileCreateELFTraits { typedef llvm::ErrorOr> result_type; @@ -48,11 +38,10 @@ }; class X86_64ELFDSOReader - : public ELFDSOReader { + : public ELFDSOReader { public: X86_64ELFDSOReader(X86_64LinkingContext &ctx) - : ELFDSOReader(ctx, llvm::ELF::EM_X86_64) {} };