[lld] r234823 - ELF: Define ELF{32, 64}{LE, BE} types and use them everywhere.
Aaron Ballman
aaron at aaronballman.com
Tue Apr 14 06:37:39 PDT 2015
On Mon, Apr 13, 2015 at 8:31 PM, Rui Ueyama <ruiu at google.com> wrote:
> Author: ruiu
> Date: Mon Apr 13 19:31:28 2015
> New Revision: 234823
>
> URL: http://llvm.org/viewvc/llvm-project?rev=234823&view=rev
> Log:
> ELF: Define ELF{32,64}{LE,BE} types and use them everywhere.
>
> Removed:
> lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64ElfType.h
> Modified:
> lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h
> lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64RelocationHandler.h
> lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64TargetHandler.cpp
> lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64TargetHandler.h
> lld/trunk/lib/ReaderWriter/ELF/ARM/ARMRelocationHandler.h
> lld/trunk/lib/ReaderWriter/ELF/ARM/ARMTargetHandler.cpp
> lld/trunk/lib/ReaderWriter/ELF/ARM/ARMTargetHandler.h
> lld/trunk/lib/ReaderWriter/ELF/DynamicFile.cpp
> lld/trunk/lib/ReaderWriter/ELF/ELFFile.cpp
> lld/trunk/lib/ReaderWriter/ELF/ELFReader.h
> lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonDynamicLibraryWriter.h
> lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonExecutableAtoms.h
> lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonExecutableWriter.h
> lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonLinkingContext.h
> lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonRelocationHandler.h
> lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.h
> lld/trunk/lib/ReaderWriter/ELF/Mips/MipsLinkingContext.h
> lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp
> lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp
> lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler32EL.cpp
> lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler64EL.cpp
> lld/trunk/lib/ReaderWriter/ELF/X86/X86DynamicLibraryWriter.h
> lld/trunk/lib/ReaderWriter/ELF/X86/X86ExecutableWriter.h
> lld/trunk/lib/ReaderWriter/ELF/X86/X86RelocationHandler.h
> lld/trunk/lib/ReaderWriter/ELF/X86/X86TargetHandler.cpp
> lld/trunk/lib/ReaderWriter/ELF/X86/X86TargetHandler.h
> lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64DynamicLibraryWriter.h
> lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64ExecutableWriter.h
> lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64RelocationHandler.h
> lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.h
>
> Modified: lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h?rev=234823&r1=234822&r2=234823&view=diff
> ==============================================================================
> --- lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h (original)
> +++ lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h Mon Apr 13 19:31:28 2015
> @@ -46,6 +46,11 @@ std::unique_ptr<ELFLinkingContext> creat
> std::unique_ptr<ELFLinkingContext> createX86LinkingContext(llvm::Triple);
> std::unique_ptr<ELFLinkingContext> createX86_64LinkingContext(llvm::Triple);
>
> +typedef llvm::object::ELFType<llvm::support::little, 2, false> ELF32LE;
> +typedef llvm::object::ELFType<llvm::support::big, 2, false> ELF32BE;
> +typedef llvm::object::ELFType<llvm::support::little, 2, true> ELF64LE;
> +typedef llvm::object::ELFType<llvm::support::big, 2, true> ELF64BE;
> +
> class TargetRelocationHandler {
> public:
> virtual ~TargetRelocationHandler() {}
>
> 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=234823&r1=234822&r2=234823&view=diff
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64RelocationHandler.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64RelocationHandler.h Mon Apr 13 19:31:28 2015
> @@ -14,7 +14,6 @@
>
> namespace lld {
> namespace elf {
> -typedef llvm::object::ELFType<llvm::support::little, 2, true> AArch64ELFType;
>
> class AArch64TargetRelocationHandler final : public TargetRelocationHandler {
> public:
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64TargetHandler.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64TargetHandler.cpp?rev=234823&r1=234822&r2=234823&view=diff
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64TargetHandler.cpp (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64TargetHandler.cpp Mon Apr 13 19:31:28 2015
> @@ -17,16 +17,16 @@ using namespace lld;
> using namespace elf;
>
> AArch64TargetHandler::AArch64TargetHandler(AArch64LinkingContext &ctx)
> - : _ctx(ctx), _targetLayout(new TargetLayout<AArch64ELFType>(ctx)),
> + : _ctx(ctx), _targetLayout(new TargetLayout<ELF64LE>(ctx)),
> _relocationHandler(new AArch64TargetRelocationHandler()) {}
>
> std::unique_ptr<Writer> AArch64TargetHandler::getWriter() {
> switch (this->_ctx.getOutputELFType()) {
> case llvm::ELF::ET_EXEC:
> - return llvm::make_unique<AArch64ExecutableWriter<AArch64ELFType>>(
> - _ctx, *_targetLayout);
> + return llvm::make_unique<AArch64ExecutableWriter<ELF64LE>>(_ctx,
> + *_targetLayout);
> case llvm::ELF::ET_DYN:
> - return llvm::make_unique<AArch64DynamicLibraryWriter<AArch64ELFType>>(
> + return llvm::make_unique<AArch64DynamicLibraryWriter<ELF64LE>>(
> _ctx, *_targetLayout);
> case llvm::ELF::ET_REL:
> llvm_unreachable("TODO: support -r mode");
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64TargetHandler.h
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64TargetHandler.h?rev=234823&r1=234822&r2=234823&view=diff
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64TargetHandler.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64TargetHandler.h Mon Apr 13 19:31:28 2015
> @@ -20,9 +20,8 @@ namespace elf {
> class AArch64LinkingContext;
>
> class AArch64TargetHandler final : public TargetHandler {
> - typedef llvm::object::ELFType<llvm::support::little, 2, true> ELFT;
> - typedef ELFReader<ELFT, AArch64LinkingContext, ELFFile> ObjReader;
> - typedef ELFReader<ELFT, AArch64LinkingContext, DynamicFile> DSOReader;
> + typedef ELFReader<ELF64LE, AArch64LinkingContext, ELFFile> ObjReader;
> + typedef ELFReader<ELF64LE, AArch64LinkingContext, DynamicFile> DSOReader;
>
> public:
> AArch64TargetHandler(AArch64LinkingContext &ctx);
> @@ -43,7 +42,7 @@ public:
>
> private:
> AArch64LinkingContext &_ctx;
> - std::unique_ptr<TargetLayout<ELFT>> _targetLayout;
> + std::unique_ptr<TargetLayout<ELF64LE>> _targetLayout;
> std::unique_ptr<AArch64TargetRelocationHandler> _relocationHandler;
> };
>
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/ARM/ARMRelocationHandler.h
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ARM/ARMRelocationHandler.h?rev=234823&r1=234822&r2=234823&view=diff
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/ARM/ARMRelocationHandler.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/ARM/ARMRelocationHandler.h Mon Apr 13 19:31:28 2015
> @@ -15,13 +15,11 @@
> namespace lld {
> namespace elf {
>
> -typedef llvm::object::ELFType<llvm::support::little, 2, false> ARMELFType;
> -
> template <class ELFT> class ARMTargetLayout;
>
> class ARMTargetRelocationHandler final : public TargetRelocationHandler {
> public:
> - ARMTargetRelocationHandler(ARMTargetLayout<ARMELFType> &layout)
> + ARMTargetRelocationHandler(ARMTargetLayout<ELF32LE> &layout)
> : _armLayout(layout) {}
>
> std::error_code applyRelocation(ELFWriter &, llvm::FileOutputBuffer &,
> @@ -29,7 +27,7 @@ public:
> const Reference &) const override;
>
> private:
> - ARMTargetLayout<ARMELFType> &_armLayout;
> + ARMTargetLayout<ELF32LE> &_armLayout;
> };
>
> } // end namespace elf
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/ARM/ARMTargetHandler.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ARM/ARMTargetHandler.cpp?rev=234823&r1=234822&r2=234823&view=diff
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/ARM/ARMTargetHandler.cpp (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/ARM/ARMTargetHandler.cpp Mon Apr 13 19:31:28 2015
> @@ -16,14 +16,14 @@ using namespace lld;
> using namespace elf;
>
> ARMTargetHandler::ARMTargetHandler(ARMLinkingContext &ctx)
> - : _ctx(ctx), _targetLayout(new ARMTargetLayout<ARMELFType>(ctx)),
> + : _ctx(ctx), _targetLayout(new ARMTargetLayout<ELF32LE>(ctx)),
> _relocationHandler(new ARMTargetRelocationHandler(*_targetLayout)) {}
>
> std::unique_ptr<Writer> ARMTargetHandler::getWriter() {
> switch (this->_ctx.getOutputELFType()) {
> case llvm::ELF::ET_EXEC:
> - return llvm::make_unique<ARMExecutableWriter<ARMELFType>>(_ctx,
> - *_targetLayout);
> + return llvm::make_unique<ARMExecutableWriter<ELF32LE>>(_ctx,
> + *_targetLayout);
> default:
> llvm_unreachable("unsupported output type");
> }
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/ARM/ARMTargetHandler.h
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ARM/ARMTargetHandler.h?rev=234823&r1=234822&r2=234823&view=diff
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/ARM/ARMTargetHandler.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/ARM/ARMTargetHandler.h Mon Apr 13 19:31:28 2015
> @@ -58,9 +58,8 @@ private:
> };
>
> class ARMTargetHandler final : public TargetHandler {
> - typedef llvm::object::ELFType<llvm::support::little, 2, false> ELFT;
> - typedef ELFReader<ELFT, ARMLinkingContext, ARMELFFile> ObjReader;
> - typedef ELFReader<ELFT, ARMLinkingContext, DynamicFile> DSOReader;
> + typedef ELFReader<ELF32LE, ARMLinkingContext, ARMELFFile> ObjReader;
> + typedef ELFReader<ELF32LE, ARMLinkingContext, DynamicFile> DSOReader;
>
> public:
> ARMTargetHandler(ARMLinkingContext &ctx);
> @@ -81,7 +80,7 @@ public:
>
> private:
> ARMLinkingContext &_ctx;
> - std::unique_ptr<ARMTargetLayout<ELFT>> _targetLayout;
> + std::unique_ptr<ARMTargetLayout<ELF32LE>> _targetLayout;
> std::unique_ptr<ARMTargetRelocationHandler> _relocationHandler;
> };
>
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/DynamicFile.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/DynamicFile.cpp?rev=234823&r1=234822&r2=234823&view=diff
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/DynamicFile.cpp (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/DynamicFile.cpp Mon Apr 13 19:31:28 2015
> @@ -13,8 +13,6 @@
> #include "llvm/Object/ELF.h"
> #include "llvm/Support/Path.h"
>
> -using llvm::object::ELFType;
> -
> namespace lld {
> namespace elf {
>
> @@ -100,10 +98,10 @@ template <class ELFT> std::error_code Dy
> return std::error_code();
> }
>
> -template class DynamicFile<ELFType<llvm::support::little, 2, false>>;
> -template class DynamicFile<ELFType<llvm::support::big, 2, false>>;
> -template class DynamicFile<ELFType<llvm::support::little, 2, true>>;
> -template class DynamicFile<ELFType<llvm::support::big, 2, true>>;
> +template class DynamicFile<ELF32LE>;
> +template class DynamicFile<ELF32BE>;
> +template class DynamicFile<ELF64LE>;
> +template class DynamicFile<ELF64BE>;
>
> } // end namespace elf
> } // end namespace lld
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/ELFFile.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ELFFile.cpp?rev=234823&r1=234822&r2=234823&view=diff
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/ELFFile.cpp (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/ELFFile.cpp Mon Apr 13 19:31:28 2015
> @@ -10,8 +10,6 @@
> #include "ELFFile.h"
> #include "llvm/ADT/STLExtras.h"
>
> -using llvm::object::ELFType;
> -
> namespace lld {
> namespace elf {
>
> @@ -758,15 +756,15 @@ void RuntimeFile<ELFT>::addUndefinedAtom
> this->addAtom(*atom);
> }
>
> -template class ELFFile<ELFType<llvm::support::little, 2, false>>;
> -template class ELFFile<ELFType<llvm::support::big, 2, false>>;
> -template class ELFFile<ELFType<llvm::support::little, 2, true>>;
> -template class ELFFile<ELFType<llvm::support::big, 2, true>>;
> -
> -template class RuntimeFile<ELFType<llvm::support::little, 2, false>>;
> -template class RuntimeFile<ELFType<llvm::support::big, 2, false>>;
> -template class RuntimeFile<ELFType<llvm::support::little, 2, true>>;
> -template class RuntimeFile<ELFType<llvm::support::big, 2, true>>;
> +template class ELFFile<ELF32LE>;
> +template class ELFFile<ELF32BE>;
> +template class ELFFile<ELF64LE>;
> +template class ELFFile<ELF64BE>;
> +
> +template class RuntimeFile<ELF32LE>;
> +template class RuntimeFile<ELF32BE>;
> +template class RuntimeFile<ELF64LE>;
> +template class RuntimeFile<ELF64BE>;
I am now getting 20 warnings from MSVC from this code:
warning C4661: 'bool
lld::elf::ELFFile<lld::elf::ELF32LE>::isCompatible(unsigned
char,unsigned char)' : no suitable definition provided for explicit
template instantiation request
E:\llvm\llvm\tools\lld\lib\ReaderWriter\ELF\ELFFile.cpp 766
~Aaron
>
> } // end namespace elf
> } // end namespace lld
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/ELFReader.h
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ELFReader.h?rev=234823&r1=234822&r2=234823&view=diff
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/ELFReader.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/ELFReader.h Mon Apr 13 19:31:28 2015
> @@ -48,7 +48,6 @@ private:
> std::unique_ptr<File> createELF(std::unique_ptr<MemoryBuffer> mb) const {
> using namespace llvm::ELF;
> using namespace llvm::support;
> - using llvm::object::ELFType;
>
> if (uintptr_t(mb->getBufferStart()) & 1)
> llvm_unreachable("Invalid alignment for ELF file!");
> @@ -57,13 +56,13 @@ private:
> std::tie(size, endian) = llvm::object::getElfArchType(mb->getBuffer());
> File *file = nullptr;
> if (size == ELFCLASS32 && endian == ELFDATA2LSB) {
> - file = new FileT<ELFType<little, 2, false>>(std::move(mb), _ctx);
> + file = new FileT<ELF32LE>(std::move(mb), _ctx);
> } else if (size == ELFCLASS32 && endian == ELFDATA2MSB) {
> - file = new FileT<ELFType<big, 2, false>>(std::move(mb), _ctx);
> + file = new FileT<ELF32BE>(std::move(mb), _ctx);
> } else if (size == ELFCLASS64 && endian == ELFDATA2LSB) {
> - file = new FileT<ELFType<little, 2, true>>(std::move(mb), _ctx);
> + file = new FileT<ELF64LE>(std::move(mb), _ctx);
> } else if (size == ELFCLASS64 && endian == ELFDATA2MSB) {
> - file = new FileT<ELFType<big, 2, true>>(std::move(mb), _ctx);
> + file = new FileT<ELF64BE>(std::move(mb), _ctx);
> }
> if (!file)
> llvm_unreachable("Invalid ELF type!");
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonDynamicLibraryWriter.h
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonDynamicLibraryWriter.h?rev=234823&r1=234822&r2=234823&view=diff
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonDynamicLibraryWriter.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonDynamicLibraryWriter.h Mon Apr 13 19:31:28 2015
> @@ -18,7 +18,7 @@ namespace elf {
>
> class HexagonTargetLayout;
>
> -class HexagonDynamicLibraryWriter : public DynamicLibraryWriter<ELFT> {
> +class HexagonDynamicLibraryWriter : public DynamicLibraryWriter<ELF32LE> {
> public:
> HexagonDynamicLibraryWriter(HexagonLinkingContext &ctx,
> HexagonTargetLayout &layout);
> @@ -30,7 +30,7 @@ protected:
> void finalizeDefaultAtomValues() override;
>
> std::error_code setELFHeader() override {
> - DynamicLibraryWriter<ELFT>::setELFHeader();
> + DynamicLibraryWriter<ELF32LE>::setELFHeader();
> setHexagonELFHeader(*this->_elfHeader);
> return std::error_code();
> }
> @@ -42,12 +42,12 @@ private:
>
> HexagonDynamicLibraryWriter::HexagonDynamicLibraryWriter(
> HexagonLinkingContext &ctx, HexagonTargetLayout &layout)
> - : DynamicLibraryWriter<ELFT>(ctx, layout), _ctx(ctx),
> + : DynamicLibraryWriter<ELF32LE>(ctx, layout), _ctx(ctx),
> _targetLayout(layout) {}
>
> void HexagonDynamicLibraryWriter::createImplicitFiles(
> std::vector<std::unique_ptr<File>> &result) {
> - DynamicLibraryWriter<ELFT>::createImplicitFiles(result);
> + DynamicLibraryWriter<ELF32LE>::createImplicitFiles(result);
> // Add the default atoms as defined for hexagon
> auto file = llvm::make_unique<HexagonRuntimeFile>(_ctx);
> file->addAbsoluteAtom("_GLOBAL_OFFSET_TABLE_");
> @@ -57,7 +57,7 @@ void HexagonDynamicLibraryWriter::create
>
> void HexagonDynamicLibraryWriter::finalizeDefaultAtomValues() {
> // Finalize the atom values that are part of the parent.
> - DynamicLibraryWriter<ELFT>::finalizeDefaultAtomValues();
> + DynamicLibraryWriter<ELF32LE>::finalizeDefaultAtomValues();
> if (_ctx.isDynamic())
> finalizeHexagonRuntimeAtomValues(_targetLayout);
> }
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonExecutableAtoms.h
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonExecutableAtoms.h?rev=234823&r1=234822&r2=234823&view=diff
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonExecutableAtoms.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonExecutableAtoms.h Mon Apr 13 19:31:28 2015
> @@ -16,12 +16,10 @@ namespace lld {
> class ELFLinkingContext;
>
> namespace elf {
> -typedef llvm::object::ELFType<llvm::support::little, 2, false> ELFT;
> -
> -class HexagonRuntimeFile : public RuntimeFile<ELFT> {
> +class HexagonRuntimeFile : public RuntimeFile<ELF32LE> {
> public:
> HexagonRuntimeFile(ELFLinkingContext &ctx)
> - : RuntimeFile<ELFT>(ctx, "Hexagon runtime file") {}
> + : RuntimeFile<ELF32LE>(ctx, "Hexagon runtime file") {}
> };
> } // elf
> } // lld
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonExecutableWriter.h
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonExecutableWriter.h?rev=234823&r1=234822&r2=234823&view=diff
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonExecutableWriter.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonExecutableWriter.h Mon Apr 13 19:31:28 2015
> @@ -19,7 +19,7 @@ namespace elf {
>
> class HexagonTargetLayout;
>
> -class HexagonExecutableWriter : public ExecutableWriter<ELFT> {
> +class HexagonExecutableWriter : public ExecutableWriter<ELF32LE> {
> public:
> HexagonExecutableWriter(HexagonLinkingContext &ctx,
> HexagonTargetLayout &layout);
> @@ -31,7 +31,7 @@ protected:
> void finalizeDefaultAtomValues() override;
>
> std::error_code setELFHeader() override {
> - ExecutableWriter<ELFT>::setELFHeader();
> + ExecutableWriter<ELF32LE>::setELFHeader();
> setHexagonELFHeader(*this->_elfHeader);
> return std::error_code();
> }
> @@ -43,11 +43,12 @@ private:
>
> HexagonExecutableWriter::HexagonExecutableWriter(HexagonLinkingContext &ctx,
> HexagonTargetLayout &layout)
> - : ExecutableWriter<ELFT>(ctx, layout), _ctx(ctx), _targetLayout(layout) {}
> + : ExecutableWriter<ELF32LE>(ctx, layout), _ctx(ctx), _targetLayout(layout) {
> +}
>
> void HexagonExecutableWriter::createImplicitFiles(
> std::vector<std::unique_ptr<File>> &result) {
> - ExecutableWriter<ELFT>::createImplicitFiles(result);
> + ExecutableWriter<ELF32LE>::createImplicitFiles(result);
> // Add the default atoms as defined for hexagon
> auto file = llvm::make_unique<HexagonRuntimeFile>(_ctx);
> file->addAbsoluteAtom("_SDA_BASE_");
> @@ -60,7 +61,7 @@ void HexagonExecutableWriter::createImpl
>
> void HexagonExecutableWriter::finalizeDefaultAtomValues() {
> // Finalize the atom values that are part of the parent.
> - ExecutableWriter<ELFT>::finalizeDefaultAtomValues();
> + ExecutableWriter<ELF32LE>::finalizeDefaultAtomValues();
> AtomLayout *sdabaseAtom = _targetLayout.findAbsoluteAtom("_SDA_BASE_");
> sdabaseAtom->_virtualAddr = _targetLayout.getSDataSection()->virtualAddr();
> if (_ctx.isDynamic())
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonLinkingContext.h
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonLinkingContext.h?rev=234823&r1=234822&r2=234823&view=diff
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonLinkingContext.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonLinkingContext.h Mon Apr 13 19:31:28 2015
> @@ -18,8 +18,6 @@
> namespace lld {
> namespace elf {
>
> -typedef llvm::object::ELFType<llvm::support::little, 2, false> HexagonELFType;
> -
> class HexagonLinkingContext final : public ELFLinkingContext {
> public:
> static const int machine = llvm::ELF::EM_HEXAGON;
>
> 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=234823&r1=234822&r2=234823&view=diff
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonRelocationHandler.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonRelocationHandler.h Mon Apr 13 19:31:28 2015
> @@ -16,8 +16,6 @@ namespace elf {
> class HexagonTargetHandler;
> class HexagonTargetLayout;
>
> -typedef llvm::object::ELFType<llvm::support::little, 2, false> HexagonELFType;
> -
> class HexagonTargetRelocationHandler final : public TargetRelocationHandler {
> public:
> HexagonTargetRelocationHandler(HexagonTargetLayout &layout)
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.h
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.h?rev=234823&r1=234822&r2=234823&view=diff
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.h Mon Apr 13 19:31:28 2015
> @@ -20,8 +20,6 @@ namespace lld {
> namespace elf {
> class HexagonLinkingContext;
>
> -typedef llvm::object::ELFType<llvm::support::little, 2, false> ELFT;
> -
> /// \brief Handle Hexagon SData section
> template <class ELFT> class SDataSection : public AtomSection<ELFT> {
> public:
> @@ -37,27 +35,27 @@ public:
> };
>
> /// \brief TargetLayout for Hexagon
> -class HexagonTargetLayout final : public TargetLayout<ELFT> {
> +class HexagonTargetLayout final : public TargetLayout<ELF32LE> {
> public:
> enum HexagonSectionOrder {
> ORDER_SDATA = 205
> };
>
> HexagonTargetLayout(HexagonLinkingContext &hti)
> - : TargetLayout<ELFT>(hti), _sdataSection() {
> - _sdataSection = new (_alloc) SDataSection<ELFT>(hti);
> + : TargetLayout<ELF32LE>(hti), _sdataSection() {
> + _sdataSection = new (_alloc) SDataSection<ELF32LE>(hti);
> }
>
> /// \brief Return the section order for a input section
> - TargetLayout<ELFT>::SectionOrder
> + TargetLayout<ELF32LE>::SectionOrder
> getSectionOrder(StringRef name, int32_t contentType,
> int32_t contentPermissions) override {
> if ((contentType == DefinedAtom::typeDataFast) ||
> (contentType == DefinedAtom::typeZeroFillFast))
> return ORDER_SDATA;
>
> - return TargetLayout<ELFT>::getSectionOrder(name, contentType,
> - contentPermissions);
> + return TargetLayout<ELF32LE>::getSectionOrder(name, contentType,
> + contentPermissions);
> }
>
> /// \brief Return the appropriate input section name.
> @@ -69,31 +67,31 @@ public:
> default:
> break;
> }
> - return TargetLayout<ELFT>::getInputSectionName(da);
> + return TargetLayout<ELF32LE>::getInputSectionName(da);
> }
>
> /// \brief Gets or creates a section.
> - AtomSection<ELFT> *
> + AtomSection<ELF32LE> *
> createSection(StringRef name, int32_t contentType,
> DefinedAtom::ContentPermissions contentPermissions,
> - TargetLayout<ELFT>::SectionOrder sectionOrder) override {
> + TargetLayout<ELF32LE>::SectionOrder sectionOrder) override {
> if ((contentType == DefinedAtom::typeDataFast) ||
> (contentType == DefinedAtom::typeZeroFillFast))
> return _sdataSection;
> - return TargetLayout<ELFT>::createSection(name, contentType,
> - contentPermissions, sectionOrder);
> + return TargetLayout<ELF32LE>::createSection(
> + name, contentType, contentPermissions, sectionOrder);
> }
>
> /// \brief get the segment type for the section thats defined by the target
> - TargetLayout<ELFT>::SegmentType
> - getSegmentType(Section<ELFT> *section) const override {
> + TargetLayout<ELF32LE>::SegmentType
> + getSegmentType(Section<ELF32LE> *section) const override {
> if (section->order() == ORDER_SDATA)
> return PT_LOAD;
>
> - return TargetLayout<ELFT>::getSegmentType(section);
> + return TargetLayout<ELF32LE>::getSegmentType(section);
> }
>
> - Section<ELFT> *getSDataSection() const { return _sdataSection; }
> + Section<ELF32LE> *getSDataSection() const { return _sdataSection; }
>
> uint64_t getGOTSymAddr() {
> std::call_once(_gotOnce, [this]() {
> @@ -105,16 +103,15 @@ public:
>
> private:
> llvm::BumpPtrAllocator _alloc;
> - SDataSection<ELFT> *_sdataSection = nullptr;
> + SDataSection<ELF32LE> *_sdataSection = nullptr;
> uint64_t _gotAddr = 0;
> std::once_flag _gotOnce;
> };
>
> /// \brief TargetHandler for Hexagon
> class HexagonTargetHandler final : public TargetHandler {
> - typedef llvm::object::ELFType<llvm::support::little, 2, false> ELFT;
> - typedef ELFReader<ELFT, HexagonLinkingContext, HexagonELFFile> ObjReader;
> - typedef ELFReader<ELFT, HexagonLinkingContext, DynamicFile> ELFDSOReader;
> + typedef ELFReader<ELF32LE, HexagonLinkingContext, HexagonELFFile> ObjReader;
> + typedef ELFReader<ELF32LE, HexagonLinkingContext, DynamicFile> ELFDSOReader;
>
> public:
> HexagonTargetHandler(HexagonLinkingContext &targetInfo);
> @@ -194,13 +191,13 @@ const lld::AtomLayout *SDataSection<ELFT
>
> inline void finalizeHexagonRuntimeAtomValues(HexagonTargetLayout &layout) {
> AtomLayout *gotAtom = layout.findAbsoluteAtom("_GLOBAL_OFFSET_TABLE_");
> - OutputSection<ELFT> *gotpltSection = layout.findOutputSection(".got.plt");
> + OutputSection<ELF32LE> *gotpltSection = layout.findOutputSection(".got.plt");
> if (gotpltSection)
> gotAtom->_virtualAddr = gotpltSection->virtualAddr();
> else
> gotAtom->_virtualAddr = 0;
> AtomLayout *dynamicAtom = layout.findAbsoluteAtom("_DYNAMIC");
> - OutputSection<ELFT> *dynamicSection = layout.findOutputSection(".dynamic");
> + OutputSection<ELF32LE> *dynamicSection = layout.findOutputSection(".dynamic");
> if (dynamicSection)
> dynamicAtom->_virtualAddr = dynamicSection->virtualAddr();
> else
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsLinkingContext.h
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsLinkingContext.h?rev=234823&r1=234822&r2=234823&view=diff
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsLinkingContext.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsLinkingContext.h Mon Apr 13 19:31:28 2015
> @@ -37,11 +37,6 @@ enum {
> LLD_R_MIPS_64_HI16 = 1031,
> };
>
> -typedef llvm::object::ELFType<llvm::support::little, 2, false> Mips32ELType;
> -typedef llvm::object::ELFType<llvm::support::little, 2, true> Mips64ELType;
> -typedef llvm::object::ELFType<llvm::support::big, 2, false> Mips32BEType;
> -typedef llvm::object::ELFType<llvm::support::big, 2, true> Mips64BEType;
> -
> class MipsLinkingContext final : public ELFLinkingContext {
> public:
> static const int machine = llvm::ELF::EM_MIPS;
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp?rev=234823&r1=234822&r2=234823&view=diff
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp Mon Apr 13 19:31:28 2015
> @@ -617,16 +617,16 @@ namespace elf {
>
> template <>
> std::unique_ptr<TargetRelocationHandler>
> -createMipsRelocationHandler<Mips32ELType>(MipsLinkingContext &ctx,
> - MipsTargetLayout<Mips32ELType> &layout) {
> - return llvm::make_unique<RelocationHandler<Mips32ELType>>(ctx, layout);
> +createMipsRelocationHandler<ELF32LE>(MipsLinkingContext &ctx,
> + MipsTargetLayout<ELF32LE> &layout) {
> + return llvm::make_unique<RelocationHandler<ELF32LE>>(ctx, layout);
> }
>
> template <>
> std::unique_ptr<TargetRelocationHandler>
> -createMipsRelocationHandler<Mips64ELType>(MipsLinkingContext &ctx,
> - MipsTargetLayout<Mips64ELType> &layout) {
> - return llvm::make_unique<RelocationHandler<Mips64ELType>>(ctx, layout);
> +createMipsRelocationHandler<ELF64LE>(MipsLinkingContext &ctx,
> + MipsTargetLayout<ELF64LE> &layout) {
> + return llvm::make_unique<RelocationHandler<ELF64LE>>(ctx, layout);
> }
>
> Reference::Addend readMipsRelocAddend(Reference::KindValue kind,
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp?rev=234823&r1=234822&r2=234823&view=diff
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp Mon Apr 13 19:31:28 2015
> @@ -119,10 +119,10 @@ public:
> ArrayRef<uint8_t> rawContent() const override;
> };
>
> -template <> ArrayRef<uint8_t> GOT0Atom<Mips32ELType>::rawContent() const {
> +template <> ArrayRef<uint8_t> GOT0Atom<ELF32LE>::rawContent() const {
> return llvm::makeArrayRef(mipsGot0AtomContent).slice(4);
> }
> -template <> ArrayRef<uint8_t> GOT0Atom<Mips64ELType>::rawContent() const {
> +template <> ArrayRef<uint8_t> GOT0Atom<ELF64LE>::rawContent() const {
> return llvm::makeArrayRef(mipsGot0AtomContent);
> }
>
> @@ -135,11 +135,11 @@ public:
> };
>
> template <>
> -ArrayRef<uint8_t> GOTModulePointerAtom<Mips32ELType>::rawContent() const {
> +ArrayRef<uint8_t> GOTModulePointerAtom<ELF32LE>::rawContent() const {
> return llvm::makeArrayRef(mipsGotModulePointerAtomContent).slice(4);
> }
> template <>
> -ArrayRef<uint8_t> GOTModulePointerAtom<Mips64ELType>::rawContent() const {
> +ArrayRef<uint8_t> GOTModulePointerAtom<ELF64LE>::rawContent() const {
> return llvm::makeArrayRef(mipsGotModulePointerAtomContent);
> }
>
> @@ -151,11 +151,11 @@ public:
> ArrayRef<uint8_t> rawContent() const override;
> };
>
> -template <> ArrayRef<uint8_t> GOTTLSGdAtom<Mips32ELType>::rawContent() const {
> +template <> ArrayRef<uint8_t> GOTTLSGdAtom<ELF32LE>::rawContent() const {
> return llvm::makeArrayRef(mipsGotTlsGdAtomContent).slice(8);
> }
>
> -template <> ArrayRef<uint8_t> GOTTLSGdAtom<Mips64ELType>::rawContent() const {
> +template <> ArrayRef<uint8_t> GOTTLSGdAtom<ELF64LE>::rawContent() const {
> return llvm::makeArrayRef(mipsGotTlsGdAtomContent);
> }
>
> @@ -1077,9 +1077,9 @@ RelocationPass<ELFT>::getObjectEntry(con
> static std::unique_ptr<Pass> createPass(MipsLinkingContext &ctx) {
> switch (ctx.getTriple().getArch()) {
> case llvm::Triple::mipsel:
> - return llvm::make_unique<RelocationPass<Mips32ELType>>(ctx);
> + return llvm::make_unique<RelocationPass<ELF32LE>>(ctx);
> case llvm::Triple::mips64el:
> - return llvm::make_unique<RelocationPass<Mips64ELType>>(ctx);
> + return llvm::make_unique<RelocationPass<ELF64LE>>(ctx);
> default:
> llvm_unreachable("Unhandled arch");
> }
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler32EL.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler32EL.cpp?rev=234823&r1=234822&r2=234823&view=diff
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler32EL.cpp (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler32EL.cpp Mon Apr 13 19:31:28 2015
> @@ -14,5 +14,5 @@ using namespace lld::elf;
>
> std::unique_ptr<TargetHandler>
> lld::elf::createMips32ELTargetHandler(MipsLinkingContext &ctx) {
> - return llvm::make_unique<MipsTargetHandler<Mips32ELType>>(ctx);
> + return llvm::make_unique<MipsTargetHandler<ELF32LE>>(ctx);
> }
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler64EL.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler64EL.cpp?rev=234823&r1=234822&r2=234823&view=diff
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler64EL.cpp (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler64EL.cpp Mon Apr 13 19:31:28 2015
> @@ -14,5 +14,5 @@ using namespace lld::elf;
>
> std::unique_ptr<TargetHandler>
> lld::elf::createMips64ELTargetHandler(MipsLinkingContext &ctx) {
> - return llvm::make_unique<MipsTargetHandler<Mips64ELType>>(ctx);
> + return llvm::make_unique<MipsTargetHandler<ELF64LE>>(ctx);
> }
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/X86/X86DynamicLibraryWriter.h
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/X86/X86DynamicLibraryWriter.h?rev=234823&r1=234822&r2=234823&view=diff
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/X86/X86DynamicLibraryWriter.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/X86/X86DynamicLibraryWriter.h Mon Apr 13 19:31:28 2015
> @@ -15,25 +15,23 @@
> namespace lld {
> namespace elf {
>
> -template <class ELFT>
> -class X86DynamicLibraryWriter : public DynamicLibraryWriter<ELFT> {
> +class X86DynamicLibraryWriter : public DynamicLibraryWriter<ELF32LE> {
> public:
> - X86DynamicLibraryWriter(X86LinkingContext &ctx, TargetLayout<ELFT> &layout);
> + X86DynamicLibraryWriter(X86LinkingContext &ctx,
> + TargetLayout<ELF32LE> &layout);
>
> protected:
> // Add any runtime files and their atoms to the output
> void createImplicitFiles(std::vector<std::unique_ptr<File>> &) override;
> };
>
> -template <class ELFT>
> -X86DynamicLibraryWriter<ELFT>::X86DynamicLibraryWriter(
> - X86LinkingContext &ctx, TargetLayout<ELFT> &layout)
> - : DynamicLibraryWriter<ELFT>(ctx, layout) {}
> +X86DynamicLibraryWriter::X86DynamicLibraryWriter(X86LinkingContext &ctx,
> + TargetLayout<ELF32LE> &layout)
> + : DynamicLibraryWriter<ELF32LE>(ctx, layout) {}
>
> -template <class ELFT>
> -void X86DynamicLibraryWriter<ELFT>::createImplicitFiles(
> +void X86DynamicLibraryWriter::createImplicitFiles(
> std::vector<std::unique_ptr<File>> &result) {
> - DynamicLibraryWriter<ELFT>::createImplicitFiles(result);
> + DynamicLibraryWriter<ELF32LE>::createImplicitFiles(result);
> auto gotFile = llvm::make_unique<SimpleFile>("GOTFile");
> gotFile->addAtom(*new (gotFile->allocator()) GlobalOffsetTableAtom(*gotFile));
> gotFile->addAtom(*new (gotFile->allocator()) DynamicAtom(*gotFile));
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/X86/X86ExecutableWriter.h
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/X86/X86ExecutableWriter.h?rev=234823&r1=234822&r2=234823&view=diff
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/X86/X86ExecutableWriter.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/X86/X86ExecutableWriter.h Mon Apr 13 19:31:28 2015
> @@ -15,25 +15,22 @@
> namespace lld {
> namespace elf {
>
> -template <class ELFT>
> -class X86ExecutableWriter : public ExecutableWriter<ELFT> {
> +class X86ExecutableWriter : public ExecutableWriter<ELF32LE> {
> public:
> - X86ExecutableWriter(X86LinkingContext &ctx, TargetLayout<ELFT> &layout);
> + X86ExecutableWriter(X86LinkingContext &ctx, TargetLayout<ELF32LE> &layout);
>
> protected:
> // Add any runtime files and their atoms to the output
> void createImplicitFiles(std::vector<std::unique_ptr<File>> &) override;
> };
>
> -template <class ELFT>
> -X86ExecutableWriter<ELFT>::X86ExecutableWriter(X86LinkingContext &ctx,
> - TargetLayout<ELFT> &layout)
> - : ExecutableWriter<ELFT>(ctx, layout) {}
> +X86ExecutableWriter::X86ExecutableWriter(X86LinkingContext &ctx,
> + TargetLayout<ELF32LE> &layout)
> + : ExecutableWriter<ELF32LE>(ctx, layout) {}
>
> -template <class ELFT>
> -void X86ExecutableWriter<ELFT>::createImplicitFiles(
> +void X86ExecutableWriter::createImplicitFiles(
> std::vector<std::unique_ptr<File>> &result) {
> - ExecutableWriter<ELFT>::createImplicitFiles(result);
> + ExecutableWriter<ELF32LE>::createImplicitFiles(result);
> }
>
> } // namespace elf
>
> 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=234823&r1=234822&r2=234823&view=diff
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/X86/X86RelocationHandler.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/X86/X86RelocationHandler.h Mon Apr 13 19:31:28 2015
> @@ -14,7 +14,6 @@
>
> namespace lld {
> namespace elf {
> -typedef llvm::object::ELFType<llvm::support::little, 2, false> X86ELFType;
>
> class X86TargetRelocationHandler final : public TargetRelocationHandler {
> public:
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/X86/X86TargetHandler.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/X86/X86TargetHandler.cpp?rev=234823&r1=234822&r2=234823&view=diff
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/X86/X86TargetHandler.cpp (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/X86/X86TargetHandler.cpp Mon Apr 13 19:31:28 2015
> @@ -21,11 +21,9 @@ using namespace llvm::ELF;
> std::unique_ptr<Writer> X86TargetHandler::getWriter() {
> switch (_ctx.getOutputELFType()) {
> case llvm::ELF::ET_EXEC:
> - return llvm::make_unique<X86ExecutableWriter<X86ELFType>>(_ctx,
> - *_targetLayout);
> + return llvm::make_unique<X86ExecutableWriter>(_ctx, *_targetLayout);
> case llvm::ELF::ET_DYN:
> - return llvm::make_unique<X86DynamicLibraryWriter<X86ELFType>>(
> - _ctx, *_targetLayout);
> + return llvm::make_unique<X86DynamicLibraryWriter>(_ctx, *_targetLayout);
> case llvm::ELF::ET_REL:
> llvm_unreachable("TODO: support -r mode");
> default:
> @@ -34,5 +32,5 @@ std::unique_ptr<Writer> X86TargetHandler
> }
>
> X86TargetHandler::X86TargetHandler(X86LinkingContext &ctx)
> - : _ctx(ctx), _targetLayout(new TargetLayout<X86ELFType>(ctx)),
> + : _ctx(ctx), _targetLayout(new TargetLayout<ELF32LE>(ctx)),
> _relocationHandler(new X86TargetRelocationHandler()) {}
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/X86/X86TargetHandler.h
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/X86/X86TargetHandler.h?rev=234823&r1=234822&r2=234823&view=diff
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/X86/X86TargetHandler.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/X86/X86TargetHandler.h Mon Apr 13 19:31:28 2015
> @@ -20,9 +20,8 @@ namespace elf {
> class X86LinkingContext;
>
> class X86TargetHandler final : public TargetHandler {
> - typedef llvm::object::ELFType<llvm::support::little, 2, false> ELFT;
> - typedef ELFReader<ELFT, X86LinkingContext, ELFFile> ObjReader;
> - typedef ELFReader<ELFT, X86LinkingContext, DynamicFile> DSOReader;
> + typedef ELFReader<ELF32LE, X86LinkingContext, ELFFile> ObjReader;
> + typedef ELFReader<ELF32LE, X86LinkingContext, DynamicFile> DSOReader;
>
> public:
> X86TargetHandler(X86LinkingContext &ctx);
> @@ -43,7 +42,7 @@ public:
>
> protected:
> X86LinkingContext &_ctx;
> - std::unique_ptr<TargetLayout<ELFT>> _targetLayout;
> + std::unique_ptr<TargetLayout<ELF32LE>> _targetLayout;
> std::unique_ptr<X86TargetRelocationHandler> _relocationHandler;
> };
> } // end namespace elf
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64DynamicLibraryWriter.h
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64DynamicLibraryWriter.h?rev=234823&r1=234822&r2=234823&view=diff
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64DynamicLibraryWriter.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64DynamicLibraryWriter.h Mon Apr 13 19:31:28 2015
> @@ -10,14 +10,13 @@
> #define X86_64_DYNAMIC_LIBRARY_WRITER_H
>
> #include "DynamicLibraryWriter.h"
> -#include "X86_64ElfType.h"
> #include "X86_64LinkingContext.h"
> #include "X86_64TargetHandler.h"
>
> namespace lld {
> namespace elf {
>
> -class X86_64DynamicLibraryWriter : public DynamicLibraryWriter<X86_64ELFType> {
> +class X86_64DynamicLibraryWriter : public DynamicLibraryWriter<ELF64LE> {
> public:
> X86_64DynamicLibraryWriter(X86_64LinkingContext &ctx,
> X86_64TargetLayout &layout);
>
> Removed: lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64ElfType.h
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64ElfType.h?rev=234822&view=auto
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64ElfType.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64ElfType.h (removed)
> @@ -1,21 +0,0 @@
> -//===- lib/ReaderWriter/ELF/X86_64/X86_64ElfType.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_ELF_X86_64_X86_64_ELF_TYPE_H
> -#define LLD_READER_WRITER_ELF_X86_64_X86_64_ELF_TYPE_H
> -
> -#include "llvm/Object/ELF.h"
> -
> -namespace lld {
> -namespace elf {
> -typedef llvm::object::ELFType<llvm::support::little, 2, true> X86_64ELFType;
> -}
> -}
> -
> -#endif
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64ExecutableWriter.h
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64ExecutableWriter.h?rev=234823&r1=234822&r2=234823&view=diff
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64ExecutableWriter.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64ExecutableWriter.h Mon Apr 13 19:31:28 2015
> @@ -10,13 +10,12 @@
> #define X86_64_EXECUTABLE_WRITER_H
>
> #include "ExecutableWriter.h"
> -#include "X86_64ElfType.h"
> #include "X86_64LinkingContext.h"
>
> namespace lld {
> namespace elf {
>
> -class X86_64ExecutableWriter : public ExecutableWriter<X86_64ELFType> {
> +class X86_64ExecutableWriter : public ExecutableWriter<ELF64LE> {
> public:
> X86_64ExecutableWriter(X86_64LinkingContext &ctx, X86_64TargetLayout &layout)
> : ExecutableWriter(ctx, layout) {}
>
> 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=234823&r1=234822&r2=234823&view=diff
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64RelocationHandler.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64RelocationHandler.h Mon Apr 13 19:31:28 2015
> @@ -14,8 +14,6 @@
>
> namespace lld {
> namespace elf {
> -typedef llvm::object::ELFType<llvm::support::little, 2, true> X86_64ELFType;
> -
> class X86_64TargetLayout;
>
> class X86_64TargetRelocationHandler final : public TargetRelocationHandler {
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.h
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.h?rev=234823&r1=234822&r2=234823&view=diff
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.h Mon Apr 13 19:31:28 2015
> @@ -19,13 +19,13 @@
> namespace lld {
> namespace elf {
>
> -class X86_64TargetLayout : public TargetLayout<X86_64ELFType> {
> +class X86_64TargetLayout : public TargetLayout<ELF64LE> {
> public:
> X86_64TargetLayout(X86_64LinkingContext &ctx) : TargetLayout(ctx) {}
>
> void finalizeOutputSectionLayout() override {
> - sortOutputSectionByPriority<X86_64ELFType>(".init_array");
> - sortOutputSectionByPriority<X86_64ELFType>(".fini_array");
> + sortOutputSectionByPriority<ELF64LE>(".init_array");
> + sortOutputSectionByPriority<ELF64LE>(".fini_array");
> }
>
> private:
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list