Index: lld/trunk/CMakeLists.txt =================================================================== --- lld/trunk/CMakeLists.txt +++ lld/trunk/CMakeLists.txt @@ -160,8 +160,8 @@ # Configure the Version.inc file. configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/include/lld/Config/Version.inc.in - ${CMAKE_CURRENT_BINARY_DIR}/include/lld/Config/Version.inc) + ${CMAKE_CURRENT_SOURCE_DIR}/include/lld/Common/Version.inc.in + ${CMAKE_CURRENT_BINARY_DIR}/include/lld/Common/Version.inc) if (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR) @@ -210,6 +210,7 @@ ) endif() +add_subdirectory(Common) add_subdirectory(lib) add_subdirectory(tools/lld) Index: lld/trunk/COFF/CMakeLists.txt =================================================================== --- lld/trunk/COFF/CMakeLists.txt +++ lld/trunk/COFF/CMakeLists.txt @@ -42,6 +42,7 @@ WindowsManifest LINK_LIBS + lldCommon lldCore ${LLVM_PTHREAD_LIB} Index: lld/trunk/COFF/Chunks.h =================================================================== --- lld/trunk/COFF/Chunks.h +++ lld/trunk/COFF/Chunks.h @@ -12,7 +12,7 @@ #include "Config.h" #include "InputFiles.h" -#include "lld/Core/LLVM.h" +#include "lld/Common/LLVM.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/iterator.h" #include "llvm/ADT/iterator_range.h" Index: lld/trunk/COFF/Driver.h =================================================================== --- lld/trunk/COFF/Driver.h +++ lld/trunk/COFF/Driver.h @@ -12,8 +12,8 @@ #include "Config.h" #include "SymbolTable.h" -#include "lld/Core/LLVM.h" -#include "lld/Core/Reproduce.h" +#include "lld/Common/LLVM.h" +#include "lld/Common/Reproduce.h" #include "llvm/ADT/Optional.h" #include "llvm/ADT/StringRef.h" #include "llvm/Object/Archive.h" Index: lld/trunk/COFF/Driver.cpp =================================================================== --- lld/trunk/COFF/Driver.cpp +++ lld/trunk/COFF/Driver.cpp @@ -15,7 +15,7 @@ #include "SymbolTable.h" #include "Symbols.h" #include "Writer.h" -#include "lld/Driver/Driver.h" +#include "lld/Common/Driver.h" #include "llvm/ADT/Optional.h" #include "llvm/ADT/StringSwitch.h" #include "llvm/BinaryFormat/Magic.h" Index: lld/trunk/COFF/Error.h =================================================================== --- lld/trunk/COFF/Error.h +++ lld/trunk/COFF/Error.h @@ -10,7 +10,7 @@ #ifndef LLD_COFF_ERROR_H #define LLD_COFF_ERROR_H -#include "lld/Core/LLVM.h" +#include "lld/Common/LLVM.h" #include "llvm/Support/Error.h" namespace lld { Index: lld/trunk/COFF/InputFiles.h =================================================================== --- lld/trunk/COFF/InputFiles.h +++ lld/trunk/COFF/InputFiles.h @@ -11,7 +11,7 @@ #define LLD_COFF_INPUT_FILES_H #include "Config.h" -#include "lld/Core/LLVM.h" +#include "lld/Common/LLVM.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/DenseSet.h" #include "llvm/LTO/LTO.h" Index: lld/trunk/COFF/LTO.h =================================================================== --- lld/trunk/COFF/LTO.h +++ lld/trunk/COFF/LTO.h @@ -21,7 +21,7 @@ #ifndef LLD_COFF_LTO_H #define LLD_COFF_LTO_H -#include "lld/Core/LLVM.h" +#include "lld/Common/LLVM.h" #include "llvm/ADT/SmallString.h" #include #include Index: lld/trunk/COFF/LTO.cpp =================================================================== --- lld/trunk/COFF/LTO.cpp +++ lld/trunk/COFF/LTO.cpp @@ -12,7 +12,7 @@ #include "Error.h" #include "InputFiles.h" #include "Symbols.h" -#include "lld/Core/TargetOptionsCommandFlags.h" +#include "lld/Common/TargetOptionsCommandFlags.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/StringRef.h" Index: lld/trunk/COFF/Symbols.h =================================================================== --- lld/trunk/COFF/Symbols.h +++ lld/trunk/COFF/Symbols.h @@ -13,7 +13,7 @@ #include "Chunks.h" #include "Config.h" #include "Memory.h" -#include "lld/Core/LLVM.h" +#include "lld/Common/LLVM.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/Object/Archive.h" #include "llvm/Object/COFF.h" Index: lld/trunk/Common/CMakeLists.txt =================================================================== --- lld/trunk/Common/CMakeLists.txt +++ lld/trunk/Common/CMakeLists.txt @@ -0,0 +1,12 @@ +add_lld_library(lldCommon + Reproduce.cpp + TargetOptionsCommandFlags.cpp + Version.cpp + + ADDITIONAL_HEADER_DIRS + ${LLD_INCLUDE_DIR}/lld/Common + + LINK_COMPONENTS + Option + Support + ) Index: lld/trunk/Common/Reproduce.cpp =================================================================== --- lld/trunk/Common/Reproduce.cpp +++ lld/trunk/Common/Reproduce.cpp @@ -0,0 +1,66 @@ +//===- Reproduce.cpp - Utilities for creating reproducers -----------------===// +// +// The LLVM Linker +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "lld/Common/Reproduce.h" +#include "llvm/Option/Arg.h" +#include "llvm/Support/Error.h" +#include "llvm/Support/FileSystem.h" +#include "llvm/Support/Path.h" + +using namespace lld; +using namespace llvm; +using namespace llvm::sys; + +// Makes a given pathname an absolute path first, and then remove +// beginning /. For example, "../foo.o" is converted to "home/john/foo.o", +// assuming that the current directory is "/home/john/bar". +// Returned string is a forward slash separated path even on Windows to avoid +// a mess with backslash-as-escape and backslash-as-path-separator. +std::string lld::relativeToRoot(StringRef Path) { + SmallString<128> Abs = Path; + if (fs::make_absolute(Abs)) + return Path; + path::remove_dots(Abs, /*remove_dot_dot=*/true); + + // This is Windows specific. root_name() returns a drive letter + // (e.g. "c:") or a UNC name (//net). We want to keep it as part + // of the result. + SmallString<128> Res; + StringRef Root = path::root_name(Abs); + if (Root.endswith(":")) + Res = Root.drop_back(); + else if (Root.startswith("//")) + Res = Root.substr(2); + + path::append(Res, path::relative_path(Abs)); + return path::convert_to_slash(Res); +} + +// Quote a given string if it contains a space character. +std::string lld::quote(StringRef S) { + if (S.contains(' ')) + return ("\"" + S + "\"").str(); + return S; +} + +std::string lld::rewritePath(StringRef S) { + if (fs::exists(S)) + return relativeToRoot(S); + return S; +} + +std::string lld::toString(opt::Arg *Arg) { + std::string K = Arg->getSpelling(); + if (Arg->getNumValues() == 0) + return K; + std::string V = quote(Arg->getValue()); + if (Arg->getOption().getRenderStyle() == opt::Option::RenderJoinedStyle) + return K + V; + return K + " " + V; +} Index: lld/trunk/Common/TargetOptionsCommandFlags.cpp =================================================================== --- lld/trunk/Common/TargetOptionsCommandFlags.cpp +++ lld/trunk/Common/TargetOptionsCommandFlags.cpp @@ -0,0 +1,32 @@ +//===-- TargetOptionsCommandFlags.cpp ---------------------------*- C++ -*-===// +// +// The LLVM Linker +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file exists as a place for global variables defined in LLVM's +// CodeGen/CommandFlags.h. By putting the resulting object file in +// an archive and linking with it, the definitions will automatically be +// included when needed and skipped when already present. +// +//===----------------------------------------------------------------------===// + +#include "lld/Common/TargetOptionsCommandFlags.h" + +#include "llvm/CodeGen/CommandFlags.h" +#include "llvm/Target/TargetOptions.h" + +// Define an externally visible version of +// InitTargetOptionsFromCodeGenFlags, so that its functionality can be +// used without having to include llvm/CodeGen/CommandFlags.h, which +// would lead to multiple definitions of the command line flags. +llvm::TargetOptions lld::InitTargetOptionsFromCodeGenFlags() { + return ::InitTargetOptionsFromCodeGenFlags(); +} + +llvm::Optional lld::GetCodeModelFromCMModel() { + return getCodeModel(); +} Index: lld/trunk/Common/Version.cpp =================================================================== --- lld/trunk/Common/Version.cpp +++ lld/trunk/Common/Version.cpp @@ -0,0 +1,43 @@ +//===- lib/Common/Version.cpp - LLD Version Number ---------------*- C++-=====// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines several version-related utility functions for LLD. +// +//===----------------------------------------------------------------------===// + +#include "lld/Common/Version.h" + +using namespace llvm; + +// Returns an SVN repository path, which is usually "trunk". +static std::string getRepositoryPath() { + StringRef S = LLD_REPOSITORY_STRING; + size_t Pos = S.find("lld/"); + if (Pos != StringRef::npos) + return S.substr(Pos + 4); + return S; +} + +// Returns an SVN repository name, e.g., " (trunk 284614)" +// or an empty string if no repository info is available. +static std::string getRepository() { + std::string Repo = getRepositoryPath(); + std::string Rev = LLD_REVISION_STRING; + + if (Repo.empty() && Rev.empty()) + return ""; + if (!Repo.empty() && !Rev.empty()) + return " (" + Repo + " " + Rev + ")"; + return " (" + Repo + Rev + ")"; +} + +// Returns a version string, e.g., "LLD 4.0 (lld/trunk 284614)". +std::string lld::getLLDVersion() { + return "LLD " + std::string(LLD_VERSION_STRING) + getRepository(); +} Index: lld/trunk/ELF/CMakeLists.txt =================================================================== --- lld/trunk/ELF/CMakeLists.txt +++ lld/trunk/ELF/CMakeLists.txt @@ -65,6 +65,7 @@ TransformUtils LINK_LIBS + lldCommon lldConfig lldCore ${LLVM_PTHREAD_LIB} Index: lld/trunk/ELF/Driver.h =================================================================== --- lld/trunk/ELF/Driver.h +++ lld/trunk/ELF/Driver.h @@ -11,8 +11,8 @@ #define LLD_ELF_DRIVER_H #include "SymbolTable.h" -#include "lld/Core/LLVM.h" -#include "lld/Core/Reproduce.h" +#include "lld/Common/LLVM.h" +#include "lld/Common/Reproduce.h" #include "llvm/ADT/Optional.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/StringSet.h" Index: lld/trunk/ELF/Driver.cpp =================================================================== --- lld/trunk/ELF/Driver.cpp +++ lld/trunk/ELF/Driver.cpp @@ -40,8 +40,8 @@ #include "Target.h" #include "Threads.h" #include "Writer.h" -#include "lld/Config/Version.h" -#include "lld/Driver/Driver.h" +#include "lld/Common/Driver.h" +#include "lld/Common/Version.h" #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/StringSwitch.h" #include "llvm/Support/CommandLine.h" Index: lld/trunk/ELF/DriverUtils.cpp =================================================================== --- lld/trunk/ELF/DriverUtils.cpp +++ lld/trunk/ELF/DriverUtils.cpp @@ -16,8 +16,8 @@ #include "Driver.h" #include "Error.h" #include "Memory.h" -#include "lld/Config/Version.h" -#include "lld/Core/Reproduce.h" +#include "lld/Common/Reproduce.h" +#include "lld/Common/Version.h" #include "llvm/ADT/Optional.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/Triple.h" Index: lld/trunk/ELF/EhFrame.h =================================================================== --- lld/trunk/ELF/EhFrame.h +++ lld/trunk/ELF/EhFrame.h @@ -10,7 +10,7 @@ #ifndef LLD_ELF_EHFRAME_H #define LLD_ELF_EHFRAME_H -#include "lld/Core/LLVM.h" +#include "lld/Common/LLVM.h" namespace lld { namespace elf { Index: lld/trunk/ELF/Error.h =================================================================== --- lld/trunk/ELF/Error.h +++ lld/trunk/ELF/Error.h @@ -28,7 +28,7 @@ #ifndef LLD_ELF_ERROR_H #define LLD_ELF_ERROR_H -#include "lld/Core/LLVM.h" +#include "lld/Common/LLVM.h" #include "llvm/Support/Error.h" Index: lld/trunk/ELF/Filesystem.h =================================================================== --- lld/trunk/ELF/Filesystem.h +++ lld/trunk/ELF/Filesystem.h @@ -10,7 +10,7 @@ #ifndef LLD_ELF_FILESYSTEM_H #define LLD_ELF_FILESYSTEM_H -#include "lld/Core/LLVM.h" +#include "lld/Common/LLVM.h" namespace lld { namespace elf { Index: lld/trunk/ELF/InputFiles.h =================================================================== --- lld/trunk/ELF/InputFiles.h +++ lld/trunk/ELF/InputFiles.h @@ -15,8 +15,8 @@ #include "InputSection.h" #include "Symbols.h" -#include "lld/Core/LLVM.h" -#include "lld/Core/Reproduce.h" +#include "lld/Common/LLVM.h" +#include "lld/Common/Reproduce.h" #include "llvm/ADT/CachedHashString.h" #include "llvm/ADT/DenseSet.h" #include "llvm/ADT/STLExtras.h" Index: lld/trunk/ELF/InputSection.h =================================================================== --- lld/trunk/ELF/InputSection.h +++ lld/trunk/ELF/InputSection.h @@ -13,7 +13,7 @@ #include "Config.h" #include "Relocations.h" #include "Thunks.h" -#include "lld/Core/LLVM.h" +#include "lld/Common/LLVM.h" #include "llvm/ADT/CachedHashString.h" #include "llvm/ADT/DenseSet.h" #include "llvm/ADT/TinyPtrVector.h" Index: lld/trunk/ELF/LTO.h =================================================================== --- lld/trunk/ELF/LTO.h +++ lld/trunk/ELF/LTO.h @@ -21,7 +21,7 @@ #ifndef LLD_ELF_LTO_H #define LLD_ELF_LTO_H -#include "lld/Core/LLVM.h" +#include "lld/Common/LLVM.h" #include "llvm/ADT/DenseSet.h" #include "llvm/ADT/SmallString.h" #include Index: lld/trunk/ELF/LTO.cpp =================================================================== --- lld/trunk/ELF/LTO.cpp +++ lld/trunk/ELF/LTO.cpp @@ -10,11 +10,11 @@ #include "LTO.h" #include "Config.h" #include "Error.h" -#include "LinkerScript.h" #include "InputFiles.h" +#include "LinkerScript.h" #include "SymbolTable.h" #include "Symbols.h" -#include "lld/Core/TargetOptionsCommandFlags.h" +#include "lld/Common/TargetOptionsCommandFlags.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/StringRef.h" Index: lld/trunk/ELF/LinkerScript.h =================================================================== --- lld/trunk/ELF/LinkerScript.h +++ lld/trunk/ELF/LinkerScript.h @@ -13,7 +13,7 @@ #include "Config.h" #include "Strings.h" #include "Writer.h" -#include "lld/Core/LLVM.h" +#include "lld/Common/LLVM.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/DenseSet.h" Index: lld/trunk/ELF/OutputSections.h =================================================================== --- lld/trunk/ELF/OutputSections.h +++ lld/trunk/ELF/OutputSections.h @@ -15,7 +15,7 @@ #include "LinkerScript.h" #include "Relocations.h" -#include "lld/Core/LLVM.h" +#include "lld/Common/LLVM.h" #include "llvm/MC/StringTableBuilder.h" #include "llvm/Object/ELF.h" Index: lld/trunk/ELF/Relocations.h =================================================================== --- lld/trunk/ELF/Relocations.h +++ lld/trunk/ELF/Relocations.h @@ -10,7 +10,7 @@ #ifndef LLD_ELF_RELOCATIONS_H #define LLD_ELF_RELOCATIONS_H -#include "lld/Core/LLVM.h" +#include "lld/Common/LLVM.h" #include "llvm/ADT/DenseMap.h" #include #include Index: lld/trunk/ELF/ScriptLexer.h =================================================================== --- lld/trunk/ELF/ScriptLexer.h +++ lld/trunk/ELF/ScriptLexer.h @@ -10,7 +10,7 @@ #ifndef LLD_ELF_SCRIPT_LEXER_H #define LLD_ELF_SCRIPT_LEXER_H -#include "lld/Core/LLVM.h" +#include "lld/Common/LLVM.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/MemoryBuffer.h" #include Index: lld/trunk/ELF/ScriptParser.h =================================================================== --- lld/trunk/ELF/ScriptParser.h +++ lld/trunk/ELF/ScriptParser.h @@ -10,7 +10,7 @@ #ifndef LLD_ELF_SCRIPT_PARSER_H #define LLD_ELF_SCRIPT_PARSER_H -#include "lld/Core/LLVM.h" +#include "lld/Common/LLVM.h" #include "llvm/Support/MemoryBuffer.h" namespace lld { Index: lld/trunk/ELF/Strings.h =================================================================== --- lld/trunk/ELF/Strings.h +++ lld/trunk/ELF/Strings.h @@ -10,7 +10,7 @@ #ifndef LLD_ELF_STRINGS_H #define LLD_ELF_STRINGS_H -#include "lld/Core/LLVM.h" +#include "lld/Common/LLVM.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/BitVector.h" #include "llvm/ADT/Optional.h" Index: lld/trunk/ELF/Symbols.h =================================================================== --- lld/trunk/ELF/Symbols.h +++ lld/trunk/ELF/Symbols.h @@ -18,7 +18,7 @@ #include "InputSection.h" #include "Strings.h" -#include "lld/Core/LLVM.h" +#include "lld/Common/LLVM.h" #include "llvm/Object/Archive.h" #include "llvm/Object/ELF.h" Index: lld/trunk/ELF/SyntheticSections.cpp =================================================================== --- lld/trunk/ELF/SyntheticSections.cpp +++ lld/trunk/ELF/SyntheticSections.cpp @@ -26,7 +26,7 @@ #include "Target.h" #include "Threads.h" #include "Writer.h" -#include "lld/Config/Version.h" +#include "lld/Common/Version.h" #include "llvm/BinaryFormat/Dwarf.h" #include "llvm/DebugInfo/DWARF/DWARFDebugPubTable.h" #include "llvm/Object/Decompressor.h" Index: lld/trunk/docs/Driver.rst =================================================================== --- lld/trunk/docs/Driver.rst +++ lld/trunk/docs/Driver.rst @@ -65,7 +65,7 @@ Adding a Flavor =============== -#. Add an entry for the flavor in :file:`include/lld/Driver/Driver.h` to +#. Add an entry for the flavor in :file:`include/lld/Common/Driver.h` to :cpp:class:`lld::UniversalDriver::Flavor`. #. Add an entry in :file:`lib/Driver/UniversalDriver.cpp` to Index: lld/trunk/include/lld/Common/Driver.h =================================================================== --- lld/trunk/include/lld/Common/Driver.h +++ lld/trunk/include/lld/Common/Driver.h @@ -0,0 +1,38 @@ +//===- lld/Common/Driver.h - Linker Driver Emulator -----------------------===// +// +// The LLVM Linker +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLD_COMMON_DRIVER_H +#define LLD_COMMON_DRIVER_H + +#include "llvm/ADT/ArrayRef.h" +#include "llvm/Support/raw_ostream.h" + +namespace lld { +namespace coff { +bool link(llvm::ArrayRef Args, + llvm::raw_ostream &Diag = llvm::errs()); +} + +namespace mingw { +bool link(llvm::ArrayRef Args, + llvm::raw_ostream &Diag = llvm::errs()); +} + +namespace elf { +bool link(llvm::ArrayRef Args, bool CanExitEarly, + llvm::raw_ostream &Diag = llvm::errs()); +} + +namespace mach_o { +bool link(llvm::ArrayRef Args, + llvm::raw_ostream &Diag = llvm::errs()); +} +} + +#endif Index: lld/trunk/include/lld/Common/LLVM.h =================================================================== --- lld/trunk/include/lld/Common/LLVM.h +++ lld/trunk/include/lld/Common/LLVM.h @@ -0,0 +1,83 @@ +//===--- LLVM.h - Import various common LLVM datatypes ----------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file forward declares and imports various common LLVM datatypes that +// lld wants to use unqualified. +// +//===----------------------------------------------------------------------===// + +#ifndef LLD_COMMON_LLVM_H +#define LLD_COMMON_LLVM_H + +// This should be the only #include, force #includes of all the others on +// clients. +#include "llvm/ADT/Hashing.h" +#include "llvm/Support/Casting.h" +#include + +namespace llvm { + // ADT's. + class Error; + class StringRef; + class Twine; + class MemoryBuffer; + class MemoryBufferRef; + template class ArrayRef; + template class SmallString; + template class SmallVector; + template class SmallVectorImpl; + + template + struct SaveAndRestore; + + template + class ErrorOr; + + template + class Expected; + + class raw_ostream; + // TODO: DenseMap, ... +} + +namespace lld { + // Casting operators. + using llvm::isa; + using llvm::cast; + using llvm::dyn_cast; + using llvm::dyn_cast_or_null; + using llvm::cast_or_null; + + // ADT's. + using llvm::Error; + using llvm::StringRef; + using llvm::Twine; + using llvm::MemoryBuffer; + using llvm::MemoryBufferRef; + using llvm::ArrayRef; + using llvm::SmallString; + using llvm::SmallVector; + using llvm::SmallVectorImpl; + using llvm::SaveAndRestore; + using llvm::ErrorOr; + using llvm::Expected; + + using llvm::raw_ostream; +} // end namespace lld. + +namespace std { +template <> struct hash { +public: + size_t operator()(const llvm::StringRef &s) const { + return llvm::hash_value(s); + } +}; +} + +#endif Index: lld/trunk/include/lld/Common/Reproduce.h =================================================================== --- lld/trunk/include/lld/Common/Reproduce.h +++ lld/trunk/include/lld/Common/Reproduce.h @@ -0,0 +1,39 @@ +//===- Reproduce.h - Utilities for creating reproducers ---------*- C++ -*-===// +// +// The LLVM Linker +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLD_COMMON_REPRODUCE_H +#define LLD_COMMON_REPRODUCE_H + +#include "lld/Common/LLVM.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/Support/Error.h" + +namespace llvm { +namespace opt { class Arg; } +} + +namespace lld { + +// Makes a given pathname an absolute path first, and then remove +// beginning /. For example, "../foo.o" is converted to "home/john/foo.o", +// assuming that the current directory is "/home/john/bar". +std::string relativeToRoot(StringRef Path); + +// Quote a given string if it contains a space character. +std::string quote(StringRef S); + +// Rewrite the given path if a file exists with that pathname, otherwise +// returns the original path. +std::string rewritePath(StringRef S); + +// Returns the string form of the given argument. +std::string toString(llvm::opt::Arg *Arg); +} + +#endif Index: lld/trunk/include/lld/Common/TargetOptionsCommandFlags.h =================================================================== --- lld/trunk/include/lld/Common/TargetOptionsCommandFlags.h +++ lld/trunk/include/lld/Common/TargetOptionsCommandFlags.h @@ -0,0 +1,21 @@ +//===-- TargetOptionsCommandFlags.h ----------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// Helper to create TargetOptions from command line flags. +// +//===----------------------------------------------------------------------===// + +#include "llvm/ADT/Optional.h" +#include "llvm/Support/CodeGen.h" +#include "llvm/Target/TargetOptions.h" + +namespace lld { +llvm::TargetOptions InitTargetOptionsFromCodeGenFlags(); +llvm::Optional GetCodeModelFromCMModel(); +} Index: lld/trunk/include/lld/Common/Version.h =================================================================== --- lld/trunk/include/lld/Common/Version.h +++ lld/trunk/include/lld/Common/Version.h @@ -0,0 +1,25 @@ +//===- lld/Common/Version.h - LLD Version Number ----------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// Defines a version-related utility function. +// +//===----------------------------------------------------------------------===// + +#ifndef LLD_VERSION_H +#define LLD_VERSION_H + +#include "lld/Common/Version.inc" +#include "llvm/ADT/StringRef.h" + +namespace lld { +/// \brief Retrieves a string representing the complete lld version. +std::string getLLDVersion(); +} + +#endif // LLD_VERSION_H Index: lld/trunk/include/lld/Common/Version.inc.in =================================================================== --- lld/trunk/include/lld/Common/Version.inc.in +++ lld/trunk/include/lld/Common/Version.inc.in @@ -0,0 +1,6 @@ +#define LLD_VERSION @LLD_VERSION@ +#define LLD_VERSION_STRING "@LLD_VERSION@" +#define LLD_VERSION_MAJOR @LLD_VERSION_MAJOR@ +#define LLD_VERSION_MINOR @LLD_VERSION_MINOR@ +#define LLD_REVISION_STRING "@LLD_REVISION@" +#define LLD_REPOSITORY_STRING "@LLD_REPOSITORY@" Index: lld/trunk/include/lld/Config/Version.h =================================================================== --- lld/trunk/include/lld/Config/Version.h +++ lld/trunk/include/lld/Config/Version.h @@ -1,25 +0,0 @@ -//===- lld/Config/Version.h - LLD Version Number ----------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// Defines a version-related utility function. -// -//===----------------------------------------------------------------------===// - -#ifndef LLD_VERSION_H -#define LLD_VERSION_H - -#include "lld/Config/Version.inc" -#include "llvm/ADT/StringRef.h" - -namespace lld { -/// \brief Retrieves a string representing the complete lld version. -std::string getLLDVersion(); -} - -#endif // LLD_VERSION_H Index: lld/trunk/include/lld/Config/Version.inc.in =================================================================== --- lld/trunk/include/lld/Config/Version.inc.in +++ lld/trunk/include/lld/Config/Version.inc.in @@ -1,6 +0,0 @@ -#define LLD_VERSION @LLD_VERSION@ -#define LLD_VERSION_STRING "@LLD_VERSION@" -#define LLD_VERSION_MAJOR @LLD_VERSION_MAJOR@ -#define LLD_VERSION_MINOR @LLD_VERSION_MINOR@ -#define LLD_REVISION_STRING "@LLD_REVISION@" -#define LLD_REPOSITORY_STRING "@LLD_REPOSITORY@" Index: lld/trunk/include/lld/Core/Atom.h =================================================================== --- lld/trunk/include/lld/Core/Atom.h +++ lld/trunk/include/lld/Core/Atom.h @@ -10,7 +10,7 @@ #ifndef LLD_CORE_ATOM_H #define LLD_CORE_ATOM_H -#include "lld/Core/LLVM.h" +#include "lld/Common/LLVM.h" #include "llvm/ADT/StringRef.h" namespace lld { Index: lld/trunk/include/lld/Core/DefinedAtom.h =================================================================== --- lld/trunk/include/lld/Core/DefinedAtom.h +++ lld/trunk/include/lld/Core/DefinedAtom.h @@ -10,9 +10,9 @@ #ifndef LLD_CORE_DEFINED_ATOM_H #define LLD_CORE_DEFINED_ATOM_H +#include "lld/Common/LLVM.h" #include "lld/Core/Atom.h" #include "lld/Core/Reference.h" -#include "lld/Core/LLVM.h" #include "llvm/Support/ErrorHandling.h" namespace lld { Index: lld/trunk/include/lld/Core/Error.h =================================================================== --- lld/trunk/include/lld/Core/Error.h +++ lld/trunk/include/lld/Core/Error.h @@ -14,7 +14,7 @@ #ifndef LLD_CORE_ERROR_H #define LLD_CORE_ERROR_H -#include "lld/Core/LLVM.h" +#include "lld/Common/LLVM.h" #include "llvm/ADT/Twine.h" #include "llvm/Support/Error.h" #include Index: lld/trunk/include/lld/Core/LLVM.h =================================================================== --- lld/trunk/include/lld/Core/LLVM.h +++ lld/trunk/include/lld/Core/LLVM.h @@ -1,83 +0,0 @@ -//===--- LLVM.h - Import various common LLVM datatypes ----------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file forward declares and imports various common LLVM datatypes that -// lld wants to use unqualified. -// -//===----------------------------------------------------------------------===// - -#ifndef LLD_CORE_LLVM_H -#define LLD_CORE_LLVM_H - -// This should be the only #include, force #includes of all the others on -// clients. -#include "llvm/ADT/Hashing.h" -#include "llvm/Support/Casting.h" -#include - -namespace llvm { - // ADT's. - class Error; - class StringRef; - class Twine; - class MemoryBuffer; - class MemoryBufferRef; - template class ArrayRef; - template class SmallString; - template class SmallVector; - template class SmallVectorImpl; - - template - struct SaveAndRestore; - - template - class ErrorOr; - - template - class Expected; - - class raw_ostream; - // TODO: DenseMap, ... -} - -namespace lld { - // Casting operators. - using llvm::isa; - using llvm::cast; - using llvm::dyn_cast; - using llvm::dyn_cast_or_null; - using llvm::cast_or_null; - - // ADT's. - using llvm::Error; - using llvm::StringRef; - using llvm::Twine; - using llvm::MemoryBuffer; - using llvm::MemoryBufferRef; - using llvm::ArrayRef; - using llvm::SmallString; - using llvm::SmallVector; - using llvm::SmallVectorImpl; - using llvm::SaveAndRestore; - using llvm::ErrorOr; - using llvm::Expected; - - using llvm::raw_ostream; -} // end namespace lld. - -namespace std { -template <> struct hash { -public: - size_t operator()(const llvm::StringRef &s) const { - return llvm::hash_value(s); - } -}; -} - -#endif Index: lld/trunk/include/lld/Core/PassManager.h =================================================================== --- lld/trunk/include/lld/Core/PassManager.h +++ lld/trunk/include/lld/Core/PassManager.h @@ -10,7 +10,7 @@ #ifndef LLD_CORE_PASS_MANAGER_H #define LLD_CORE_PASS_MANAGER_H -#include "lld/Core/LLVM.h" +#include "lld/Common/LLVM.h" #include "lld/Core/Pass.h" #include "llvm/Support/Error.h" #include Index: lld/trunk/include/lld/Core/Reader.h =================================================================== --- lld/trunk/include/lld/Core/Reader.h +++ lld/trunk/include/lld/Core/Reader.h @@ -10,7 +10,7 @@ #ifndef LLD_CORE_READER_H #define LLD_CORE_READER_H -#include "lld/Core/LLVM.h" +#include "lld/Common/LLVM.h" #include "lld/Core/Reference.h" #include "llvm/ADT/StringRef.h" #include "llvm/BinaryFormat/Magic.h" Index: lld/trunk/include/lld/Core/Reproduce.h =================================================================== --- lld/trunk/include/lld/Core/Reproduce.h +++ lld/trunk/include/lld/Core/Reproduce.h @@ -1,39 +0,0 @@ -//===- Reproduce.h - Utilities for creating reproducers ---------*- C++ -*-===// -// -// The LLVM Linker -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef LLD_CORE_REPRODUCE_H -#define LLD_CORE_REPRODUCE_H - -#include "lld/Core/LLVM.h" -#include "llvm/ADT/StringRef.h" -#include "llvm/Support/Error.h" - -namespace llvm { -namespace opt { class Arg; } -} - -namespace lld { - -// Makes a given pathname an absolute path first, and then remove -// beginning /. For example, "../foo.o" is converted to "home/john/foo.o", -// assuming that the current directory is "/home/john/bar". -std::string relativeToRoot(StringRef Path); - -// Quote a given string if it contains a space character. -std::string quote(StringRef S); - -// Rewrite the given path if a file exists with that pathname, otherwise -// returns the original path. -std::string rewritePath(StringRef S); - -// Returns the string form of the given argument. -std::string toString(llvm::opt::Arg *Arg); -} - -#endif Index: lld/trunk/include/lld/Core/SymbolTable.h =================================================================== --- lld/trunk/include/lld/Core/SymbolTable.h +++ lld/trunk/include/lld/Core/SymbolTable.h @@ -10,7 +10,7 @@ #ifndef LLD_CORE_SYMBOL_TABLE_H #define LLD_CORE_SYMBOL_TABLE_H -#include "lld/Core/LLVM.h" +#include "lld/Common/LLVM.h" #include "llvm/ADT/DenseSet.h" #include "llvm/ADT/StringExtras.h" #include Index: lld/trunk/include/lld/Core/TargetOptionsCommandFlags.h =================================================================== --- lld/trunk/include/lld/Core/TargetOptionsCommandFlags.h +++ lld/trunk/include/lld/Core/TargetOptionsCommandFlags.h @@ -1,21 +0,0 @@ -//===-- TargetOptionsCommandFlags.h ----------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// Helper to create TargetOptions from command line flags. -// -//===----------------------------------------------------------------------===// - -#include "llvm/ADT/Optional.h" -#include "llvm/Support/CodeGen.h" -#include "llvm/Target/TargetOptions.h" - -namespace lld { -llvm::TargetOptions InitTargetOptionsFromCodeGenFlags(); -llvm::Optional GetCodeModelFromCMModel(); -} Index: lld/trunk/include/lld/Core/Writer.h =================================================================== --- lld/trunk/include/lld/Core/Writer.h +++ lld/trunk/include/lld/Core/Writer.h @@ -10,7 +10,7 @@ #ifndef LLD_CORE_WRITER_H #define LLD_CORE_WRITER_H -#include "lld/Core/LLVM.h" +#include "lld/Common/LLVM.h" #include "llvm/Support/Error.h" #include #include Index: lld/trunk/include/lld/Driver/Driver.h =================================================================== --- lld/trunk/include/lld/Driver/Driver.h +++ lld/trunk/include/lld/Driver/Driver.h @@ -1,38 +0,0 @@ -//===- lld/Driver/Driver.h - Linker Driver Emulator -----------------------===// -// -// The LLVM Linker -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef LLD_DRIVER_DRIVER_H -#define LLD_DRIVER_DRIVER_H - -#include "llvm/ADT/ArrayRef.h" -#include "llvm/Support/raw_ostream.h" - -namespace lld { -namespace coff { -bool link(llvm::ArrayRef Args, - llvm::raw_ostream &Diag = llvm::errs()); -} - -namespace mingw { -bool link(llvm::ArrayRef Args, - llvm::raw_ostream &Diag = llvm::errs()); -} - -namespace elf { -bool link(llvm::ArrayRef Args, bool CanExitEarly, - llvm::raw_ostream &Diag = llvm::errs()); -} - -namespace mach_o { -bool link(llvm::ArrayRef Args, - llvm::raw_ostream &Diag = llvm::errs()); -} -} - -#endif Index: lld/trunk/include/lld/ReaderWriter/YamlContext.h =================================================================== --- lld/trunk/include/lld/ReaderWriter/YamlContext.h +++ lld/trunk/include/lld/ReaderWriter/YamlContext.h @@ -10,7 +10,7 @@ #ifndef LLD_READER_WRITER_YAML_CONTEXT_H #define LLD_READER_WRITER_YAML_CONTEXT_H -#include "lld/Core/LLVM.h" +#include "lld/Common/LLVM.h" #include #include #include Index: lld/trunk/lib/CMakeLists.txt =================================================================== --- lld/trunk/lib/CMakeLists.txt +++ lld/trunk/lib/CMakeLists.txt @@ -1,4 +1,3 @@ -add_subdirectory(Config) add_subdirectory(Core) add_subdirectory(Driver) add_subdirectory(ReaderWriter) Index: lld/trunk/lib/Config/CMakeLists.txt =================================================================== --- lld/trunk/lib/Config/CMakeLists.txt +++ lld/trunk/lib/Config/CMakeLists.txt @@ -1,9 +0,0 @@ -add_lld_library(lldConfig - Version.cpp - - ADDITIONAL_HEADER_DIRS - ${LLD_INCLUDE_DIR}/lld/Config - - LINK_COMPONENTS - Support - ) Index: lld/trunk/lib/Config/Version.cpp =================================================================== --- lld/trunk/lib/Config/Version.cpp +++ lld/trunk/lib/Config/Version.cpp @@ -1,43 +0,0 @@ -//===- lib/Config/Version.cpp - LLD Version Number ---------------*- C++-=====// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file defines several version-related utility functions for LLD. -// -//===----------------------------------------------------------------------===// - -#include "lld/Config/Version.h" - -using namespace llvm; - -// Returns an SVN repository path, which is usually "trunk". -static std::string getRepositoryPath() { - StringRef S = LLD_REPOSITORY_STRING; - size_t Pos = S.find("lld/"); - if (Pos != StringRef::npos) - return S.substr(Pos + 4); - return S; -} - -// Returns an SVN repository name, e.g., " (trunk 284614)" -// or an empty string if no repository info is available. -static std::string getRepository() { - std::string Repo = getRepositoryPath(); - std::string Rev = LLD_REVISION_STRING; - - if (Repo.empty() && Rev.empty()) - return ""; - if (!Repo.empty() && !Rev.empty()) - return " (" + Repo + " " + Rev + ")"; - return " (" + Repo + Rev + ")"; -} - -// Returns a version string, e.g., "LLD 4.0 (lld/trunk 284614)". -std::string lld::getLLDVersion() { - return "LLD " + std::string(LLD_VERSION_STRING) + getRepository(); -} Index: lld/trunk/lib/Core/CMakeLists.txt =================================================================== --- lld/trunk/lib/Core/CMakeLists.txt +++ lld/trunk/lib/Core/CMakeLists.txt @@ -8,10 +8,8 @@ File.cpp LinkingContext.cpp Reader.cpp - Reproduce.cpp Resolver.cpp SymbolTable.cpp - TargetOptionsCommandFlags.cpp Writer.cpp ADDITIONAL_HEADER_DIRS Index: lld/trunk/lib/Core/Reproduce.cpp =================================================================== --- lld/trunk/lib/Core/Reproduce.cpp +++ lld/trunk/lib/Core/Reproduce.cpp @@ -1,66 +0,0 @@ -//===- Reproduce.cpp - Utilities for creating reproducers -----------------===// -// -// The LLVM Linker -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include "lld/Core/Reproduce.h" -#include "llvm/Option/Arg.h" -#include "llvm/Support/Error.h" -#include "llvm/Support/FileSystem.h" -#include "llvm/Support/Path.h" - -using namespace lld; -using namespace llvm; -using namespace llvm::sys; - -// Makes a given pathname an absolute path first, and then remove -// beginning /. For example, "../foo.o" is converted to "home/john/foo.o", -// assuming that the current directory is "/home/john/bar". -// Returned string is a forward slash separated path even on Windows to avoid -// a mess with backslash-as-escape and backslash-as-path-separator. -std::string lld::relativeToRoot(StringRef Path) { - SmallString<128> Abs = Path; - if (fs::make_absolute(Abs)) - return Path; - path::remove_dots(Abs, /*remove_dot_dot=*/true); - - // This is Windows specific. root_name() returns a drive letter - // (e.g. "c:") or a UNC name (//net). We want to keep it as part - // of the result. - SmallString<128> Res; - StringRef Root = path::root_name(Abs); - if (Root.endswith(":")) - Res = Root.drop_back(); - else if (Root.startswith("//")) - Res = Root.substr(2); - - path::append(Res, path::relative_path(Abs)); - return path::convert_to_slash(Res); -} - -// Quote a given string if it contains a space character. -std::string lld::quote(StringRef S) { - if (S.contains(' ')) - return ("\"" + S + "\"").str(); - return S; -} - -std::string lld::rewritePath(StringRef S) { - if (fs::exists(S)) - return relativeToRoot(S); - return S; -} - -std::string lld::toString(opt::Arg *Arg) { - std::string K = Arg->getSpelling(); - if (Arg->getNumValues() == 0) - return K; - std::string V = quote(Arg->getValue()); - if (Arg->getOption().getRenderStyle() == opt::Option::RenderJoinedStyle) - return K + V; - return K + " " + V; -} Index: lld/trunk/lib/Core/Resolver.cpp =================================================================== --- lld/trunk/lib/Core/Resolver.cpp +++ lld/trunk/lib/Core/Resolver.cpp @@ -7,13 +7,13 @@ // //===----------------------------------------------------------------------===// -#include "lld/Core/Atom.h" +#include "lld/Core/Resolver.h" +#include "lld/Common/LLVM.h" #include "lld/Core/ArchiveLibraryFile.h" +#include "lld/Core/Atom.h" #include "lld/Core/File.h" #include "lld/Core/Instrumentation.h" -#include "lld/Core/LLVM.h" #include "lld/Core/LinkingContext.h" -#include "lld/Core/Resolver.h" #include "lld/Core/SharedLibraryFile.h" #include "lld/Core/SymbolTable.h" #include "lld/Core/UndefinedAtom.h" Index: lld/trunk/lib/Core/SymbolTable.cpp =================================================================== --- lld/trunk/lib/Core/SymbolTable.cpp +++ lld/trunk/lib/Core/SymbolTable.cpp @@ -8,11 +8,11 @@ //===----------------------------------------------------------------------===// #include "lld/Core/SymbolTable.h" +#include "lld/Common/LLVM.h" #include "lld/Core/AbsoluteAtom.h" #include "lld/Core/Atom.h" #include "lld/Core/DefinedAtom.h" #include "lld/Core/File.h" -#include "lld/Core/LLVM.h" #include "lld/Core/LinkingContext.h" #include "lld/Core/Resolver.h" #include "lld/Core/SharedLibraryAtom.h" Index: lld/trunk/lib/Core/TargetOptionsCommandFlags.cpp =================================================================== --- lld/trunk/lib/Core/TargetOptionsCommandFlags.cpp +++ lld/trunk/lib/Core/TargetOptionsCommandFlags.cpp @@ -1,32 +0,0 @@ -//===-- TargetOptionsCommandFlags.cpp ---------------------------*- C++ -*-===// -// -// The LLVM Linker -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file exists as a place for global variables defined in LLVM's -// CodeGen/CommandFlags.h. By putting the resulting object file in -// an archive and linking with it, the definitions will automatically be -// included when needed and skipped when already present. -// -//===----------------------------------------------------------------------===// - -#include "lld/Core/TargetOptionsCommandFlags.h" - -#include "llvm/CodeGen/CommandFlags.h" -#include "llvm/Target/TargetOptions.h" - -// Define an externally visible version of -// InitTargetOptionsFromCodeGenFlags, so that its functionality can be -// used without having to include llvm/CodeGen/CommandFlags.h, which -// would lead to multiple definitions of the command line flags. -llvm::TargetOptions lld::InitTargetOptionsFromCodeGenFlags() { - return ::InitTargetOptionsFromCodeGenFlags(); -} - -llvm::Optional lld::GetCodeModelFromCMModel() { - return getCodeModel(); -} Index: lld/trunk/lib/Driver/DarwinLdDriver.cpp =================================================================== --- lld/trunk/lib/Driver/DarwinLdDriver.cpp +++ lld/trunk/lib/Driver/DarwinLdDriver.cpp @@ -13,11 +13,11 @@ /// //===----------------------------------------------------------------------===// +#include "lld/Common/LLVM.h" #include "lld/Core/ArchiveLibraryFile.h" #include "lld/Core/Error.h" #include "lld/Core/File.h" #include "lld/Core/Instrumentation.h" -#include "lld/Core/LLVM.h" #include "lld/Core/LinkingContext.h" #include "lld/Core/Node.h" #include "lld/Core/PassManager.h" Index: lld/trunk/lib/ReaderWriter/FileArchive.cpp =================================================================== --- lld/trunk/lib/ReaderWriter/FileArchive.cpp +++ lld/trunk/lib/ReaderWriter/FileArchive.cpp @@ -7,9 +7,9 @@ // //===----------------------------------------------------------------------===// +#include "lld/Common/LLVM.h" #include "lld/Core/ArchiveLibraryFile.h" #include "lld/Core/File.h" -#include "lld/Core/LLVM.h" #include "lld/Core/Reader.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringRef.h" Index: lld/trunk/lib/ReaderWriter/MachO/ArchHandler.h =================================================================== --- lld/trunk/lib/ReaderWriter/MachO/ArchHandler.h +++ lld/trunk/lib/ReaderWriter/MachO/ArchHandler.h @@ -13,7 +13,7 @@ #include "Atoms.h" #include "File.h" #include "MachONormalizedFile.h" -#include "lld/Core/LLVM.h" +#include "lld/Common/LLVM.h" #include "lld/Core/Error.h" #include "lld/Core/Reference.h" #include "lld/Core/Simple.h" Index: lld/trunk/lib/ReaderWriter/MachO/CompactUnwindPass.cpp =================================================================== --- lld/trunk/lib/ReaderWriter/MachO/CompactUnwindPass.cpp +++ lld/trunk/lib/ReaderWriter/MachO/CompactUnwindPass.cpp @@ -17,9 +17,9 @@ #include "File.h" #include "MachONormalizedFileBinaryUtils.h" #include "MachOPasses.h" +#include "lld/Common/LLVM.h" #include "lld/Core/DefinedAtom.h" #include "lld/Core/File.h" -#include "lld/Core/LLVM.h" #include "lld/Core/Reference.h" #include "lld/Core/Simple.h" #include "llvm/ADT/DenseMap.h" Index: lld/trunk/lib/ReaderWriter/MachO/GOTPass.cpp =================================================================== --- lld/trunk/lib/ReaderWriter/MachO/GOTPass.cpp +++ lld/trunk/lib/ReaderWriter/MachO/GOTPass.cpp @@ -35,9 +35,9 @@ #include "ArchHandler.h" #include "File.h" #include "MachOPasses.h" +#include "lld/Common/LLVM.h" #include "lld/Core/DefinedAtom.h" #include "lld/Core/File.h" -#include "lld/Core/LLVM.h" #include "lld/Core/Reference.h" #include "lld/Core/Simple.h" #include "llvm/ADT/DenseMap.h" Index: lld/trunk/lib/ReaderWriter/MachO/MachOLinkingContext.cpp =================================================================== --- lld/trunk/lib/ReaderWriter/MachO/MachOLinkingContext.cpp +++ lld/trunk/lib/ReaderWriter/MachO/MachOLinkingContext.cpp @@ -14,11 +14,11 @@ #include "MachONormalizedFile.h" #include "MachOPasses.h" #include "SectCreateFile.h" +#include "lld/Common/Driver.h" #include "lld/Core/ArchiveLibraryFile.h" #include "lld/Core/PassManager.h" #include "lld/Core/Reader.h" #include "lld/Core/Writer.h" -#include "lld/Driver/Driver.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/Triple.h" Index: lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFile.h =================================================================== --- lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFile.h +++ lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFile.h @@ -43,8 +43,8 @@ #define LLD_READER_WRITER_MACHO_NORMALIZE_FILE_H #include "DebugInfo.h" +#include "lld/Common/LLVM.h" #include "lld/Core/Error.h" -#include "lld/Core/LLVM.h" #include "lld/ReaderWriter/MachOLinkingContext.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/StringRef.h" Index: lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp =================================================================== --- lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp +++ lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp @@ -24,8 +24,8 @@ #include "ArchHandler.h" #include "MachONormalizedFile.h" #include "MachONormalizedFileBinaryUtils.h" +#include "lld/Common/LLVM.h" #include "lld/Core/Error.h" -#include "lld/Core/LLVM.h" #include "lld/Core/SharedLibraryFile.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallString.h" Index: lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryUtils.h =================================================================== --- lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryUtils.h +++ lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryUtils.h @@ -11,8 +11,8 @@ #define LLD_READER_WRITER_MACHO_NORMALIZED_FILE_BINARY_UTILS_H #include "MachONormalizedFile.h" +#include "lld/Common/LLVM.h" #include "lld/Core/Error.h" -#include "lld/Core/LLVM.h" #include "llvm/ADT/StringRef.h" #include "llvm/BinaryFormat/MachO.h" #include "llvm/Support/Casting.h" Index: lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp =================================================================== --- lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp +++ lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp @@ -23,8 +23,8 @@ #include "MachONormalizedFile.h" #include "MachONormalizedFileBinaryUtils.h" +#include "lld/Common/LLVM.h" #include "lld/Core/Error.h" -#include "lld/Core/LLVM.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" Index: lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp =================================================================== --- lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp +++ lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp @@ -24,8 +24,8 @@ #include "DebugInfo.h" #include "MachONormalizedFile.h" #include "MachONormalizedFileBinaryUtils.h" +#include "lld/Common/LLVM.h" #include "lld/Core/Error.h" -#include "lld/Core/LLVM.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/StringSwitch.h" #include "llvm/BinaryFormat/MachO.h" Index: lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp =================================================================== --- lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp +++ lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp @@ -25,8 +25,8 @@ #include "File.h" #include "MachONormalizedFile.h" #include "MachONormalizedFileBinaryUtils.h" +#include "lld/Common/LLVM.h" #include "lld/Core/Error.h" -#include "lld/Core/LLVM.h" #include "llvm/BinaryFormat/Dwarf.h" #include "llvm/BinaryFormat/MachO.h" #include "llvm/DebugInfo/DWARF/DWARFFormValue.h" Index: lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp =================================================================== --- lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp +++ lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp @@ -16,8 +16,8 @@ /// +------------+ +------+ #include "MachONormalizedFile.h" +#include "lld/Common/LLVM.h" #include "lld/Core/Error.h" -#include "lld/Core/LLVM.h" #include "lld/ReaderWriter/YamlContext.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/StringRef.h" Index: lld/trunk/lib/ReaderWriter/MachO/ObjCPass.cpp =================================================================== --- lld/trunk/lib/ReaderWriter/MachO/ObjCPass.cpp +++ lld/trunk/lib/ReaderWriter/MachO/ObjCPass.cpp @@ -13,9 +13,9 @@ #include "File.h" #include "MachONormalizedFileBinaryUtils.h" #include "MachOPasses.h" +#include "lld/Common/LLVM.h" #include "lld/Core/DefinedAtom.h" #include "lld/Core/File.h" -#include "lld/Core/LLVM.h" #include "lld/Core/Reference.h" #include "lld/Core/Simple.h" #include "lld/ReaderWriter/MachOLinkingContext.h" Index: lld/trunk/lib/ReaderWriter/MachO/ShimPass.cpp =================================================================== --- lld/trunk/lib/ReaderWriter/MachO/ShimPass.cpp +++ lld/trunk/lib/ReaderWriter/MachO/ShimPass.cpp @@ -26,9 +26,9 @@ #include "ArchHandler.h" #include "File.h" #include "MachOPasses.h" +#include "lld/Common/LLVM.h" #include "lld/Core/DefinedAtom.h" #include "lld/Core/File.h" -#include "lld/Core/LLVM.h" #include "lld/Core/Reference.h" #include "lld/Core/Simple.h" #include "lld/ReaderWriter/MachOLinkingContext.h" Index: lld/trunk/lib/ReaderWriter/MachO/StubsPass.cpp =================================================================== --- lld/trunk/lib/ReaderWriter/MachO/StubsPass.cpp +++ lld/trunk/lib/ReaderWriter/MachO/StubsPass.cpp @@ -17,9 +17,9 @@ #include "ArchHandler.h" #include "File.h" #include "MachOPasses.h" +#include "lld/Common/LLVM.h" #include "lld/Core/DefinedAtom.h" #include "lld/Core/File.h" -#include "lld/Core/LLVM.h" #include "lld/Core/Reference.h" #include "lld/Core/Simple.h" #include "lld/ReaderWriter/MachOLinkingContext.h" Index: lld/trunk/tools/lld/lld.cpp =================================================================== --- lld/trunk/tools/lld/lld.cpp +++ lld/trunk/tools/lld/lld.cpp @@ -16,7 +16,7 @@ // //===----------------------------------------------------------------------===// -#include "lld/Driver/Driver.h" +#include "lld/Common/Driver.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringSwitch.h" #include "llvm/ADT/Twine.h" Index: lld/trunk/unittests/DriverTests/DarwinLdDriverTest.cpp =================================================================== --- lld/trunk/unittests/DriverTests/DarwinLdDriverTest.cpp +++ lld/trunk/unittests/DriverTests/DarwinLdDriverTest.cpp @@ -12,7 +12,7 @@ /// //===----------------------------------------------------------------------===// -#include "lld/Driver/Driver.h" +#include "lld/Common/Driver.h" #include "lld/ReaderWriter/MachOLinkingContext.h" #include "llvm/BinaryFormat/MachO.h" #include "llvm/Support/raw_ostream.h"