Fix five of the shared library build targets

Before this patch there was a cyclic dependency between lldCore and
lldReaderWriter.  Only lldConfig could be built as a shared library.

* Moved Reader and Writer base classes into lldCore.
* The following shared libraries can now be built:
     lldCore
     lldYAML
     lldNative
     lldPasses
     lldReaderWriter

Differential Revision: http://reviews.llvm.org/D7105

From: Greg Fitzgerald <garious@gmail.com>
llvm-svn: 226732
This commit is contained in:
Greg Fitzgerald 2015-01-21 22:54:56 +00:00
parent e24b8a03b9
commit 4b6a7e355b
36 changed files with 55 additions and 52 deletions

View File

@ -10,8 +10,8 @@ The purpose of a "Reader" is to take an object file in a particular format
and create an `lld::File`:cpp:class: (which is a graph of Atoms)
representing the object file. A Reader inherits from
`lld::Reader`:cpp:class: which lives in
:file:`include/lld/ReaderWriter/Reader.h` and
:file:`lib/ReaderWriter/Reader.cpp`.
:file:`include/lld/Core/Reader.h` and
:file:`lib/Core/Reader.cpp`.
The Reader infrastructure for an object format ``Foo`` requires the
following pieces in order to fit into lld:

View File

@ -16,7 +16,7 @@
#include "lld/Core/Parallel.h"
#include "lld/Core/Reference.h"
#include "lld/Core/range.h"
#include "lld/ReaderWriter/Reader.h"
#include "lld/Core/Reader.h"
#include "llvm/Support/ErrorOr.h"
#include "llvm/Support/raw_ostream.h"
#include <string>

View File

@ -1,4 +1,4 @@
//===- lld/ReaderWriter/Reader.h - Abstract File Format Reading Interface -===//
//===- lld/Core/Reader.h - Abstract File Format Reading Interface ---------===//
//
// The LLVM Linker
//
@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
#ifndef LLD_READER_WRITER_READER_H
#define LLD_READER_WRITER_READER_H
#ifndef LLD_CORE_READER_H
#define LLD_CORE_READER_H
#include "lld/Core/LLVM.h"
#include "lld/Core/Reference.h"

View File

@ -1,4 +1,4 @@
//===- lld/ReaderWriter/Writer.h - Abstract File Format Interface ---------===//
//===- lld/Core/Writer.h - Abstract File Format Interface -----------------===//
//
// The LLVM Linker
//
@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
#ifndef LLD_READER_WRITER_WRITER_H
#define LLD_READER_WRITER_WRITER_H
#ifndef LLD_CORE_WRITER_H
#define LLD_CORE_WRITER_H
#include "lld/Core/LLVM.h"
#include <memory>

View File

@ -12,7 +12,7 @@
#include "lld/Core/File.h"
#include "lld/Core/Pass.h"
#include "lld/ReaderWriter/Reader.h"
#include "lld/Core/Reader.h"
#include "llvm/ADT/DenseMap.h"
#include <map>
#include <string>

View File

@ -11,8 +11,8 @@
#define LLD_READER_WRITER_CORE_LINKER_CONTEXT_H
#include "lld/Core/LinkingContext.h"
#include "lld/ReaderWriter/Reader.h"
#include "lld/ReaderWriter/Writer.h"
#include "lld/Core/Reader.h"
#include "lld/Core/Writer.h"
#include "llvm/Support/ErrorHandling.h"
namespace lld {

View File

@ -15,8 +15,8 @@
#include "lld/Core/PassManager.h"
#include "lld/Core/STDExtras.h"
#include "lld/Core/range.h"
#include "lld/ReaderWriter/Reader.h"
#include "lld/ReaderWriter/Writer.h"
#include "lld/Core/Reader.h"
#include "lld/Core/Writer.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/ADT/Triple.h"
#include "llvm/Object/ELF.h"

View File

@ -11,8 +11,8 @@
#define LLD_READER_WRITER_MACHO_LINKING_CONTEXT_H
#include "lld/Core/LinkingContext.h"
#include "lld/ReaderWriter/Reader.h"
#include "lld/ReaderWriter/Writer.h"
#include "lld/Core/Reader.h"
#include "lld/Core/Writer.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/Support/ErrorHandling.h"

View File

@ -11,8 +11,8 @@
#define LLD_READER_WRITER_PECOFF_LINKING_CONTEXT_H
#include "lld/Core/LinkingContext.h"
#include "lld/ReaderWriter/Reader.h"
#include "lld/ReaderWriter/Writer.h"
#include "lld/Core/Reader.h"
#include "lld/Core/Writer.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/COFF.h"

View File

@ -3,8 +3,10 @@ add_llvm_library(lldCore
Error.cpp
File.cpp
LinkingContext.cpp
Reader.cpp
Resolver.cpp
SymbolTable.cpp
Writer.cpp
LINK_LIBS
LLVMSupport
)

View File

@ -11,7 +11,7 @@
#include "lld/Core/LinkingContext.h"
#include "lld/Core/Resolver.h"
#include "lld/Core/Simple.h"
#include "lld/ReaderWriter/Writer.h"
#include "lld/Core/Writer.h"
#include "llvm/ADT/Triple.h"
#include "llvm/Support/Process.h"

View File

@ -1,4 +1,4 @@
//===- lib/ReaderWriter/Reader.cpp ----------------------------------------===//
//===- lib/Core/Reader.cpp ------------------------------------------------===//
//
// The LLVM Linker
//
@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
#include "lld/Core/File.h"
#include "lld/ReaderWriter/Reader.h"
#include "lld/Core/Reader.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/FileUtilities.h"

View File

@ -1,4 +1,4 @@
//===- lib/ReaderWriter/Writer.cpp ----------------------------------------===//
//===- lib/Core/Writer.cpp ------------------------------------------------===//
//
// The LLVM Linker
//
@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
#include "lld/Core/File.h"
#include "lld/ReaderWriter/Writer.h"
#include "lld/Core/Writer.h"
namespace lld {
Writer::Writer() {

View File

@ -7,9 +7,9 @@
//
//===----------------------------------------------------------------------===//
#include "lld/Core/Reader.h"
#include "lld/Driver/Driver.h"
#include "lld/ReaderWriter/CoreLinkingContext.h"
#include "lld/ReaderWriter/Reader.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/Triple.h"

View File

@ -13,12 +13,12 @@
#include "lld/Core/LLVM.h"
#include "lld/Core/Parallel.h"
#include "lld/Core/PassManager.h"
#include "lld/Core/Reader.h"
#include "lld/Core/Resolver.h"
#include "lld/Core/Writer.h"
#include "lld/Driver/Driver.h"
#include "lld/Passes/RoundTripNativePass.h"
#include "lld/Passes/RoundTripYAMLPass.h"
#include "lld/ReaderWriter/Reader.h"
#include "lld/ReaderWriter/Writer.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/Option/Arg.h"

View File

@ -3,6 +3,8 @@ add_llvm_library(lldPasses
RoundTripNativePass.cpp
RoundTripYAMLPass.cpp
LINK_LIBS
lldReaderWriter
lldCore
lldNative
lldYAML
LLVMSupport
)

View File

@ -9,8 +9,8 @@
#include "lld/Core/Instrumentation.h"
#include "lld/Core/Simple.h"
#include "lld/Core/Writer.h"
#include "lld/Passes/RoundTripNativePass.h"
#include "lld/ReaderWriter/Writer.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Path.h"
#include <memory>

View File

@ -9,8 +9,8 @@
#include "lld/Core/Instrumentation.h"
#include "lld/Core/Simple.h"
#include "lld/Core/Writer.h"
#include "lld/Passes/RoundTripYAMLPass.h"
#include "lld/ReaderWriter/Writer.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Path.h"
#include <memory>

View File

@ -12,11 +12,10 @@ add_llvm_library(lldReaderWriter
CoreLinkingContext.cpp
FileArchive.cpp
LinkerScript.cpp
Reader.cpp
Writer.cpp
FileArchive.cpp
LINK_LIBS
lldCore
lldPasses
lldYAML
LLVMObject
LLVMSupport
)

View File

@ -13,7 +13,7 @@
#include "CreateELF.h"
#include "DynamicFile.h"
#include "ELFFile.h"
#include "lld/ReaderWriter/Reader.h"
#include "lld/Core/Reader.h"
namespace lld {
namespace elf {

View File

@ -16,7 +16,7 @@
#include "lld/Core/Parallel.h"
#include "lld/Core/SharedLibraryFile.h"
#include "lld/ReaderWriter/ELFLinkingContext.h"
#include "lld/ReaderWriter/Writer.h"
#include "lld/Core/Writer.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/Support/Path.h"

View File

@ -15,7 +15,7 @@
#include "SectionChunks.h"
#include "Writer.h"
#include "lld/Core/range.h"
#include "lld/ReaderWriter/Writer.h"
#include "lld/Core/Writer.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Object/ELF.h"

View File

@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
#include "lld/ReaderWriter/Writer.h"
#include "lld/Core/Writer.h"
#include "DynamicLibraryWriter.h"
#include "ExecutableWriter.h"

View File

@ -11,7 +11,7 @@
#define LLD_READER_WRITER_ELF_WRITER_H
#include "lld/Core/File.h"
#include "lld/ReaderWriter/Writer.h"
#include "lld/Core/Writer.h"
namespace lld {
namespace elf {

View File

@ -14,11 +14,11 @@
#include "MachOPasses.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 "lld/Passes/LayoutPass.h"
#include "lld/Passes/RoundTripYAMLPass.h"
#include "lld/ReaderWriter/Reader.h"
#include "lld/ReaderWriter/Writer.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/Triple.h"
#include "llvm/Config/config.h"

View File

@ -7,10 +7,10 @@
//
//===----------------------------------------------------------------------===//
#include "lld/ReaderWriter/Writer.h"
#include "ExecutableAtoms.hpp"
#include "MachONormalizedFile.h"
#include "lld/Core/File.h"
#include "lld/Core/Writer.h"
#include "lld/ReaderWriter/MachOLinkingContext.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"

View File

@ -2,6 +2,6 @@ add_llvm_library(lldNative
ReaderNative.cpp
WriterNative.cpp
LINK_LIBS
lldReaderWriter
lldCore
LLVMSupport
)

View File

@ -9,6 +9,6 @@
LLD_LEVEL := ../../..
LIBRARYNAME := lldNative
USEDLIBS = lldReaderWriter.a lldCore.a
USEDLIBS = lldCore.a
include $(LLD_LEVEL)/Makefile

View File

@ -11,8 +11,8 @@
#include "lld/Core/Atom.h"
#include "lld/Core/Error.h"
#include "lld/Core/File.h"
#include "lld/Core/Reader.h"
#include "lld/Core/Simple.h"
#include "lld/ReaderWriter/Reader.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Debug.h"

View File

@ -7,10 +7,10 @@
//
//===----------------------------------------------------------------------===//
#include "lld/ReaderWriter/Writer.h"
#include "NativeFileFormat.h"
#include "lld/Core/File.h"
#include "lld/Core/LinkingContext.h"
#include "lld/Core/Writer.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/StringRef.h"

View File

@ -16,13 +16,13 @@
#include "LoadConfigPass.h"
#include "PDBPass.h"
#include "lld/Core/PassManager.h"
#include "lld/Core/Reader.h"
#include "lld/Core/Simple.h"
#include "lld/Core/Writer.h"
#include "lld/Passes/LayoutPass.h"
#include "lld/Passes/RoundTripNativePass.h"
#include "lld/Passes/RoundTripYAMLPass.h"
#include "lld/ReaderWriter/PECOFFLinkingContext.h"
#include "lld/ReaderWriter/Reader.h"
#include "lld/ReaderWriter/Writer.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Path.h"

View File

@ -10,9 +10,9 @@
#include "Atoms.h"
#include "lld/Core/Alias.h"
#include "lld/Core/File.h"
#include "lld/Core/Reader.h"
#include "lld/Driver/Driver.h"
#include "lld/ReaderWriter/PECOFFLinkingContext.h"
#include "lld/ReaderWriter/Reader.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Object/COFF.h"

View File

@ -23,9 +23,9 @@
#include "WriterImportLibrary.h"
#include "lld/Core/DefinedAtom.h"
#include "lld/Core/File.h"
#include "lld/Core/Writer.h"
#include "lld/ReaderWriter/AtomLayout.h"
#include "lld/ReaderWriter/PECOFFLinkingContext.h"
#include "lld/ReaderWriter/Writer.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/Object/COFF.h"
#include "llvm/Support/COFF.h"

View File

@ -1,6 +1,6 @@
add_llvm_library(lldYAML
ReaderWriterYAML.cpp
LINK_LIBS
lldReaderWriter
lldCore
LLVMSupport
)

View File

@ -9,6 +9,6 @@
LLD_LEVEL := ../../..
LIBRARYNAME := lldYAML
USEDLIBS = lldReaderWriter.a lldCore.a
USEDLIBS = lldCore.a
include $(LLD_LEVEL)/Makefile

View File

@ -12,10 +12,10 @@
#include "lld/Core/Error.h"
#include "lld/Core/File.h"
#include "lld/Core/LLVM.h"
#include "lld/Core/Reader.h"
#include "lld/Core/Reference.h"
#include "lld/Core/Simple.h"
#include "lld/ReaderWriter/Reader.h"
#include "lld/ReaderWriter/Writer.h"
#include "lld/Core/Writer.h"
#include "lld/ReaderWriter/YamlContext.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringMap.h"