ELF: Remove <Arch>ELFReader.h. NFC.

<Arch>ELFReader.h contains only a few typedefs. The typedefs are used
only by one class in <Arch>TargetHandler.h. Thus, the headers don't
worth to be independent files.

Since MipsELFReader.h contains code other than the boilerplate, I didn't
touch that file in this patch.

llvm-svn: 234056
This commit is contained in:
Rui Ueyama 2015-04-03 21:22:20 +00:00
parent 1662bfe077
commit fdcfe466e3
10 changed files with 46 additions and 162 deletions

View File

@ -1,30 +0,0 @@
//===- lib/ReaderWriter/ELF/AArch64/AArch64ELFReader.h --------------------===//
//
// The LLVM Linker
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLD_READER_WRITER_AARCH64_AARCH64_ELF_READER_H
#define LLD_READER_WRITER_AARCH64_AARCH64_ELF_READER_H
#include "ELFReader.h"
namespace lld {
namespace elf {
class AArch64LinkingContext;
typedef llvm::object::ELFType<llvm::support::little, 2, true> AArch64ELFType;
typedef ELFObjectReader<AArch64ELFType, AArch64LinkingContext,
lld::elf::ELFFile> AArch64ELFObjectReader;
typedef ELFDSOReader<AArch64ELFType, AArch64LinkingContext> AArch64ELFDSOReader;
} // namespace elf
} // namespace lld
#endif // LLD_READER_WRITER_AARCH64_AARCH64_ELF_READER_H

View File

@ -10,8 +10,8 @@
#ifndef LLD_READER_WRITER_ELF_AARCH64_AARCH64_TARGET_HANDLER_H #ifndef LLD_READER_WRITER_ELF_AARCH64_AARCH64_TARGET_HANDLER_H
#define LLD_READER_WRITER_ELF_AARCH64_AARCH64_TARGET_HANDLER_H #define LLD_READER_WRITER_ELF_AARCH64_AARCH64_TARGET_HANDLER_H
#include "AArch64ELFReader.h"
#include "AArch64RelocationHandler.h" #include "AArch64RelocationHandler.h"
#include "ELFReader.h"
#include "TargetLayout.h" #include "TargetLayout.h"
#include "lld/Core/Simple.h" #include "lld/Core/Simple.h"
@ -20,6 +20,11 @@ namespace elf {
class AArch64LinkingContext; class AArch64LinkingContext;
class AArch64TargetHandler final : public TargetHandler { class AArch64TargetHandler final : public TargetHandler {
typedef llvm::object::ELFType<llvm::support::little, 2, true> ELFTy;
typedef ELFObjectReader<ELFTy, AArch64LinkingContext, lld::elf::ELFFile>
ObjReader;
typedef ELFDSOReader<AArch64ELFType, AArch64LinkingContext> DSOReader;
public: public:
AArch64TargetHandler(AArch64LinkingContext &ctx); AArch64TargetHandler(AArch64LinkingContext &ctx);
@ -28,18 +33,18 @@ public:
} }
std::unique_ptr<Reader> getObjReader() override { std::unique_ptr<Reader> getObjReader() override {
return llvm::make_unique<AArch64ELFObjectReader>(_ctx); return llvm::make_unique<ObjReader>(_ctx);
} }
std::unique_ptr<Reader> getDSOReader() override { std::unique_ptr<Reader> getDSOReader() override {
return llvm::make_unique<AArch64ELFDSOReader>(_ctx); return llvm::make_unique<DSOReader>(_ctx);
} }
std::unique_ptr<Writer> getWriter() override; std::unique_ptr<Writer> getWriter() override;
private: private:
AArch64LinkingContext &_ctx; AArch64LinkingContext &_ctx;
std::unique_ptr<TargetLayout<AArch64ELFType>> _targetLayout; std::unique_ptr<TargetLayout<ELFTy>> _targetLayout;
std::unique_ptr<AArch64TargetRelocationHandler> _relocationHandler; std::unique_ptr<AArch64TargetRelocationHandler> _relocationHandler;
}; };

View File

@ -1,28 +0,0 @@
//===--------- lib/ReaderWriter/ELF/ARM/ARMELFReader.h --------------------===//
//
// The LLVM Linker
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLD_READER_WRITER_ARM_ARM_ELF_READER_H
#define LLD_READER_WRITER_ARM_ARM_ELF_READER_H
#include "ARMELFFile.h"
#include "ELFReader.h"
namespace lld {
namespace elf {
typedef llvm::object::ELFType<llvm::support::little, 2, false> ARMELFType;
typedef ELFObjectReader<ARMELFType, ARMLinkingContext, lld::elf::ARMELFFile>
ARMELFObjectReader;
typedef ELFDSOReader<ARMELFType, ARMLinkingContext> ARMELFDSOReader;
} // namespace elf
} // namespace lld
#endif // LLD_READER_WRITER_ARM_ARM_ELF_READER_H

View File

@ -11,8 +11,8 @@
#define LLD_READER_WRITER_ELF_ARM_ARM_TARGET_HANDLER_H #define LLD_READER_WRITER_ELF_ARM_ARM_TARGET_HANDLER_H
#include "ARMELFFile.h" #include "ARMELFFile.h"
#include "ARMELFReader.h"
#include "ARMRelocationHandler.h" #include "ARMRelocationHandler.h"
#include "ELFReader.h"
#include "TargetLayout.h" #include "TargetLayout.h"
#include "llvm/ADT/Optional.h" #include "llvm/ADT/Optional.h"
@ -60,6 +60,11 @@ private:
}; };
class ARMTargetHandler final : public TargetHandler { class ARMTargetHandler final : public TargetHandler {
typedef llvm::object::ELFType<llvm::support::little, 2, false> ELFTy;
typedef ELFObjectReader<ELFTy, ARMLinkingContext, lld::elf::ARMELFFile>
ObjReader;
typedef ELFDSOReader<ELFTy, ARMLinkingContext> DSOReader;
public: public:
ARMTargetHandler(ARMLinkingContext &ctx); ARMTargetHandler(ARMLinkingContext &ctx);
@ -68,18 +73,18 @@ public:
} }
std::unique_ptr<Reader> getObjReader() override { std::unique_ptr<Reader> getObjReader() override {
return llvm::make_unique<ARMELFObjectReader>(_ctx); return llvm::make_unique<ObjReader>(_ctx);
} }
std::unique_ptr<Reader> getDSOReader() override { std::unique_ptr<Reader> getDSOReader() override {
return llvm::make_unique<ARMELFDSOReader>(_ctx); return llvm::make_unique<DSOReader>(_ctx);
} }
std::unique_ptr<Writer> getWriter() override; std::unique_ptr<Writer> getWriter() override;
private: private:
ARMLinkingContext &_ctx; ARMLinkingContext &_ctx;
std::unique_ptr<ARMTargetLayout<ARMELFType>> _targetLayout; std::unique_ptr<ARMTargetLayout<ELFTy>> _targetLayout;
std::unique_ptr<ARMTargetRelocationHandler> _relocationHandler; std::unique_ptr<ARMTargetRelocationHandler> _relocationHandler;
}; };

View File

@ -1,28 +0,0 @@
//===- lib/ReaderWriter/ELF/HexagonELFReader.h ----------------------------===//
//
// The LLVM Linker
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLD_READER_WRITER_HEXAGON_ELF_READER_H
#define LLD_READER_WRITER_HEXAGON_ELF_READER_H
#include "ELFReader.h"
#include "HexagonELFFile.h"
namespace lld {
namespace elf {
typedef llvm::object::ELFType<llvm::support::little, 2, false> HexagonELFType;
typedef ELFObjectReader<HexagonELFType, HexagonLinkingContext,
lld::elf::HexagonELFFile> HexagonELFObjectReader;
typedef ELFDSOReader<HexagonELFType, HexagonLinkingContext> HexagonELFDSOReader;
} // namespace elf
} // namespace lld
#endif // LLD_READER_WRITER_ELF_READER_H

View File

@ -10,7 +10,8 @@
#ifndef HEXAGON_TARGET_HANDLER_H #ifndef HEXAGON_TARGET_HANDLER_H
#define HEXAGON_TARGET_HANDLER_H #define HEXAGON_TARGET_HANDLER_H
#include "HexagonELFReader.h" #include "ELFReader.h"
#include "HexagonELFFile.h"
#include "HexagonExecutableAtoms.h" #include "HexagonExecutableAtoms.h"
#include "HexagonRelocationHandler.h" #include "HexagonRelocationHandler.h"
#include "HexagonSectionChunks.h" #include "HexagonSectionChunks.h"
@ -97,6 +98,11 @@ private:
/// \brief TargetHandler for Hexagon /// \brief TargetHandler for Hexagon
class HexagonTargetHandler final : public TargetHandler { class HexagonTargetHandler final : public TargetHandler {
typedef llvm::object::ELFType<llvm::support::little, 2, false> ELFTy;
typedef ELFObjectReader<ELFTy, HexagonLinkingContext,
lld::elf::HexagonELFFile> ObjReader;
typedef ELFDSOReader<ELFTy, HexagonLinkingContext> ELFDSOReader;
public: public:
HexagonTargetHandler(HexagonLinkingContext &targetInfo); HexagonTargetHandler(HexagonLinkingContext &targetInfo);
@ -105,19 +111,19 @@ public:
} }
std::unique_ptr<Reader> getObjReader() override { std::unique_ptr<Reader> getObjReader() override {
return llvm::make_unique<HexagonELFObjectReader>(_ctx); return llvm::make_unique<ObjReader>(_ctx);
} }
std::unique_ptr<Reader> getDSOReader() override { std::unique_ptr<Reader> getDSOReader() override {
return llvm::make_unique<HexagonELFDSOReader>(_ctx); return llvm::make_unique<ELFDSOReader>(_ctx);
} }
std::unique_ptr<Writer> getWriter() override; std::unique_ptr<Writer> getWriter() override;
private: private:
HexagonLinkingContext &_ctx; HexagonLinkingContext &_ctx;
std::unique_ptr<HexagonRuntimeFile<HexagonELFType>> _runtimeFile; std::unique_ptr<HexagonRuntimeFile<ELFTy>> _runtimeFile;
std::unique_ptr<HexagonTargetLayout<HexagonELFType>> _targetLayout; std::unique_ptr<HexagonTargetLayout<ELFTy>> _targetLayout;
std::unique_ptr<HexagonTargetRelocationHandler> _relocationHandler; std::unique_ptr<HexagonTargetRelocationHandler> _relocationHandler;
}; };

View File

@ -1,28 +0,0 @@
//===- lib/ReaderWriter/ELF/X86/X86ELFReader.h ----------------------------===//
//
// The LLVM Linker
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLD_READER_WRITER_X86_X86_ELF_READER_H
#define LLD_READER_WRITER_X86_X86_ELF_READER_H
#include "ELFReader.h"
namespace lld {
namespace elf {
class X86LinkingContext;
typedef llvm::object::ELFType<llvm::support::little, 2, false> X86ELFType;
typedef ELFObjectReader<X86ELFType, X86LinkingContext, lld::elf::ELFFile>
X86ELFObjectReader;
typedef ELFDSOReader<X86ELFType, X86LinkingContext> X86ELFDSOReader;
} // namespace elf
} // namespace lld
#endif // LLD_READER_WRITER_X86_X86_ELF_READER_H

View File

@ -11,7 +11,7 @@
#define LLD_READER_WRITER_ELF_X86_TARGET_HANDLER_H #define LLD_READER_WRITER_ELF_X86_TARGET_HANDLER_H
#include "TargetLayout.h" #include "TargetLayout.h"
#include "X86ELFReader.h" #include "ELFReader.h"
#include "X86RelocationHandler.h" #include "X86RelocationHandler.h"
namespace lld { namespace lld {
@ -20,6 +20,11 @@ namespace elf {
class X86LinkingContext; class X86LinkingContext;
class X86TargetHandler final : public TargetHandler { class X86TargetHandler final : public TargetHandler {
typedef llvm::object::ELFType<llvm::support::little, 2, false> ELFTy;
typedef ELFObjectReader<ELFTy, X86LinkingContext, lld::elf::ELFFile>
ObjReader;
typedef ELFDSOReader<ELFTy, X86LinkingContext> DSOReader;
public: public:
X86TargetHandler(X86LinkingContext &ctx); X86TargetHandler(X86LinkingContext &ctx);
@ -28,18 +33,18 @@ public:
} }
std::unique_ptr<Reader> getObjReader() override { std::unique_ptr<Reader> getObjReader() override {
return llvm::make_unique<X86ELFObjectReader>(_ctx); return llvm::make_unique<ObjReader>(_ctx);
} }
std::unique_ptr<Reader> getDSOReader() override { std::unique_ptr<Reader> getDSOReader() override {
return llvm::make_unique<X86ELFDSOReader>(_ctx); return llvm::make_unique<DSOReader>(_ctx);
} }
std::unique_ptr<Writer> getWriter() override; std::unique_ptr<Writer> getWriter() override;
protected: protected:
X86LinkingContext &_ctx; X86LinkingContext &_ctx;
std::unique_ptr<TargetLayout<X86ELFType>> _targetLayout; std::unique_ptr<TargetLayout<ELFTy>> _targetLayout;
std::unique_ptr<X86TargetRelocationHandler> _relocationHandler; std::unique_ptr<X86TargetRelocationHandler> _relocationHandler;
}; };
} // end namespace elf } // end namespace elf

View File

@ -1,28 +0,0 @@
//===- lib/ReaderWriter/ELF/X86_64/X86_64ELFReader.h ----------------------===//
//
// The LLVM Linker
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLD_READER_WRITER_X86_64_X86_64_ELF_READER_H
#define LLD_READER_WRITER_X86_64_X86_64_ELF_READER_H
#include "ELFReader.h"
namespace lld {
namespace elf {
class X86_64LinkingContext;
typedef llvm::object::ELFType<llvm::support::little, 2, true> X86_64ELFType;
typedef ELFObjectReader<X86_64ELFType, X86_64LinkingContext, lld::elf::ELFFile>
X86_64ELFObjectReader;
typedef ELFDSOReader<X86_64ELFType, X86_64LinkingContext> X86_64ELFDSOReader;
} // namespace elf
} // namespace lld
#endif // LLD_READER_WRITER_ELF_X86_64_X86_64_READER_H

View File

@ -10,8 +10,8 @@
#ifndef LLD_READER_WRITER_ELF_X86_64_X86_64_TARGET_HANDLER_H #ifndef LLD_READER_WRITER_ELF_X86_64_X86_64_TARGET_HANDLER_H
#define LLD_READER_WRITER_ELF_X86_64_X86_64_TARGET_HANDLER_H #define LLD_READER_WRITER_ELF_X86_64_X86_64_TARGET_HANDLER_H
#include "ELFReader.h"
#include "TargetLayout.h" #include "TargetLayout.h"
#include "X86_64ELFReader.h"
#include "X86_64LinkingContext.h" #include "X86_64LinkingContext.h"
#include "X86_64RelocationHandler.h" #include "X86_64RelocationHandler.h"
#include "lld/Core/Simple.h" #include "lld/Core/Simple.h"
@ -58,6 +58,11 @@ private:
}; };
class X86_64TargetHandler : public TargetHandler { class X86_64TargetHandler : public TargetHandler {
typedef llvm::object::ELFType<llvm::support::little, 2, true> ELFTy;
typedef ELFObjectReader<ELFTy, X86_64LinkingContext, lld::elf::ELFFile>
ObjReader;
typedef ELFDSOReader<ELFTy, X86_64LinkingContext> DSOReader;
public: public:
X86_64TargetHandler(X86_64LinkingContext &ctx); X86_64TargetHandler(X86_64LinkingContext &ctx);
@ -66,11 +71,11 @@ public:
} }
std::unique_ptr<Reader> getObjReader() override { std::unique_ptr<Reader> getObjReader() override {
return llvm::make_unique<X86_64ELFObjectReader>(_ctx); return llvm::make_unique<ObjReader>(_ctx);
} }
std::unique_ptr<Reader> getDSOReader() override { std::unique_ptr<Reader> getDSOReader() override {
return llvm::make_unique<X86_64ELFDSOReader>(_ctx); return llvm::make_unique<DSOReader>(_ctx);
} }
std::unique_ptr<Writer> getWriter() override; std::unique_ptr<Writer> getWriter() override;