summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/MachO/WriterMachO.cpp
diff options
context:
space:
mode:
authorShankar Easwaran <shankare@codeaurora.org>2013-10-07 02:47:09 +0000
committerShankar Easwaran <shankare@codeaurora.org>2013-10-07 02:47:09 +0000
commita96f3a3da45cf6f37998df918f3c90ec9e6e2fec (patch)
tree8c69bcec8537cf344963c094feb68de6664f63de /lld/lib/ReaderWriter/MachO/WriterMachO.cpp
parent4f44079a2ca1467d0d6a0bb053a338a6b6e795d6 (diff)
downloadbcm5719-llvm-a96f3a3da45cf6f37998df918f3c90ec9e6e2fec.tar.gz
bcm5719-llvm-a96f3a3da45cf6f37998df918f3c90ec9e6e2fec.zip
[lld][InputGraph] Change the Resolver to use inputGraph
Changes :- a) Functionality in InputGraph to insert Input elements at any position b) Functionality in the Resolver to use nextFile c) Move the functionality of assigning file ordinals to InputGraph d) Changes all inputs to MemoryBuffers e) Remove LinkerInput, InputFiles, ReaderArchive llvm-svn: 192081
Diffstat (limited to 'lld/lib/ReaderWriter/MachO/WriterMachO.cpp')
-rw-r--r--lld/lib/ReaderWriter/MachO/WriterMachO.cpp33
1 files changed, 17 insertions, 16 deletions
diff --git a/lld/lib/ReaderWriter/MachO/WriterMachO.cpp b/lld/lib/ReaderWriter/MachO/WriterMachO.cpp
index a4fa214cea4..c028f7d69fd 100644
--- a/lld/lib/ReaderWriter/MachO/WriterMachO.cpp
+++ b/lld/lib/ReaderWriter/MachO/WriterMachO.cpp
@@ -27,7 +27,6 @@
#include "lld/Core/DefinedAtom.h"
#include "lld/Core/File.h"
-#include "lld/Core/InputFiles.h"
#include "lld/Core/Reference.h"
#include "lld/Core/SharedLibraryAtom.h"
#include "lld/ReaderWriter/MachOLinkingContext.h"
@@ -339,7 +338,7 @@ public:
MachOWriter(const MachOLinkingContext &context);
virtual error_code writeFile(const lld::File &file, StringRef path);
- virtual void addFiles(InputFiles&);
+ virtual bool createImplicitFiles(std::vector<std::unique_ptr<File> > &);
uint64_t addressOfAtom(const Atom *atom);
void findSegment(StringRef segmentName, uint32_t *segIndex,
@@ -369,14 +368,14 @@ private:
const MachOLinkingContext &_context;
mach_o::KindHandler &_referenceKindHandler;
- CRuntimeFile _cRuntimeFile;
- LoadCommandsChunk *_loadCommandsChunk;
- LoadCommandPaddingChunk *_paddingChunk;
- AtomToAddress _atomToAddress;
- std::vector<Chunk*> _chunks;
- std::vector<SectionChunk*> _sectionChunks;
- std::vector<LinkEditChunk*> _linkEditChunks;
- BindingInfoChunk *_bindingInfo;
+ std::unique_ptr<CRuntimeFile> _cRuntimeFile;
+ LoadCommandsChunk *_loadCommandsChunk;
+ LoadCommandPaddingChunk *_paddingChunk;
+ AtomToAddress _atomToAddress;
+ std::vector<Chunk *> _chunks;
+ std::vector<SectionChunk *> _sectionChunks;
+ std::vector<LinkEditChunk *> _linkEditChunks;
+ BindingInfoChunk *_bindingInfo;
LazyBindingInfoChunk *_lazyBindingInfo;
SymbolTableChunk *_symbolTableChunk;
SymbolStringsChunk *_stringsChunk;
@@ -1264,9 +1263,10 @@ uint32_t SymbolStringsChunk::stringIndex(StringRef str) {
MachOWriter::MachOWriter(const MachOLinkingContext &context)
: _context(context), _referenceKindHandler(context.kindHandler()),
- _cRuntimeFile(context), _bindingInfo(nullptr), _lazyBindingInfo(nullptr),
- _symbolTableChunk(nullptr), _stringsChunk(nullptr), _entryAtom(nullptr),
- _linkEditStartOffset(0), _linkEditStartAddress(0) {}
+ _cRuntimeFile(new CRuntimeFile(context)), _bindingInfo(nullptr),
+ _lazyBindingInfo(nullptr), _symbolTableChunk(nullptr),
+ _stringsChunk(nullptr), _entryAtom(nullptr), _linkEditStartOffset(0),
+ _linkEditStartAddress(0) {}
void MachOWriter::build(const lld::File &file) {
// Create objects for each chunk.
@@ -1487,11 +1487,12 @@ error_code MachOWriter::writeFile(const lld::File &file, StringRef path) {
return buffer->commit();
}
-void MachOWriter::addFiles(InputFiles &inputFiles) {
- inputFiles.prependFile(_cRuntimeFile);
+bool
+MachOWriter::createImplicitFiles(std::vector<std::unique_ptr<File> > &result) {
+ result.push_back(std::move(_cRuntimeFile));
+ return true;
}
-
} // namespace mach_o
std::unique_ptr<Writer> createWriterMachO(const MachOLinkingContext &context) {
OpenPOWER on IntegriCloud