[lld] r220129 - [ELF] Add Readers for all the ELF subtargets.

Rui Ueyama ruiu at google.com
Mon Oct 20 18:01:44 PDT 2014


Please do not mix code cleanup (in this case sorting include files) with
actual feature addition next time. Thanks!

On Fri, Oct 17, 2014 at 10:23 PM, Shankar Easwaran <shankarke at gmail.com>
wrote:

> Author: shankare
> Date: Sat Oct 18 00:23:17 2014
> New Revision: 220129
>
> URL: http://llvm.org/viewvc/llvm-project?rev=220129&view=rev
> Log:
> [ELF] Add Readers for all the ELF subtargets.
>
> This would permit the ELF reader to check the architecture that is being
> selected by the linking process.
>
> This patch also sorts the include files according to LLVM conventions.
>
> Added:
>     lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64ELFFile.h
>     lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64ELFReader.h
>       - copied, changed from r220117,
> lld/trunk/lib/ReaderWriter/ELF/ELFReader.h
>     lld/trunk/lib/ReaderWriter/ELF/X86/X86DynamicLibraryWriter.h
>       - copied, changed from r220117,
> lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64DynamicLibraryWriter.h
>     lld/trunk/lib/ReaderWriter/ELF/X86/X86ELFFile.h
>     lld/trunk/lib/ReaderWriter/ELF/X86/X86ELFReader.h
>       - copied, changed from r220117,
> lld/trunk/lib/ReaderWriter/ELF/ELFReader.h
>     lld/trunk/lib/ReaderWriter/ELF/X86/X86ExecutableWriter.h
>     lld/trunk/lib/ReaderWriter/ELF/X86/X86RelocationHandler.cpp
>     lld/trunk/lib/ReaderWriter/ELF/X86/X86RelocationHandler.h
>     lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64ELFFile.h
>     lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64ELFReader.h
>       - copied, changed from r220117,
> lld/trunk/lib/ReaderWriter/ELF/ELFReader.h
> Modified:
>     lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64DynamicLibraryWriter.h
>     lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64ExecutableWriter.h
>     lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64LinkingContext.cpp
>     lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64LinkingContext.h
>     lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64RelocationPass.cpp
>     lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64TargetHandler.cpp
>     lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64TargetHandler.h
>     lld/trunk/lib/ReaderWriter/ELF/ArrayOrderPass.cpp
>     lld/trunk/lib/ReaderWriter/ELF/Atoms.h
>     lld/trunk/lib/ReaderWriter/ELF/Chunk.h
>     lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h
>     lld/trunk/lib/ReaderWriter/ELF/DefaultTargetHandler.h
>     lld/trunk/lib/ReaderWriter/ELF/DynamicFile.h
>     lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp
>     lld/trunk/lib/ReaderWriter/ELF/ELFReader.h
>     lld/trunk/lib/ReaderWriter/ELF/HeaderChunks.h
>     lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonDynamicLibraryWriter.h
>     lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonExecutableWriter.h
>     lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonLinkingContext.cpp
>     lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonLinkingContext.h
>     lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonRelocationHandler.cpp
>     lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp
>     lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.h
>     lld/trunk/lib/ReaderWriter/ELF/Layout.h
>     lld/trunk/lib/ReaderWriter/ELF/Mips/MipsCtorsOrderPass.cpp
>     lld/trunk/lib/ReaderWriter/ELF/Mips/MipsDynamicLibraryWriter.h
>     lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFWriters.h
>     lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp
>     lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp
>     lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.cpp
>     lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.h
>     lld/trunk/lib/ReaderWriter/ELF/OutputELFWriter.h
>     lld/trunk/lib/ReaderWriter/ELF/PPC/PPCLinkingContext.cpp
>     lld/trunk/lib/ReaderWriter/ELF/PPC/PPCLinkingContext.h
>     lld/trunk/lib/ReaderWriter/ELF/Reader.cpp
>     lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h
>     lld/trunk/lib/ReaderWriter/ELF/SegmentChunks.h
>     lld/trunk/lib/ReaderWriter/ELF/TargetHandler.h
>     lld/trunk/lib/ReaderWriter/ELF/TargetLayout.h
>     lld/trunk/lib/ReaderWriter/ELF/Targets.h
>     lld/trunk/lib/ReaderWriter/ELF/Writer.cpp
>     lld/trunk/lib/ReaderWriter/ELF/X86/CMakeLists.txt
>     lld/trunk/lib/ReaderWriter/ELF/X86/X86LinkingContext.cpp
>     lld/trunk/lib/ReaderWriter/ELF/X86/X86LinkingContext.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_64LinkingContext.cpp
>     lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64LinkingContext.h
>     lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64RelocationHandler.cpp
>     lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64RelocationHandler.h
>     lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64RelocationPass.cpp
>     lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.cpp
>     lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.h
>     lld/trunk/test/elf/symbols.test
>
> Modified:
> lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64DynamicLibraryWriter.h
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64DynamicLibraryWriter.h?rev=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64DynamicLibraryWriter.h
> (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64DynamicLibraryWriter.h
> Sat Oct 18 00:23:17 2014
> @@ -9,8 +9,8 @@
>  #ifndef AARCH64_DYNAMIC_LIBRARY_WRITER_H
>  #define AARCH64_DYNAMIC_LIBRARY_WRITER_H
>
> -#include "DynamicLibraryWriter.h"
>  #include "AArch64LinkingContext.h"
> +#include "DynamicLibraryWriter.h"
>
>  namespace lld {
>  namespace elf {
>
> Added: lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64ELFFile.h
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64ELFFile.h?rev=220129&view=auto
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64ELFFile.h (added)
> +++ lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64ELFFile.h Sat Oct 18
> 00:23:17 2014
> @@ -0,0 +1,73 @@
> +//===- lib/ReaderWriter/ELF/AArch64/AArch64ELFFile.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_AARCH64_AARCH64_ELF_FILE_H
> +#define LLD_READER_WRITER_ELF_AARCH64_AARCH64_ELF_FILE_H
> +
> +#include "ELFReader.h"
> +
> +namespace lld {
> +namespace elf {
> +
> +class AArch64LinkingContext;
> +
> +template <class ELFT> class AArch64ELFFile : public ELFFile<ELFT> {
> +public:
> +  AArch64ELFFile(StringRef name, bool atomizeStrings)
> +      : ELFFile<ELFT>(name, atomizeStrings) {}
> +
> +  AArch64ELFFile(std::unique_ptr<MemoryBuffer> mb, bool atomizeStrings,
> +                 std::error_code &ec)
> +      : ELFFile<ELFT>(std::move(mb), atomizeStrings, ec) {}
> +
> +  static ErrorOr<std::unique_ptr<AArch64ELFFile>>
> +  create(std::unique_ptr<MemoryBuffer> mb, bool atomizeStrings) {
> +    std::error_code ec;
> +    std::unique_ptr<AArch64ELFFile<ELFT>> file(
> +        new AArch64ELFFile<ELFT>(mb->getBufferIdentifier(),
> atomizeStrings));
> +
> +    file->_objFile.reset(
> +        new llvm::object::ELFFile<ELFT>(mb.release()->getBuffer(), ec));
> +
> +    if (ec)
> +      return ec;
> +
> +    // Read input sections from the input file that need to be converted
> to
> +    // atoms
> +    if ((ec = file->createAtomizableSections()))
> +      return ec;
> +
> +    // For mergeable strings, we would need to split the section into
> various
> +    // atoms
> +    if ((ec = file->createMergeableAtoms()))
> +      return ec;
> +
> +    // Create the necessary symbols that are part of the section that we
> +    // created in createAtomizableSections function
> +    if ((ec = file->createSymbolsFromAtomizableSections()))
> +      return ec;
> +
> +    // Create the appropriate atoms from the file
> +    if ((ec = file->createAtoms()))
> +      return ec;
> +
> +    return std::move(file);
> +  }
> +};
> +
> +template <class ELFT> class AArch64DynamicFile : public DynamicFile<ELFT>
> {
> +public:
> +  AArch64DynamicFile(const AArch64LinkingContext &context, StringRef name)
> +      : DynamicFile<ELFT>(context, name) {}
> +};
> +
> +} // elf
> +} // lld
> +
> +#endif // LLD_READER_WRITER_ELF_AARCH64_AARCH64_ELF_FILE_H
>
> Copied: lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64ELFReader.h (from
> r220117, lld/trunk/lib/ReaderWriter/ELF/ELFReader.h)
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64ELFReader.h?p2=lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64ELFReader.h&p1=lld/trunk/lib/ReaderWriter/ELF/ELFReader.h&r1=220117&r2=220129&rev=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/ELFReader.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64ELFReader.h Sat Oct 18
> 00:23:17 2014
> @@ -1,4 +1,4 @@
> -//===- lib/ReaderWriter/ELF/ELFReader.h
> -----------------------------------===//
> +//===- lib/ReaderWriter/ELF/AArch64/AArch64ELFReader.h
> --------------------===//
>  //
>  //                             The LLVM Linker
>  //
> @@ -7,53 +7,48 @@
>  //
>
>  //===----------------------------------------------------------------------===//
>
> -#ifndef LLD_READER_WRITER_ELF_READER_H
> -#define LLD_READER_WRITER_ELF_READER_H
> +#ifndef LLD_READER_WRITER_AARCH64_AARCH64_ELF_READER_H
> +#define LLD_READER_WRITER_AARCH64_AARCH64_ELF_READER_H
>
> -#include "CreateELF.h"
> -#include "DynamicFile.h"
> -#include "ELFFile.h"
> -
> -#include "lld/ReaderWriter/Reader.h"
> +#include "AArch64ELFFile.h"
> +#include "ELFReader.h"
>
>  namespace lld {
>  namespace elf {
>
> -struct DynamicFileCreateELFTraits {
> +struct AArch64DynamicFileCreateELFTraits {
>    typedef llvm::ErrorOr<std::unique_ptr<lld::SharedLibraryFile>>
> result_type;
>
>    template <class ELFT>
>    static result_type create(std::unique_ptr<llvm::MemoryBuffer> mb,
>                              bool useUndefines) {
> -    return lld::elf::DynamicFile<ELFT>::create(std::move(mb),
> useUndefines);
> +    return lld::elf::AArch64DynamicFile<ELFT>::create(std::move(mb),
> +                                                      useUndefines);
>    }
>  };
>
> -struct ELFFileCreateELFTraits {
> +struct AArch64ELFFileCreateELFTraits {
>    typedef llvm::ErrorOr<std::unique_ptr<lld::File>> result_type;
>
>    template <class ELFT>
>    static result_type create(std::unique_ptr<llvm::MemoryBuffer> mb,
>                              bool atomizeStrings) {
> -    return lld::elf::ELFFile<ELFT>::create(std::move(mb), atomizeStrings);
> +    return lld::elf::AArch64ELFFile<ELFT>::create(std::move(mb),
> +                                                  atomizeStrings);
>    }
>  };
>
> -class ELFObjectReader : public Reader {
> +class AArch64ELFObjectReader : public ELFObjectReader {
>  public:
> -  ELFObjectReader(bool atomizeStrings) : _atomizeStrings(atomizeStrings)
> {}
> -
> -  bool canParse(file_magic magic, StringRef,
> -                const MemoryBuffer &) const override {
> -    return (magic == llvm::sys::fs::file_magic::elf_relocatable);
> -  }
> +  AArch64ELFObjectReader(bool atomizeStrings)
> +      : ELFObjectReader(atomizeStrings) {}
>
>    std::error_code
>    parseFile(std::unique_ptr<MemoryBuffer> &mb, const class Registry &,
>              std::vector<std::unique_ptr<File>> &result) const override {
>      std::size_t maxAlignment =
>          1ULL << llvm::countTrailingZeros(uintptr_t(mb->getBufferStart()));
> -    auto f = createELF<ELFFileCreateELFTraits>(
> +    auto f = createELF<AArch64ELFFileCreateELFTraits>(
>          llvm::object::getElfArchType(mb->getBuffer()), maxAlignment,
>          std::move(mb), _atomizeStrings);
>      if (std::error_code ec = f.getError())
> @@ -61,26 +56,18 @@ public:
>      result.push_back(std::move(*f));
>      return std::error_code();
>    }
> -
> -protected:
> -  bool _atomizeStrings;
>  };
>
> -class ELFDSOReader : public Reader {
> +class AArch64ELFDSOReader : public ELFDSOReader {
>  public:
> -  ELFDSOReader(bool useUndefines) : _useUndefines(useUndefines) {}
> -
> -  bool canParse(file_magic magic, StringRef,
> -                const MemoryBuffer &) const override {
> -    return (magic == llvm::sys::fs::file_magic::elf_shared_object);
> -  }
> +  AArch64ELFDSOReader(bool useUndefines) : ELFDSOReader(useUndefines) {}
>
>    std::error_code
>    parseFile(std::unique_ptr<MemoryBuffer> &mb, const class Registry &,
>              std::vector<std::unique_ptr<File>> &result) const override {
>      std::size_t maxAlignment =
>          1ULL << llvm::countTrailingZeros(uintptr_t(mb->getBufferStart()));
> -    auto f = createELF<DynamicFileCreateELFTraits>(
> +    auto f = createELF<AArch64DynamicFileCreateELFTraits>(
>          llvm::object::getElfArchType(mb->getBuffer()), maxAlignment,
>          std::move(mb), _useUndefines);
>      if (std::error_code ec = f.getError())
> @@ -88,12 +75,9 @@ public:
>      result.push_back(std::move(*f));
>      return std::error_code();
>    }
> -
> -protected:
> -  bool _useUndefines;
>  };
>
>  } // namespace elf
>  } // namespace lld
>
> -#endif // LLD_READER_WRITER_ELF_READER_H
> +#endif // LLD_READER_WRITER_AARCH64_AARCH64_ELF_READER_H
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64ExecutableWriter.h
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64ExecutableWriter.h?rev=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64ExecutableWriter.h
> (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64ExecutableWriter.h Sat
> Oct 18 00:23:17 2014
> @@ -9,8 +9,8 @@
>  #ifndef AARCH64_EXECUTABLE_WRITER_H
>  #define AARCH64_EXECUTABLE_WRITER_H
>
> -#include "ExecutableWriter.h"
>  #include "AArch64LinkingContext.h"
> +#include "ExecutableWriter.h"
>
>  namespace lld {
>  namespace elf {
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64LinkingContext.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64LinkingContext.cpp?rev=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64LinkingContext.cpp
> (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64LinkingContext.cpp Sat
> Oct 18 00:23:17 2014
> @@ -8,16 +8,13 @@
>
>  //===----------------------------------------------------------------------===//
>
>  #include "AArch64LinkingContext.h"
> -
> +#include "AArch64RelocationPass.h"
> +#include "Atoms.h"
>  #include "lld/Core/File.h"
>  #include "lld/Core/Instrumentation.h"
> -
>  #include "llvm/ADT/ArrayRef.h"
>  #include "llvm/ADT/StringSwitch.h"
>
> -#include "Atoms.h"
> -#include "AArch64RelocationPass.h"
> -
>  using namespace lld;
>  using namespace lld::elf;
>
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64LinkingContext.h
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64LinkingContext.h?rev=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64LinkingContext.h
> (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64LinkingContext.h Sat Oct
> 18 00:23:17 2014
> @@ -11,9 +11,7 @@
>  #define LLD_READER_WRITER_ELF_AARCH64_AARCH64_LINKING_CONTEXT_H
>
>  #include "AArch64TargetHandler.h"
> -
>  #include "lld/ReaderWriter/ELFLinkingContext.h"
> -
>  #include "llvm/Object/ELF.h"
>  #include "llvm/Support/ELF.h"
>
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64RelocationPass.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64RelocationPass.cpp?rev=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64RelocationPass.cpp
> (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64RelocationPass.cpp Sat
> Oct 18 00:23:17 2014
> @@ -17,13 +17,10 @@
>
>  //===----------------------------------------------------------------------===//
>
>  #include "AArch64RelocationPass.h"
> -
> +#include "AArch64LinkingContext.h"
> +#include "Atoms.h"
>  #include "lld/Core/Simple.h"
> -
>  #include "llvm/ADT/DenseMap.h"
> -
> -#include "Atoms.h"
> -#include "AArch64LinkingContext.h"
>  #include "llvm/Support/Debug.h"
>
>  using namespace lld;
>
> 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=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64TargetHandler.cpp
> (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64TargetHandler.cpp Sat
> Oct 18 00:23:17 2014
> @@ -8,10 +8,10 @@
>
>  //===----------------------------------------------------------------------===//
>
>  #include "Atoms.h"
> -#include "AArch64ExecutableWriter.h"
>  #include "AArch64DynamicLibraryWriter.h"
> -#include "AArch64TargetHandler.h"
> +#include "AArch64ExecutableWriter.h"
>  #include "AArch64LinkingContext.h"
> +#include "AArch64TargetHandler.h"
>
>  using namespace lld;
>  using namespace elf;
>
> 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=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64TargetHandler.h
> (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64TargetHandler.h Sat Oct
> 18 00:23:17 2014
> @@ -10,11 +10,11 @@
>  #ifndef LLD_READER_WRITER_ELF_AARCH64_AARCH64_TARGET_HANDLER_H
>  #define LLD_READER_WRITER_ELF_AARCH64_AARCH64_TARGET_HANDLER_H
>
> -#include "DefaultTargetHandler.h"
> -#include "ELFFile.h"
> +#include "AArch64ELFFile.h"
> +#include "AArch64ELFReader.h"
>  #include "AArch64RelocationHandler.h"
> +#include "DefaultTargetHandler.h"
>  #include "TargetLayout.h"
> -
>  #include "lld/Core/Simple.h"
>
>  namespace lld {
> @@ -42,6 +42,14 @@ public:
>      return *(_AArch64RelocationHandler.get());
>    }
>
> +  std::unique_ptr<Reader> getObjReader(bool atomizeStrings) override {
> +    return std::unique_ptr<Reader>(new
> AArch64ELFObjectReader(atomizeStrings));
> +  }
> +
> +  std::unique_ptr<Reader> getDSOReader(bool useShlibUndefines) override {
> +    return std::unique_ptr<Reader>(new
> AArch64ELFDSOReader(useShlibUndefines));
> +  }
> +
>    std::unique_ptr<Writer> getWriter() override;
>
>  private:
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/ArrayOrderPass.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ArrayOrderPass.cpp?rev=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/ArrayOrderPass.cpp (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/ArrayOrderPass.cpp Sat Oct 18 00:23:17
> 2014
> @@ -8,7 +8,6 @@
>
>  //===----------------------------------------------------------------------===//
>
>  #include "ArrayOrderPass.h"
> -
>  #include <algorithm>
>  #include <limits>
>
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/Atoms.h
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Atoms.h?rev=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/Atoms.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/Atoms.h Sat Oct 18 00:23:17 2014
> @@ -11,13 +11,10 @@
>  #define LLD_READER_WRITER_ELF_ATOMS_H
>
>  #include "TargetHandler.h"
> -
>  #include "lld/Core/LLVM.h"
>  #include "lld/Core/Simple.h"
> -
>  #include "llvm/ADT/ArrayRef.h"
>  #include "llvm/ADT/StringSwitch.h"
> -
>  #include <memory>
>  #include <vector>
>
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/Chunk.h
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Chunk.h?rev=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/Chunk.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/Chunk.h Sat Oct 18 00:23:17 2014
> @@ -11,7 +11,6 @@
>  #define LLD_READER_WRITER_ELF_CHUNKS_H
>
>  #include "lld/Core/LLVM.h"
> -
>  #include "llvm/ADT/StringRef.h"
>  #include "llvm/Object/ELF.h"
>  #include "llvm/Support/Allocator.h"
> @@ -19,7 +18,6 @@
>  #include "llvm/Support/ELF.h"
>  #include "llvm/Support/ErrorHandling.h"
>  #include "llvm/Support/FileOutputBuffer.h"
> -
>  #include <memory>
>
>  namespace lld {
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h?rev=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h Sat Oct 18 00:23:17 2014
> @@ -16,10 +16,8 @@
>  #include "Layout.h"
>  #include "SectionChunks.h"
>  #include "SegmentChunks.h"
> -
>  #include "lld/Core/Instrumentation.h"
>  #include "lld/Core/STDExtras.h"
> -
>  #include "llvm/ADT/ArrayRef.h"
>  #include "llvm/ADT/DenseMap.h"
>  #include "llvm/ADT/DenseSet.h"
> @@ -31,7 +29,6 @@
>  #include "llvm/ADT/StringSwitch.h"
>  #include "llvm/Support/Errc.h"
>  #include "llvm/Support/Format.h"
> -
>  #include <map>
>  #include <memory>
>  #include <tuple>
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/DefaultTargetHandler.h
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/DefaultTargetHandler.h?rev=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/DefaultTargetHandler.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/DefaultTargetHandler.h Sat Oct 18
> 00:23:17 2014
> @@ -11,13 +11,11 @@
>  #define LLD_READER_WRITER_ELF_DEFAULT_TARGET_HANDLER_H
>
>  #include "DefaultLayout.h"
> -#include "TargetHandler.h"
> -#include "ELFReader.h"
>  #include "DynamicLibraryWriter.h"
> +#include "ELFReader.h"
>  #include "ExecutableWriter.h"
> -
> +#include "TargetHandler.h"
>  #include "lld/ReaderWriter/ELFLinkingContext.h"
> -
>  #include "llvm/ADT/Triple.h"
>  #include "llvm/Support/ELF.h"
>
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/DynamicFile.h
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/DynamicFile.h?rev=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/DynamicFile.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/DynamicFile.h Sat Oct 18 00:23:17 2014
> @@ -11,13 +11,10 @@
>  #define LLD_READER_WRITER_ELF_DYNAMIC_FILE_H
>
>  #include "Atoms.h"
> -
>  #include "lld/Core/SharedLibraryFile.h"
>  #include "lld/ReaderWriter/ELFLinkingContext.h"
> -
>  #include "llvm/Object/ELF.h"
>  #include "llvm/Support/Path.h"
> -
>  #include <unordered_map>
>
>  namespace lld {
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp?rev=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp Sat Oct 18
> 00:23:17 2014
> @@ -8,19 +8,16 @@
>
>  //===----------------------------------------------------------------------===//
>
>  #include "lld/ReaderWriter/ELFLinkingContext.h"
> -
>  #include "ArrayOrderPass.h"
>  #include "ELFFile.h"
>  #include "TargetHandler.h"
>  #include "Targets.h"
> -
>  #include "lld/Core/Instrumentation.h"
>  #include "lld/Passes/LayoutPass.h"
>  #include "lld/Passes/RoundTripYAMLPass.h"
> -
>  #include "llvm/ADT/Triple.h"
> -#include "llvm/Support/Errc.h"
>  #include "llvm/Support/ELF.h"
> +#include "llvm/Support/Errc.h"
>  #include "llvm/Support/FileSystem.h"
>  #include "llvm/Support/Path.h"
>
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/ELFReader.h
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ELFReader.h?rev=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/ELFReader.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/ELFReader.h Sat Oct 18 00:23:17 2014
> @@ -13,7 +13,6 @@
>  #include "CreateELF.h"
>  #include "DynamicFile.h"
>  #include "ELFFile.h"
> -
>  #include "lld/ReaderWriter/Reader.h"
>
>  namespace lld {
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/HeaderChunks.h
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/HeaderChunks.h?rev=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/HeaderChunks.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/HeaderChunks.h Sat Oct 18 00:23:17 2014
> @@ -11,7 +11,6 @@
>  #define LLD_READER_WRITER_ELF_HEADER_CHUNKS_H
>
>  #include "SegmentChunks.h"
> -
>  #include "llvm/Object/ELF.h"
>  #include "llvm/Support/Allocator.h"
>  #include "llvm/Support/Debug.h"
>
> 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=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonDynamicLibraryWriter.h
> (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonDynamicLibraryWriter.h
> Sat Oct 18 00:23:17 2014
> @@ -9,9 +9,9 @@
>  #ifndef HEXAGON_DYNAMIC_LIBRARY_WRITER_H
>  #define HEXAGON_DYNAMIC_LIBRARY_WRITER_H
>
> +#include "DynamicLibraryWriter.h"
>  #include "HexagonExecutableAtoms.h"
>  #include "HexagonLinkingContext.h"
> -#include "DynamicLibraryWriter.h"
>
>  namespace lld {
>  namespace elf {
>
> 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=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonExecutableWriter.h
> (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonExecutableWriter.h Sat
> Oct 18 00:23:17 2014
> @@ -9,10 +9,10 @@
>  #ifndef HEXAGON_EXECUTABLE_WRITER_H
>  #define HEXAGON_EXECUTABLE_WRITER_H
>
> +#include "ExecutableWriter.h"
> +#include "HexagonELFWriters.h"
>  #include "HexagonExecutableAtoms.h"
>  #include "HexagonLinkingContext.h"
> -#include "HexagonELFWriters.h"
> -#include "ExecutableWriter.h"
>
>  namespace lld {
>  namespace elf {
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonLinkingContext.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonLinkingContext.cpp?rev=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonLinkingContext.cpp
> (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonLinkingContext.cpp Sat
> Oct 18 00:23:17 2014
> @@ -10,12 +10,10 @@
>  #include "Atoms.h"
>  #include "HexagonLinkingContext.h"
>  #include "HexagonTargetHandler.h"
> -
>  #include "lld/Core/File.h"
>  #include "lld/Core/Pass.h"
>  #include "lld/Core/PassManager.h"
>  #include "lld/Core/Simple.h"
> -
>  #include "llvm/ADT/ArrayRef.h"
>  #include "llvm/ADT/DenseMap.h"
>  #include "llvm/ADT/StringSwitch.h"
>
> 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=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonLinkingContext.h
> (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonLinkingContext.h Sat Oct
> 18 00:23:17 2014
> @@ -11,7 +11,6 @@
>  #define LLD_READER_WRITER_ELF_HEXAGON_HEXAGON_LINKING_CONTEXT_H
>
>  #include "lld/ReaderWriter/ELFLinkingContext.h"
> -
>  #include "llvm/Object/ELF.h"
>  #include "llvm/Support/ELF.h"
>
>
> Modified:
> lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonRelocationHandler.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonRelocationHandler.cpp?rev=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonRelocationHandler.cpp
> (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonRelocationHandler.cpp
> Sat Oct 18 00:23:17 2014
> @@ -9,9 +9,8 @@
>
>  #include "HexagonTargetHandler.h"
>  #include "HexagonLinkingContext.h"
> -#include "HexagonRelocationHandler.h"
>  #include "HexagonRelocationFunctions.h"
> -
> +#include "HexagonRelocationHandler.h"
>
>  using namespace lld;
>  using namespace elf;
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp?rev=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp
> (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp Sat
> Oct 18 00:23:17 2014
> @@ -9,8 +9,8 @@
>
>  #include "HexagonExecutableWriter.h"
>  #include "HexagonDynamicLibraryWriter.h"
> -#include "HexagonTargetHandler.h"
>  #include "HexagonLinkingContext.h"
> +#include "HexagonTargetHandler.h"
>
>  using namespace lld;
>  using namespace elf;
>
> 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=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.h
> (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.h Sat Oct
> 18 00:23:17 2014
> @@ -11,11 +11,11 @@
>  #define HEXAGON_TARGET_HANDLER_H
>
>  #include "DefaultTargetHandler.h"
> +#include "HexagonELFReader.h"
>  #include "HexagonExecutableAtoms.h"
>  #include "HexagonRelocationHandler.h"
>  #include "HexagonSectionChunks.h"
>  #include "TargetLayout.h"
> -#include "HexagonELFReader.h"
>
>  namespace lld {
>  namespace elf {
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/Layout.h
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Layout.h?rev=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/Layout.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/Layout.h Sat Oct 18 00:23:17 2014
> @@ -12,7 +12,6 @@
>
>  #include "lld/Core/DefinedAtom.h"
>  #include "lld/ReaderWriter/AtomLayout.h"
> -
>  #include "llvm/ADT/StringRef.h"
>  #include "llvm/Object/ELF.h"
>  #include "llvm/Support/Allocator.h"
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsCtorsOrderPass.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsCtorsOrderPass.cpp?rev=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsCtorsOrderPass.cpp (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsCtorsOrderPass.cpp Sat Oct 18
> 00:23:17 2014
> @@ -8,7 +8,6 @@
>
>  //===----------------------------------------------------------------------===//
>
>  #include "MipsCtorsOrderPass.h"
> -
>  #include <algorithm>
>  #include <climits>
>
>
> 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=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsDynamicLibraryWriter.h
> (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsDynamicLibraryWriter.h Sat Oct
> 18 00:23:17 2014
> @@ -17,6 +17,7 @@
>  namespace lld {
>  namespace elf {
>
> +template <typename ELFT> class MipsDynamicSymbolTable;
>  template <typename ELFT> class MipsTargetLayout;
>
>  template <class ELFT>
>
> 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=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFWriters.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFWriters.h Sat Oct 18
> 00:23:17 2014
> @@ -10,11 +10,14 @@
>  #define LLD_READER_WRITER_ELF_MIPS_MIPS_ELF_WRITERS_H
>
>  #include "MipsLinkingContext.h"
> +
>  #include "OutputELFWriter.h"
>
>  namespace lld {
>  namespace elf {
>
> +template <class ELFT> class MipsRuntimeFile;
> +
>  template <class ELFT> class MipsTargetLayout;
>
>  template <typename ELFT> class MipsELFWriter {
>
> 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=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp
> (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp Sat Oct
> 18 00:23:17 2014
> @@ -10,7 +10,6 @@
>  #include "MipsTargetHandler.h"
>  #include "MipsLinkingContext.h"
>  #include "MipsRelocationHandler.h"
> -
>  #include "lld/ReaderWriter/RelocationHelperFunctions.h"
>
>  using namespace lld;
>
> 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=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp Sat Oct 18
> 00:23:17 2014
> @@ -11,7 +11,6 @@
>  #include "MipsLinkingContext.h"
>  #include "MipsRelocationPass.h"
>  #include "MipsTargetHandler.h"
> -
>  #include "llvm/ADT/DenseSet.h"
>
>  using namespace lld;
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.cpp?rev=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.cpp (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.cpp Sat Oct 18
> 00:23:17 2014
> @@ -8,10 +8,10 @@
>
>  //===----------------------------------------------------------------------===//
>
>  #include "ELFFile.h"
> +#include "MipsDynamicLibraryWriter.h"
> +#include "MipsExecutableWriter.h"
>  #include "MipsLinkingContext.h"
>  #include "MipsTargetHandler.h"
> -#include "MipsExecutableWriter.h"
> -#include "MipsDynamicLibraryWriter.h"
>
>  using namespace lld;
>  using namespace elf;
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.h
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.h?rev=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.h Sat Oct 18
> 00:23:17 2014
> @@ -15,7 +15,6 @@
>  #include "MipsRelocationHandler.h"
>  #include "MipsSectionChunks.h"
>  #include "TargetLayout.h"
> -
>  #include "llvm/ADT/DenseSet.h"
>
>  namespace lld {
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/OutputELFWriter.h
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/OutputELFWriter.h?rev=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/OutputELFWriter.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/OutputELFWriter.h Sat Oct 18 00:23:17
> 2014
> @@ -12,12 +12,10 @@
>  #include "DefaultLayout.h"
>  #include "ELFFile.h"
>  #include "TargetLayout.h"
> -
>  #include "lld/Core/Instrumentation.h"
>  #include "lld/Core/Parallel.h"
>  #include "lld/ReaderWriter/ELFLinkingContext.h"
>  #include "lld/ReaderWriter/Writer.h"
> -
>  #include "llvm/ADT/StringSet.h"
>  #include "llvm/Support/Path.h"
>
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/PPC/PPCLinkingContext.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/PPC/PPCLinkingContext.cpp?rev=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/PPC/PPCLinkingContext.cpp (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/PPC/PPCLinkingContext.cpp Sat Oct 18
> 00:23:17 2014
> @@ -8,9 +8,7 @@
>
>  //===----------------------------------------------------------------------===//
>
>  #include "PPCLinkingContext.h"
> -
>  #include "lld/Core/LLVM.h"
> -
>  #include "llvm/ADT/StringSwitch.h"
>  #include "llvm/Support/ErrorOr.h"
>
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/PPC/PPCLinkingContext.h
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/PPC/PPCLinkingContext.h?rev=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/PPC/PPCLinkingContext.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/PPC/PPCLinkingContext.h Sat Oct 18
> 00:23:17 2014
> @@ -11,9 +11,7 @@
>  #define LLD_READER_WRITER_ELF_PPC_PPC_LINKING_CONTEXT_H
>
>  #include "PPCTargetHandler.h"
> -
>  #include "lld/ReaderWriter/ELFLinkingContext.h"
> -
>  #include "llvm/Object/ELF.h"
>  #include "llvm/Support/ELF.h"
>
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/Reader.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Reader.cpp?rev=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/Reader.cpp (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/Reader.cpp Sat Oct 18 00:23:17 2014
> @@ -14,7 +14,6 @@
>
>  //===----------------------------------------------------------------------===//
>
>  #include "ELFReader.h"
> -
>  #include <map>
>  #include <vector>
>
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h?rev=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h Sat Oct 18 00:23:17 2014
> @@ -14,11 +14,9 @@
>  #include "Layout.h"
>  #include "TargetHandler.h"
>  #include "Writer.h"
> -
>  #include "lld/Core/DefinedAtom.h"
>  #include "lld/Core/Parallel.h"
>  #include "lld/Core/range.h"
> -
>  #include "llvm/ADT/ArrayRef.h"
>  #include "llvm/ADT/DenseMap.h"
>  #include "llvm/ADT/StringExtras.h"
> @@ -29,7 +27,6 @@
>  #include "llvm/Support/ELF.h"
>  #include "llvm/Support/ErrorHandling.h"
>  #include "llvm/Support/FileOutputBuffer.h"
> -
>  #include <memory>
>
>  namespace lld {
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/SegmentChunks.h
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/SegmentChunks.h?rev=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/SegmentChunks.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/SegmentChunks.h Sat Oct 18 00:23:17 2014
> @@ -14,10 +14,8 @@
>  #include "Layout.h"
>  #include "SectionChunks.h"
>  #include "Writer.h"
> -
>  #include "lld/Core/range.h"
>  #include "lld/ReaderWriter/Writer.h"
> -
>  #include "llvm/ADT/ArrayRef.h"
>  #include "llvm/ADT/StringRef.h"
>  #include "llvm/Object/ELF.h"
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/TargetHandler.h
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/TargetHandler.h?rev=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/TargetHandler.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/TargetHandler.h Sat Oct 18 00:23:17 2014
> @@ -17,15 +17,12 @@
>  #define LLD_READER_WRITER_ELF_TARGET_HANDLER_H
>
>  #include "Layout.h"
> -
>  #include "lld/Core/LLVM.h"
>  #include "lld/Core/LinkingContext.h"
>  #include "lld/Core/STDExtras.h"
>  #include "lld/ReaderWriter/ELFLinkingContext.h"
> -
>  #include "llvm/ADT/Hashing.h"
>  #include "llvm/Support/FileOutputBuffer.h"
> -
>  #include <memory>
>  #include <vector>
>
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/TargetLayout.h
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/TargetLayout.h?rev=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/TargetLayout.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/TargetLayout.h Sat Oct 18 00:23:17 2014
> @@ -11,7 +11,6 @@
>  #define LLD_READER_WRITER_ELF_TARGET_LAYOUT_H
>
>  #include "DefaultLayout.h"
> -
>  #include "lld/Core/LLVM.h"
>
>  namespace lld {
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/Targets.h
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Targets.h?rev=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/Targets.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/Targets.h Sat Oct 18 00:23:17 2014
> @@ -10,11 +10,11 @@
>  #ifndef LLD_READER_WRITER_ELF_TARGETS_H
>  #define LLD_READER_WRITER_ELF_TARGETS_H
>
> +#include "AArch64/AArch64Target.h"
>  #include "Hexagon/HexagonTarget.h"
>  #include "Mips/MipsTarget.h"
>  #include "PPC/PPCTarget.h"
>  #include "X86/X86Target.h"
>  #include "X86_64/X86_64Target.h"
> -#include "AArch64/AArch64Target.h"
>
>  #endif
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/Writer.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Writer.cpp?rev=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/Writer.cpp (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/Writer.cpp Sat Oct 18 00:23:17 2014
> @@ -8,7 +8,6 @@
>
>  //===----------------------------------------------------------------------===//
>
>  #include "lld/ReaderWriter/Writer.h"
> -
>  #include "DynamicLibraryWriter.h"
>  #include "ExecutableWriter.h"
>
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/X86/CMakeLists.txt
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/X86/CMakeLists.txt?rev=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/X86/CMakeLists.txt (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/X86/CMakeLists.txt Sat Oct 18 00:23:17
> 2014
> @@ -1,6 +1,7 @@
>  add_lld_library(lldX86ELFTarget
>    X86LinkingContext.cpp
>    X86TargetHandler.cpp
> +  X86RelocationHandler.cpp
>    )
>
>  target_link_libraries(lldX86ELFTarget ${cmake_2_8_12_INTERFACE}
>
> Copied: lld/trunk/lib/ReaderWriter/ELF/X86/X86DynamicLibraryWriter.h (from
> r220117,
> lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64DynamicLibraryWriter.h)
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/X86/X86DynamicLibraryWriter.h?p2=lld/trunk/lib/ReaderWriter/ELF/X86/X86DynamicLibraryWriter.h&p1=lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64DynamicLibraryWriter.h&r1=220117&r2=220129&rev=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64DynamicLibraryWriter.h
> (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/X86/X86DynamicLibraryWriter.h Sat Oct
> 18 00:23:17 2014
> @@ -1,4 +1,4 @@
> -//===- lib/ReaderWriter/ELF/AArch64/AArch64DynamicLibraryWriter.h
> ---------===//
> +//===- lib/ReaderWriter/ELF/X86/X86DynamicLibraryWriter.h
> -----------------===//
>  //
>  //                             The LLVM Linker
>  //
> @@ -6,20 +6,20 @@
>  // License. See LICENSE.TXT for details.
>  //
>
>  //===----------------------------------------------------------------------===//
> -#ifndef AARCH64_DYNAMIC_LIBRARY_WRITER_H
> -#define AARCH64_DYNAMIC_LIBRARY_WRITER_H
> +#ifndef X86_X86_DYNAMIC_LIBRARY_WRITER_H
> +#define X86_X86_DYNAMIC_LIBRARY_WRITER_H
>
>  #include "DynamicLibraryWriter.h"
> -#include "AArch64LinkingContext.h"
> +#include "X86LinkingContext.h"
>
>  namespace lld {
>  namespace elf {
>
>  template <class ELFT>
> -class AArch64DynamicLibraryWriter : public DynamicLibraryWriter<ELFT> {
> +class X86DynamicLibraryWriter : public DynamicLibraryWriter<ELFT> {
>  public:
> -  AArch64DynamicLibraryWriter(AArch64LinkingContext &context,
> -                              AArch64TargetLayout<ELFT> &layout);
> +  X86DynamicLibraryWriter(X86LinkingContext &context,
> +                          X86TargetLayout<ELFT> &layout);
>
>  protected:
>    // Add any runtime files and their atoms to the output
> @@ -41,19 +41,18 @@ private:
>    };
>
>    std::unique_ptr<GOTFile> _gotFile;
> -  AArch64LinkingContext &_context;
> -  AArch64TargetLayout<ELFT> &_AArch64Layout;
> +  X86LinkingContext &_context;
> +  X86TargetLayout<ELFT> &_x86Layout;
>  };
>
>  template <class ELFT>
> -AArch64DynamicLibraryWriter<ELFT>::AArch64DynamicLibraryWriter(
> -    AArch64LinkingContext &context, AArch64TargetLayout<ELFT> &layout)
> +X86DynamicLibraryWriter<ELFT>::X86DynamicLibraryWriter(
> +    X86LinkingContext &context, X86TargetLayout<ELFT> &layout)
>      : DynamicLibraryWriter<ELFT>(context, layout),
> -      _gotFile(new GOTFile(context)), _context(context),
> -      _AArch64Layout(layout) {}
> +      _gotFile(new GOTFile(context)), _context(context),
> _x86Layout(layout) {}
>
>  template <class ELFT>
> -bool AArch64DynamicLibraryWriter<ELFT>::createImplicitFiles(
> +bool X86DynamicLibraryWriter<ELFT>::createImplicitFiles(
>      std::vector<std::unique_ptr<File>> &result) {
>    DynamicLibraryWriter<ELFT>::createImplicitFiles(result);
>    _gotFile->addAtom(*new (_gotFile->_alloc)
> GLOBAL_OFFSET_TABLEAtom(*_gotFile));
>
> Added: lld/trunk/lib/ReaderWriter/ELF/X86/X86ELFFile.h
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/X86/X86ELFFile.h?rev=220129&view=auto
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/X86/X86ELFFile.h (added)
> +++ lld/trunk/lib/ReaderWriter/ELF/X86/X86ELFFile.h Sat Oct 18 00:23:17
> 2014
> @@ -0,0 +1,73 @@
> +//===- lib/ReaderWriter/ELF/X86/X86ELFFile.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_X86_ELF_FILE_H
> +#define LLD_READER_WRITER_ELF_X86_X86_ELF_FILE_H
> +
> +#include "ELFReader.h"
> +
> +namespace lld {
> +namespace elf {
> +
> +class X86LinkingContext;
> +
> +template <class ELFT> class X86ELFFile : public ELFFile<ELFT> {
> +public:
> +  X86ELFFile(StringRef name, bool atomizeStrings)
> +      : ELFFile<ELFT>(name, atomizeStrings) {}
> +
> +  X86ELFFile(std::unique_ptr<MemoryBuffer> mb, bool atomizeStrings,
> +             std::error_code &ec)
> +      : ELFFile<ELFT>(std::move(mb), atomizeStrings, ec) {}
> +
> +  static ErrorOr<std::unique_ptr<X86ELFFile>>
> +  create(std::unique_ptr<MemoryBuffer> mb, bool atomizeStrings) {
> +    std::error_code ec;
> +    std::unique_ptr<X86ELFFile<ELFT>> file(
> +        new X86ELFFile<ELFT>(mb->getBufferIdentifier(), atomizeStrings));
> +
> +    file->_objFile.reset(
> +        new llvm::object::ELFFile<ELFT>(mb.release()->getBuffer(), ec));
> +
> +    if (ec)
> +      return ec;
> +
> +    // Read input sections from the input file that need to be converted
> to
> +    // atoms
> +    if ((ec = file->createAtomizableSections()))
> +      return ec;
> +
> +    // For mergeable strings, we would need to split the section into
> various
> +    // atoms
> +    if ((ec = file->createMergeableAtoms()))
> +      return ec;
> +
> +    // Create the necessary symbols that are part of the section that we
> +    // created in createAtomizableSections function
> +    if ((ec = file->createSymbolsFromAtomizableSections()))
> +      return ec;
> +
> +    // Create the appropriate atoms from the file
> +    if ((ec = file->createAtoms()))
> +      return ec;
> +
> +    return std::move(file);
> +  }
> +};
> +
> +template <class ELFT> class X86DynamicFile : public DynamicFile<ELFT> {
> +public:
> +  X86DynamicFile(const X86LinkingContext &context, StringRef name)
> +      : DynamicFile<ELFT>(context, name) {}
> +};
> +
> +} // elf
> +} // lld
> +
> +#endif // LLD_READER_WRITER_ELF_X86_X86_ELF_FILE_H
>
> Copied: lld/trunk/lib/ReaderWriter/ELF/X86/X86ELFReader.h (from r220117,
> lld/trunk/lib/ReaderWriter/ELF/ELFReader.h)
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/X86/X86ELFReader.h?p2=lld/trunk/lib/ReaderWriter/ELF/X86/X86ELFReader.h&p1=lld/trunk/lib/ReaderWriter/ELF/ELFReader.h&r1=220117&r2=220129&rev=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/ELFReader.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/X86/X86ELFReader.h Sat Oct 18 00:23:17
> 2014
> @@ -1,4 +1,4 @@
> -//===- lib/ReaderWriter/ELF/ELFReader.h
> -----------------------------------===//
> +//===- lib/ReaderWriter/ELF/X86/X86ELFReader.h
> ----------------------------===//
>  //
>  //                             The LLVM Linker
>  //
> @@ -7,53 +7,45 @@
>  //
>
>  //===----------------------------------------------------------------------===//
>
> -#ifndef LLD_READER_WRITER_ELF_READER_H
> -#define LLD_READER_WRITER_ELF_READER_H
> +#ifndef LLD_READER_WRITER_X86_X86_ELF_READER_H
> +#define LLD_READER_WRITER_X86_X86_ELF_READER_H
>
> -#include "CreateELF.h"
> -#include "DynamicFile.h"
> -#include "ELFFile.h"
> -
> -#include "lld/ReaderWriter/Reader.h"
> +#include "ELFReader.h"
> +#include "X86ELFFile.h"
>
>  namespace lld {
>  namespace elf {
>
> -struct DynamicFileCreateELFTraits {
> +struct X86DynamicFileCreateELFTraits {
>    typedef llvm::ErrorOr<std::unique_ptr<lld::SharedLibraryFile>>
> result_type;
>
>    template <class ELFT>
>    static result_type create(std::unique_ptr<llvm::MemoryBuffer> mb,
>                              bool useUndefines) {
> -    return lld::elf::DynamicFile<ELFT>::create(std::move(mb),
> useUndefines);
> +    return lld::elf::X86DynamicFile<ELFT>::create(std::move(mb),
> useUndefines);
>    }
>  };
>
> -struct ELFFileCreateELFTraits {
> +struct X86ELFFileCreateELFTraits {
>    typedef llvm::ErrorOr<std::unique_ptr<lld::File>> result_type;
>
>    template <class ELFT>
>    static result_type create(std::unique_ptr<llvm::MemoryBuffer> mb,
>                              bool atomizeStrings) {
> -    return lld::elf::ELFFile<ELFT>::create(std::move(mb), atomizeStrings);
> +    return lld::elf::X86ELFFile<ELFT>::create(std::move(mb),
> atomizeStrings);
>    }
>  };
>
> -class ELFObjectReader : public Reader {
> +class X86ELFObjectReader : public ELFObjectReader {
>  public:
> -  ELFObjectReader(bool atomizeStrings) : _atomizeStrings(atomizeStrings)
> {}
> -
> -  bool canParse(file_magic magic, StringRef,
> -                const MemoryBuffer &) const override {
> -    return (magic == llvm::sys::fs::file_magic::elf_relocatable);
> -  }
> +  X86ELFObjectReader(bool atomizeStrings) :
> ELFObjectReader(atomizeStrings) {}
>
>    std::error_code
>    parseFile(std::unique_ptr<MemoryBuffer> &mb, const class Registry &,
>              std::vector<std::unique_ptr<File>> &result) const override {
>      std::size_t maxAlignment =
>          1ULL << llvm::countTrailingZeros(uintptr_t(mb->getBufferStart()));
> -    auto f = createELF<ELFFileCreateELFTraits>(
> +    auto f = createELF<X86ELFFileCreateELFTraits>(
>          llvm::object::getElfArchType(mb->getBuffer()), maxAlignment,
>          std::move(mb), _atomizeStrings);
>      if (std::error_code ec = f.getError())
> @@ -61,26 +53,18 @@ public:
>      result.push_back(std::move(*f));
>      return std::error_code();
>    }
> -
> -protected:
> -  bool _atomizeStrings;
>  };
>
> -class ELFDSOReader : public Reader {
> +class X86ELFDSOReader : public ELFDSOReader {
>  public:
> -  ELFDSOReader(bool useUndefines) : _useUndefines(useUndefines) {}
> -
> -  bool canParse(file_magic magic, StringRef,
> -                const MemoryBuffer &) const override {
> -    return (magic == llvm::sys::fs::file_magic::elf_shared_object);
> -  }
> +  X86ELFDSOReader(bool useUndefines) : ELFDSOReader(useUndefines) {}
>
>    std::error_code
>    parseFile(std::unique_ptr<MemoryBuffer> &mb, const class Registry &,
>              std::vector<std::unique_ptr<File>> &result) const override {
>      std::size_t maxAlignment =
>          1ULL << llvm::countTrailingZeros(uintptr_t(mb->getBufferStart()));
> -    auto f = createELF<DynamicFileCreateELFTraits>(
> +    auto f = createELF<X86DynamicFileCreateELFTraits>(
>          llvm::object::getElfArchType(mb->getBuffer()), maxAlignment,
>          std::move(mb), _useUndefines);
>      if (std::error_code ec = f.getError())
> @@ -88,12 +72,9 @@ public:
>      result.push_back(std::move(*f));
>      return std::error_code();
>    }
> -
> -protected:
> -  bool _useUndefines;
>  };
>
>  } // namespace elf
>  } // namespace lld
>
> -#endif // LLD_READER_WRITER_ELF_READER_H
> +#endif // LLD_READER_WRITER_X86_X86_ELF_READER_H
>
> Added: lld/trunk/lib/ReaderWriter/ELF/X86/X86ExecutableWriter.h
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/X86/X86ExecutableWriter.h?rev=220129&view=auto
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/X86/X86ExecutableWriter.h (added)
> +++ lld/trunk/lib/ReaderWriter/ELF/X86/X86ExecutableWriter.h Sat Oct 18
> 00:23:17 2014
> @@ -0,0 +1,57 @@
> +//===- lib/ReaderWriter/ELF/X86/X86ExecutableWriter.h
> ---------------------===//
> +//
> +//                             The LLVM Linker
> +//
> +// This file is distributed under the University of Illinois Open Source
> +// License. See LICENSE.TXT for details.
> +//
>
> +//===----------------------------------------------------------------------===//
> +#ifndef X86_X86_EXECUTABLE_WRITER_H
> +#define X86_X86_EXECUTABLE_WRITER_H
> +
> +#include "ExecutableWriter.h"
> +#include "X86LinkingContext.h"
> +
> +namespace lld {
> +namespace elf {
> +
> +template <class ELFT>
> +class X86ExecutableWriter : public ExecutableWriter<ELFT> {
> +public:
> +  X86ExecutableWriter(X86LinkingContext &context,
> +                      X86TargetLayout<ELFT> &layout);
> +
> +protected:
> +  // Add any runtime files and their atoms to the output
> +  virtual bool createImplicitFiles(std::vector<std::unique_ptr<File>> &);
> +
> +  virtual void finalizeDefaultAtomValues() {
> +    return ExecutableWriter<ELFT>::finalizeDefaultAtomValues();
> +  }
> +
> +  virtual void addDefaultAtoms() {
> +    return ExecutableWriter<ELFT>::addDefaultAtoms();
> +  }
> +
> +private:
> +  X86LinkingContext &_context;
> +  X86TargetLayout<ELFT> &_x86Layout;
> +};
> +
> +template <class ELFT>
> +X86ExecutableWriter<ELFT>::X86ExecutableWriter(X86LinkingContext &context,
> +                                               X86TargetLayout<ELFT>
> &layout)
> +    : ExecutableWriter<ELFT>(context, layout), _context(context),
> +      _x86Layout(layout) {}
> +
> +template <class ELFT>
> +bool X86ExecutableWriter<ELFT>::createImplicitFiles(
> +    std::vector<std::unique_ptr<File>> &result) {
> +  ExecutableWriter<ELFT>::createImplicitFiles(result);
> +  return true;
> +}
> +
> +} // namespace elf
> +} // namespace lld
> +
> +#endif
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/X86/X86LinkingContext.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/X86/X86LinkingContext.cpp?rev=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/X86/X86LinkingContext.cpp (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/X86/X86LinkingContext.cpp Sat Oct 18
> 00:23:17 2014
> @@ -8,9 +8,7 @@
>
>  //===----------------------------------------------------------------------===//
>
>  #include "X86LinkingContext.h"
> -
>  #include "lld/Core/LLVM.h"
> -
>  #include "llvm/ADT/StringSwitch.h"
>  #include "llvm/Support/ErrorOr.h"
>
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/X86/X86LinkingContext.h
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/X86/X86LinkingContext.h?rev=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/X86/X86LinkingContext.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/X86/X86LinkingContext.h Sat Oct 18
> 00:23:17 2014
> @@ -11,9 +11,7 @@
>  #define LLD_READER_WRITER_ELF_X86_TARGETINFO_H
>
>  #include "X86TargetHandler.h"
> -
>  #include "lld/ReaderWriter/ELFLinkingContext.h"
> -
>  #include "llvm/Object/ELF.h"
>  #include "llvm/Support/ELF.h"
>
>
> Added: lld/trunk/lib/ReaderWriter/ELF/X86/X86RelocationHandler.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/X86/X86RelocationHandler.cpp?rev=220129&view=auto
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/X86/X86RelocationHandler.cpp (added)
> +++ lld/trunk/lib/ReaderWriter/ELF/X86/X86RelocationHandler.cpp Sat Oct 18
> 00:23:17 2014
> @@ -0,0 +1,64 @@
> +//===- lib/ReaderWriter/ELF/X86/X86RelocationHandler.cpp
> ------------------===//
> +//
> +//                             The LLVM Linker
> +//
> +// This file is distributed under the University of Illinois Open Source
> +// License. See LICENSE.TXT for details.
> +//
>
> +//===----------------------------------------------------------------------===//
> +
> +#include "X86LinkingContext.h"
> +#include "X86TargetHandler.h"
> +
> +using namespace lld;
> +using namespace elf;
> +
> +namespace {
> +/// \brief R_386_32 - word32:  S + A
> +static int reloc32(uint8_t *location, uint64_t P, uint64_t S, uint64_t A)
> {
> +  int32_t result = (uint32_t)(S + A);
> +  *reinterpret_cast<llvm::support::ulittle32_t *>(location) =
> +      result |
> +      (uint32_t) * reinterpret_cast<llvm::support::ulittle32_t
> *>(location);
> +  return 0;
> +}
> +
> +/// \brief R_386_PC32 - word32: S + A - P
> +static int relocPC32(uint8_t *location, uint64_t P, uint64_t S, uint64_t
> A) {
> +  uint32_t result = (uint32_t)((S + A) - P);
> +  *reinterpret_cast<llvm::support::ulittle32_t *>(location) =
> +      result +
> +      (uint32_t) * reinterpret_cast<llvm::support::ulittle32_t
> *>(location);
> +  return 0;
> +}
> +}
> +
> +std::error_code X86TargetRelocationHandler::applyRelocation(
> +    ELFWriter &writer, llvm::FileOutputBuffer &buf, const lld::AtomLayout
> &atom,
> +    const Reference &ref) const {
> +  uint8_t *atomContent = buf.getBufferStart() + atom._fileOffset;
> +  uint8_t *location = atomContent + ref.offsetInAtom();
> +  uint64_t targetVAddress = writer.addressOfAtom(ref.target());
> +  uint64_t relocVAddress = atom._virtualAddr + ref.offsetInAtom();
> +
> +  if (ref.kindNamespace() != Reference::KindNamespace::ELF)
> +    return std::error_code();
> +  assert(ref.kindArch() == Reference::KindArch::x86);
> +  switch (ref.kindValue()) {
> +  case R_386_32:
> +    reloc32(location, relocVAddress, targetVAddress, ref.addend());
> +    break;
> +  case R_386_PC32:
> +    relocPC32(location, relocVAddress, targetVAddress, ref.addend());
> +    break;
> +  default: {
> +    std::string str;
> +    llvm::raw_string_ostream s(str);
> +    s << "Unhandled I386 relocation # " << ref.kindValue();
> +    s.flush();
> +    llvm_unreachable(str.c_str());
> +  }
> +  }
> +
> +  return std::error_code();
> +}
>
> Added: lld/trunk/lib/ReaderWriter/ELF/X86/X86RelocationHandler.h
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/X86/X86RelocationHandler.h?rev=220129&view=auto
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/X86/X86RelocationHandler.h (added)
> +++ lld/trunk/lib/ReaderWriter/ELF/X86/X86RelocationHandler.h Sat Oct 18
> 00:23:17 2014
> @@ -0,0 +1,33 @@
> +//===- lib/ReaderWriter/ELF/X86/X86RelocationHandler.h
> --------------------===//
> +//
> +//                             The LLVM Linker
> +//
> +// This file is distributed under the University of Illinois Open Source
> +// License. See LICENSE.TXT for details.
> +//
>
> +//===----------------------------------------------------------------------===//
> +
> +#ifndef X86_X86_RELOCATION_HANDLER_H
> +#define X86_X86_RELOCATION_HANDLER_H
> +
> +#include "X86TargetHandler.h"
> +
> +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> {
> +public:
> +  X86TargetRelocationHandler(X86TargetLayout<X86ELFType> &) {}
> +
> +  std::error_code applyRelocation(ELFWriter &, llvm::FileOutputBuffer &,
> +                                  const lld::AtomLayout &,
> +                                  const Reference &) const override;
> +};
> +
> +} // end namespace elf
> +} // end namespace lld
> +
> +#endif // X86_X86_RELOCATION_HANDLER_H
>
> 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=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/X86/X86TargetHandler.cpp (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/X86/X86TargetHandler.cpp Sat Oct 18
> 00:23:17 2014
> @@ -8,36 +8,23 @@
>
>  //===----------------------------------------------------------------------===//
>
>  #include "X86TargetHandler.h"
> +#include "X86DynamicLibraryWriter.h"
> +#include "X86ExecutableWriter.h"
>  #include "X86LinkingContext.h"
> +#include "X86RelocationHandler.h"
>
>  using namespace lld;
>  using namespace elf;
>
>  using namespace llvm::ELF;
>
> -/// \brief R_386_32 - word32:  S + A
> -static int reloc32(uint8_t *location, uint64_t P, uint64_t S, uint64_t A)
> {
> -  int32_t result = (uint32_t)(S + A);
> -  *reinterpret_cast<llvm::support::ulittle32_t *>(location) = result |
> -            (uint32_t)*reinterpret_cast<llvm::support::ulittle32_t
> *>(location);
> -  return 0;
> -}
> -
> -/// \brief R_386_PC32 - word32: S + A - P
> -static int relocPC32(uint8_t *location, uint64_t P, uint64_t S, uint64_t
> A) {
> -  uint32_t result = (uint32_t)((S + A) - P);
> -  *reinterpret_cast<llvm::support::ulittle32_t *>(location) = result +
> -            (uint32_t)*reinterpret_cast<llvm::support::ulittle32_t
> *>(location);
> -  return 0;
> -}
> -
>  std::unique_ptr<Writer> X86TargetHandler::getWriter() {
>    switch (_x86LinkingContext.getOutputELFType()) {
>    case llvm::ELF::ET_EXEC:
> -    return std::unique_ptr<Writer>(new elf::ExecutableWriter<X86ELFType>(
> +    return std::unique_ptr<Writer>(new X86ExecutableWriter<X86ELFType>(
>          _x86LinkingContext, *_x86TargetLayout.get()));
>    case llvm::ELF::ET_DYN:
> -    return std::unique_ptr<Writer>(new
> elf::DynamicLibraryWriter<X86ELFType>(
> +    return std::unique_ptr<Writer>(new
> X86DynamicLibraryWriter<X86ELFType>(
>          _x86LinkingContext, *_x86TargetLayout.get()));
>    case llvm::ELF::ET_REL:
>      llvm_unreachable("TODO: support -r mode");
> @@ -96,38 +83,8 @@ void X86TargetHandler::registerRelocatio
>                          kindStrings);
>  }
>
> -std::error_code X86TargetRelocationHandler::applyRelocation(
> -    ELFWriter &writer, llvm::FileOutputBuffer &buf, const lld::AtomLayout
> &atom,
> -    const Reference &ref) const {
> -  uint8_t *atomContent = buf.getBufferStart() + atom._fileOffset;
> -  uint8_t *location = atomContent + ref.offsetInAtom();
> -  uint64_t targetVAddress = writer.addressOfAtom(ref.target());
> -  uint64_t relocVAddress = atom._virtualAddr + ref.offsetInAtom();
> -
> -  if (ref.kindNamespace() != Reference::KindNamespace::ELF)
> -    return std::error_code();
> -  assert(ref.kindArch() == Reference::KindArch::x86);
> -  switch (ref.kindValue()) {
> -  case R_386_32:
> -    reloc32(location, relocVAddress, targetVAddress, ref.addend());
> -    break;
> -  case R_386_PC32:
> -    relocPC32(location, relocVAddress, targetVAddress, ref.addend());
> -    break;
> -  default : {
> -    std::string str;
> -    llvm::raw_string_ostream s(str);
> -    s << "Unhandled I386 relocation # " << ref.kindValue();
> -    s.flush();
> -    llvm_unreachable(str.c_str());
> -  }
> -  }
> -
> -  return std::error_code();
> -}
> -
>  X86TargetHandler::X86TargetHandler(X86LinkingContext &context)
>      : DefaultTargetHandler(context), _x86LinkingContext(context),
>        _x86TargetLayout(new X86TargetLayout<X86ELFType>(context)),
>        _x86RelocationHandler(
> -          new X86TargetRelocationHandler(context,
> *_x86TargetLayout.get())) {}
> +          new X86TargetRelocationHandler(*_x86TargetLayout.get())) {}
>
> 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=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/X86/X86TargetHandler.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/X86/X86TargetHandler.h Sat Oct 18
> 00:23:17 2014
> @@ -12,8 +12,9 @@
>
>  #include "DefaultTargetHandler.h"
>  #include "TargetLayout.h"
> -
> -#include "lld/ReaderWriter/Reader.h"
> +#include "X86ELFFile.h"
> +#include "X86ELFReader.h"
> +#include "X86RelocationHandler.h"
>
>  namespace lld {
>  namespace elf {
> @@ -26,24 +27,6 @@ public:
>    X86TargetLayout(X86LinkingContext &context) :
> TargetLayout<ELFT>(context) {}
>  };
>
> -class X86TargetRelocationHandler final
> -    : public TargetRelocationHandler<X86ELFType> {
> -public:
> -  X86TargetRelocationHandler(X86LinkingContext &context,
> -                             X86TargetLayout<X86ELFType> &layout)
> -      : _x86Context(context), _x86TargetLayout(layout) {}
> -
> -  std::error_code applyRelocation(ELFWriter &, llvm::FileOutputBuffer &,
> -                                  const lld::AtomLayout &,
> -                                  const Reference &) const override;
> -
> -  static const Registry::KindStrings kindStrings[];
> -
> -protected:
> -  X86LinkingContext &_x86Context;
> -  X86TargetLayout<X86ELFType> &_x86TargetLayout;
> -};
> -
>  class X86TargetHandler final
>      : public DefaultTargetHandler<X86ELFType> {
>  public:
> @@ -59,6 +42,14 @@ public:
>      return *(_x86RelocationHandler.get());
>    }
>
> +  std::unique_ptr<Reader> getObjReader(bool atomizeStrings) override {
> +    return std::unique_ptr<Reader>(new
> X86ELFObjectReader(atomizeStrings));
> +  }
> +
> +  std::unique_ptr<Reader> getDSOReader(bool useShlibUndefines) override {
> +    return std::unique_ptr<Reader>(new
> X86ELFDSOReader(useShlibUndefines));
> +  }
> +
>    std::unique_ptr<Writer> getWriter() override;
>
>  protected:
>
> Added: lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64ELFFile.h
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64ELFFile.h?rev=220129&view=auto
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64ELFFile.h (added)
> +++ lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64ELFFile.h Sat Oct 18
> 00:23:17 2014
> @@ -0,0 +1,73 @@
> +//===- lib/ReaderWriter/ELF/X86_64/X86_64ELFFile.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_ELF_FILE_H
> +#define LLD_READER_WRITER_ELF_X86_64_ELF_FILE_H
> +
> +#include "ELFReader.h"
> +
> +namespace lld {
> +namespace elf {
> +
> +class X86_64LinkingContext;
> +
> +template <class ELFT> class X86_64ELFFile : public ELFFile<ELFT> {
> +public:
> +  X86_64ELFFile(StringRef name, bool atomizeStrings)
> +      : ELFFile<ELFT>(name, atomizeStrings) {}
> +
> +  X86_64ELFFile(std::unique_ptr<MemoryBuffer> mb, bool atomizeStrings,
> +                std::error_code &ec)
> +      : ELFFile<ELFT>(std::move(mb), atomizeStrings, ec) {}
> +
> +  static ErrorOr<std::unique_ptr<X86_64ELFFile>>
> +  create(std::unique_ptr<MemoryBuffer> mb, bool atomizeStrings) {
> +    std::error_code ec;
> +    std::unique_ptr<X86_64ELFFile<ELFT>> file(
> +        new X86_64ELFFile<ELFT>(mb->getBufferIdentifier(),
> atomizeStrings));
> +
> +    file->_objFile.reset(
> +        new llvm::object::ELFFile<ELFT>(mb.release()->getBuffer(), ec));
> +
> +    if (ec)
> +      return ec;
> +
> +    // Read input sections from the input file that need to be converted
> to
> +    // atoms
> +    if ((ec = file->createAtomizableSections()))
> +      return ec;
> +
> +    // For mergeable strings, we would need to split the section into
> various
> +    // atoms
> +    if ((ec = file->createMergeableAtoms()))
> +      return ec;
> +
> +    // Create the necessary symbols that are part of the section that we
> +    // created in createAtomizableSections function
> +    if ((ec = file->createSymbolsFromAtomizableSections()))
> +      return ec;
> +
> +    // Create the appropriate atoms from the file
> +    if ((ec = file->createAtoms()))
> +      return ec;
> +
> +    return std::move(file);
> +  }
> +};
> +
> +template <class ELFT> class X86_64DynamicFile : public DynamicFile<ELFT> {
> +public:
> +  X86_64DynamicFile(const X86_64LinkingContext &context, StringRef name)
> +      : DynamicFile<ELFT>(context, name) {}
> +};
> +
> +} // elf
> +} // lld
> +
> +#endif // LLD_READER_WRITER_ELF_X86_64_ELF_FILE_H
>
> Copied: lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64ELFReader.h (from
> r220117, lld/trunk/lib/ReaderWriter/ELF/ELFReader.h)
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64ELFReader.h?p2=lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64ELFReader.h&p1=lld/trunk/lib/ReaderWriter/ELF/ELFReader.h&r1=220117&r2=220129&rev=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/ELFReader.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64ELFReader.h Sat Oct 18
> 00:23:17 2014
> @@ -1,4 +1,4 @@
> -//===- lib/ReaderWriter/ELF/ELFReader.h
> -----------------------------------===//
> +//===- lib/ReaderWriter/ELF/X86_64/X86_64ELFReader.h
> ----------------------===//
>  //
>  //                             The LLVM Linker
>  //
> @@ -7,53 +7,47 @@
>  //
>
>  //===----------------------------------------------------------------------===//
>
> -#ifndef LLD_READER_WRITER_ELF_READER_H
> -#define LLD_READER_WRITER_ELF_READER_H
> +#ifndef LLD_READER_WRITER_X86_64_X86_64_ELF_READER_H
> +#define LLD_READER_WRITER_X86_64_X86_64_ELF_READER_H
>
> -#include "CreateELF.h"
> -#include "DynamicFile.h"
> -#include "ELFFile.h"
> -
> -#include "lld/ReaderWriter/Reader.h"
> +#include "ELFReader.h"
> +#include "X86_64ELFFile.h"
>
>  namespace lld {
>  namespace elf {
>
> -struct DynamicFileCreateELFTraits {
> +struct X86_64DynamicFileCreateELFTraits {
>    typedef llvm::ErrorOr<std::unique_ptr<lld::SharedLibraryFile>>
> result_type;
>
>    template <class ELFT>
>    static result_type create(std::unique_ptr<llvm::MemoryBuffer> mb,
>                              bool useUndefines) {
> -    return lld::elf::DynamicFile<ELFT>::create(std::move(mb),
> useUndefines);
> +    return lld::elf::X86_64DynamicFile<ELFT>::create(std::move(mb),
> +                                                     useUndefines);
>    }
>  };
>
> -struct ELFFileCreateELFTraits {
> +struct X86_64ELFFileCreateELFTraits {
>    typedef llvm::ErrorOr<std::unique_ptr<lld::File>> result_type;
>
>    template <class ELFT>
>    static result_type create(std::unique_ptr<llvm::MemoryBuffer> mb,
>                              bool atomizeStrings) {
> -    return lld::elf::ELFFile<ELFT>::create(std::move(mb), atomizeStrings);
> +    return lld::elf::X86_64ELFFile<ELFT>::create(std::move(mb),
> atomizeStrings);
>    }
>  };
>
> -class ELFObjectReader : public Reader {
> +class X86_64ELFObjectReader : public ELFObjectReader {
>  public:
> -  ELFObjectReader(bool atomizeStrings) : _atomizeStrings(atomizeStrings)
> {}
> -
> -  bool canParse(file_magic magic, StringRef,
> -                const MemoryBuffer &) const override {
> -    return (magic == llvm::sys::fs::file_magic::elf_relocatable);
> -  }
> +  X86_64ELFObjectReader(bool atomizeStrings)
> +      : ELFObjectReader(atomizeStrings) {}
>
>    std::error_code
>    parseFile(std::unique_ptr<MemoryBuffer> &mb, const class Registry &,
>              std::vector<std::unique_ptr<File>> &result) const override {
>      std::size_t maxAlignment =
>          1ULL << llvm::countTrailingZeros(uintptr_t(mb->getBufferStart()));
> -    auto f = createELF<ELFFileCreateELFTraits>(
> +    auto f = createELF<X86_64ELFFileCreateELFTraits>(
>          llvm::object::getElfArchType(mb->getBuffer()), maxAlignment,
>          std::move(mb), _atomizeStrings);
>      if (std::error_code ec = f.getError())
> @@ -61,26 +55,18 @@ public:
>      result.push_back(std::move(*f));
>      return std::error_code();
>    }
> -
> -protected:
> -  bool _atomizeStrings;
>  };
>
> -class ELFDSOReader : public Reader {
> +class X86_64ELFDSOReader : public ELFDSOReader {
>  public:
> -  ELFDSOReader(bool useUndefines) : _useUndefines(useUndefines) {}
> -
> -  bool canParse(file_magic magic, StringRef,
> -                const MemoryBuffer &) const override {
> -    return (magic == llvm::sys::fs::file_magic::elf_shared_object);
> -  }
> +  X86_64ELFDSOReader(bool useUndefines) : ELFDSOReader(useUndefines) {}
>
>    std::error_code
>    parseFile(std::unique_ptr<MemoryBuffer> &mb, const class Registry &,
>              std::vector<std::unique_ptr<File>> &result) const override {
>      std::size_t maxAlignment =
>          1ULL << llvm::countTrailingZeros(uintptr_t(mb->getBufferStart()));
> -    auto f = createELF<DynamicFileCreateELFTraits>(
> +    auto f = createELF<X86_64DynamicFileCreateELFTraits>(
>          llvm::object::getElfArchType(mb->getBuffer()), maxAlignment,
>          std::move(mb), _useUndefines);
>      if (std::error_code ec = f.getError())
> @@ -88,12 +74,9 @@ public:
>      result.push_back(std::move(*f));
>      return std::error_code();
>    }
> -
> -protected:
> -  bool _useUndefines;
>  };
>
>  } // namespace elf
>  } // namespace lld
>
> -#endif // LLD_READER_WRITER_ELF_READER_H
> +#endif // LLD_READER_WRITER_ELF_X86_64_X86_64_READER_H
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64LinkingContext.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64LinkingContext.cpp?rev=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64LinkingContext.cpp
> (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64LinkingContext.cpp Sat Oct
> 18 00:23:17 2014
> @@ -8,16 +8,13 @@
>
>  //===----------------------------------------------------------------------===//
>
>  #include "X86_64LinkingContext.h"
> -
> +#include "Atoms.h"
> +#include "X86_64RelocationPass.h"
>  #include "lld/Core/File.h"
>  #include "lld/Core/Instrumentation.h"
> -
>  #include "llvm/ADT/ArrayRef.h"
>  #include "llvm/ADT/StringSwitch.h"
>
> -#include "Atoms.h"
> -#include "X86_64RelocationPass.h"
> -
>  using namespace lld;
>  using namespace lld::elf;
>
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64LinkingContext.h
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64LinkingContext.h?rev=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64LinkingContext.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64LinkingContext.h Sat Oct
> 18 00:23:17 2014
> @@ -11,9 +11,7 @@
>  #define LLD_READER_WRITER_ELF_X86_64_X86_64_LINKING_CONTEXT_H
>
>  #include "X86_64TargetHandler.h"
> -
>  #include "lld/ReaderWriter/ELFLinkingContext.h"
> -
>  #include "llvm/Object/ELF.h"
>  #include "llvm/Support/ELF.h"
>
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64RelocationHandler.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64RelocationHandler.cpp?rev=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64RelocationHandler.cpp
> (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64RelocationHandler.cpp Sat
> Oct 18 00:23:17 2014
> @@ -7,8 +7,8 @@
>  //
>
>  //===----------------------------------------------------------------------===//
>
> -#include "X86_64TargetHandler.h"
>  #include "X86_64LinkingContext.h"
> +#include "X86_64TargetHandler.h"
>
>  using namespace lld;
>  using namespace elf;
>
> 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=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64RelocationHandler.h
> (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64RelocationHandler.h Sat
> Oct 18 00:23:17 2014
> @@ -28,8 +28,6 @@ public:
>                                    const lld::AtomLayout &,
>                                    const Reference &) const override;
>
> -  static const Registry::KindStrings kindStrings[];
> -
>  private:
>    // Cached size of the TLS segment.
>    mutable uint64_t _tlsSize;
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64RelocationPass.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64RelocationPass.cpp?rev=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64RelocationPass.cpp
> (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64RelocationPass.cpp Sat Oct
> 18 00:23:17 2014
> @@ -20,13 +20,10 @@
>
>  //===----------------------------------------------------------------------===//
>
>  #include "X86_64RelocationPass.h"
> -
> -#include "lld/Core/Simple.h"
> -
> -#include "llvm/ADT/DenseMap.h"
> -
>  #include "Atoms.h"
>  #include "X86_64LinkingContext.h"
> +#include "lld/Core/Simple.h"
> +#include "llvm/ADT/DenseMap.h"
>
>  using namespace lld;
>  using namespace lld::elf;
>
> Modified: lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.cpp?rev=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.cpp
> (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.cpp Sat Oct
> 18 00:23:17 2014
> @@ -8,10 +8,10 @@
>
>  //===----------------------------------------------------------------------===//
>
>  #include "Atoms.h"
> -#include "X86_64ExecutableWriter.h"
>  #include "X86_64DynamicLibraryWriter.h"
> -#include "X86_64TargetHandler.h"
> +#include "X86_64ExecutableWriter.h"
>  #include "X86_64LinkingContext.h"
> +#include "X86_64TargetHandler.h"
>
>  using namespace lld;
>  using namespace elf;
>
> 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=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.h (original)
> +++ lld/trunk/lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.h Sat Oct 18
> 00:23:17 2014
> @@ -11,10 +11,10 @@
>  #define LLD_READER_WRITER_ELF_X86_64_X86_64_TARGET_HANDLER_H
>
>  #include "DefaultTargetHandler.h"
> -#include "ELFFile.h"
> -#include "X86_64RelocationHandler.h"
>  #include "TargetLayout.h"
> -
> +#include "X86_64ELFFile.h"
> +#include "X86_64ELFReader.h"
> +#include "X86_64RelocationHandler.h"
>  #include "lld/Core/Simple.h"
>
>  namespace lld {
> @@ -43,6 +43,14 @@ public:
>      return *(_x86_64RelocationHandler.get());
>    }
>
> +  std::unique_ptr<Reader> getObjReader(bool atomizeStrings) override {
> +    return std::unique_ptr<Reader>(new
> X86_64ELFObjectReader(atomizeStrings));
> +  }
> +
> +  std::unique_ptr<Reader> getDSOReader(bool useShlibUndefines) override {
> +    return std::unique_ptr<Reader>(new
> X86_64ELFDSOReader(useShlibUndefines));
> +  }
> +
>    std::unique_ptr<Writer> getWriter() override;
>
>  private:
>
> Modified: lld/trunk/test/elf/symbols.test
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/symbols.test?rev=220129&r1=220128&r2=220129&view=diff
>
> ==============================================================================
> --- lld/trunk/test/elf/symbols.test (original)
> +++ lld/trunk/test/elf/symbols.test Sat Oct 18 00:23:17 2014
> @@ -19,15 +19,15 @@ RUN: llvm-nm -n %t1 | FileCheck -check-p
>  RUN: lld -flavor gnu -shared -target i386 -e main %p/Inputs/writersyms.o
> -o %t1
>  RUN: llvm-nm -n %t1 | FileCheck -check-prefix CHECKSHAREDSYMS %s
>
> -CHECKSYMS:  00000000 a 1.c
> -CHECKSYMS:  00000134 T main
> -CHECKSYMS:  00001000 A __bss_start
> -CHECKSYMS:  00001000 B a
> -CHECKSYMS:  00001004 A __bss_end
> -CHECKSYMS:  00001004 A _end
> -CHECKSYMS:  00001004 A end
> +CHECKSYMS:  {{[0-9a-f]+}} a 1.c
> +CHECKSYMS:  {{[0-9a-f]+}} T main
> +CHECKSYMS:  {{[0-9a-f]+}} A __bss_start
> +CHECKSYMS:  {{[0-9a-f]+}} B a
> +CHECKSYMS:  {{[0-9a-f]+}} A __bss_end
> +CHECKSYMS:  {{[0-9a-f]+}} A _end
> +CHECKSYMS:  {{[0-9a-f]+}} A end
>
> -CHECKSHAREDSYMS:  00000000 a 1.c
> -CHECKSHAREDSYMS:  0000010c T main
> -CHECKSHAREDSYMS:  00001000 B a
> -CHECKSHAREDSYMS:  00001004 A _end
> +CHECKSHAREDSYMS:  {{[0-9a-f]+}} a 1.c
> +CHECKSHAREDSYMS:  {{[0-9a-f]+}} T main
> +CHECKSHAREDSYMS:  {{[0-9a-f]+}} B a
> +CHECKSHAREDSYMS:  {{[0-9a-f]+}} A _end
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141020/32320a3d/attachment.html>


More information about the llvm-commits mailing list