<div dir="ltr">Thanks. I'll try that on a Mac. Wondering why this basic functionality breakage wasn't caught by the tests.</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 13, 2015 at 1:49 PM, Jean-Daniel Dupas <span dir="ltr"><<a href="mailto:dev@xenonium.com" target="_blank">dev@xenonium.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">If you have a Mac under the hand, linking a simple hello world should reproduce the issue.<br>
<br>
—— main.c ——<br>
#include <stdio.h><br>
<br>
int main(int argc, const char * argv[]) {<br>
printf("Hello, World!\n");<br>
return 0;<br>
}<br>
————<br>
clang -c main.c<br>
lld -flavor darwin -o hello main.o -lSystem<br>
<br>
Assertion failed: (dylib.file), function exports, file /Users/jddupas/Projects/OpenSource/llvm/llvm/tools/lld/lib/ReaderWriter/MachO/File.h, line 305.<br>
0 lld 0x0000000102840039 llvm::sys::PrintStackTrace(__sFILE*) + 57<br>
1 lld 0x000000010284079b SignalHandler(int) + 635<br>
2 libsystem_platform.dylib 0x00007fff924def1a _sigtramp + 26<br>
3 libsystem_platform.dylib 0x00007fff607dc764 _sigtramp + 3459242084<br>
4 lld 0x0000000102840506 abort + 22<br>
5 lld 0x00000001028404e1 __assert_rtn + 81<br>
6 lld 0x00000001025dd946 lld::mach_o::MachODylibFile::exports(llvm::StringRef, llvm::StringRef) const + 278<br>
7 lld 0x00000001026c000e std::__1::__function::__func<lld::Resolver::handleSharedLibrary(lld::File const&)::$_1, std::__1::allocator<lld::Resolver::handleSharedLibrary(lld::File const&)::$_1>, void (llvm::StringRef, bool)>::operator()(llvm::StringRef&&, bool&&) + 46<br>
8 lld 0x00000001026bdab0 lld::Resolver::forEachUndefines(bool, std::__1::function<void (llvm::StringRef, bool)>) + 144<br>
9 lld 0x00000001026bdd51 lld::Resolver::handleSharedLibrary(lld::File const&) + 113<br>
…<br>
<br>
> Le 13 janv. 2015 à 22:37, Rui Ueyama <<a href="mailto:ruiu@google.com">ruiu@google.com</a>> a écrit :<br>
<div class="HOEnZb"><div class="h5">><br>
> I'm sorry for the breakage. How can I reproduce the issue?<br>
><br>
> On Tue, Jan 13, 2015 at 1:35 PM, Jean-Daniel Dupas <<a href="mailto:dev@xenonium.com">dev@xenonium.com</a>> wrote:<br>
> Looks like this commit broke the Mach-O driver.<br>
> I didn’t investigate yet but I encounter assertion with reexported dyld that are not loaded.<br>
><br>
> Assertion failed: (dylib.file), function exports, file /Users/jddupas/Projects/OpenSource/llvm/llvm/tools/lld/lib/ReaderWriter/MachO/File.h, line 309<br>
><br>
><br>
> > Le 13 janv. 2015 à 05:33, Rui Ueyama <<a href="mailto:ruiu@google.com">ruiu@google.com</a>> a écrit :<br>
> ><br>
> > Author: ruiu<br>
> > Date: Mon Jan 12 22:33:07 2015<br>
> > New Revision: 225764<br>
> ><br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project?rev=225764&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=225764&view=rev</a><br>
> > Log:<br>
> > Convert other drivers to use WrapperNode.<br>
> ><br>
> > Removed:<br>
> > lld/trunk/include/lld/Driver/DarwinInputGraph.h<br>
> > lld/trunk/include/lld/Driver/GnuLdInputGraph.h<br>
> > lld/trunk/include/lld/Driver/WinLinkInputGraph.h<br>
> > lld/trunk/lib/Driver/DarwinInputGraph.cpp<br>
> > lld/trunk/lib/Driver/GnuLdInputGraph.cpp<br>
> > lld/trunk/lib/Driver/WinLinkInputGraph.cpp<br>
> > lld/trunk/test/Driver/libsearch-inputGraph.test<br>
> > Modified:<br>
> > lld/trunk/docs/Readers.rst<br>
> > lld/trunk/include/lld/Core/ArchiveLibraryFile.h<br>
> > lld/trunk/include/lld/Core/File.h<br>
> > lld/trunk/include/lld/Driver/Driver.h<br>
> > lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h<br>
> > lld/trunk/include/lld/ReaderWriter/MachOLinkingContext.h<br>
> > lld/trunk/include/lld/ReaderWriter/Reader.h<br>
> > lld/trunk/lib/Driver/CMakeLists.txt<br>
> > lld/trunk/lib/Driver/CoreDriver.cpp<br>
> > lld/trunk/lib/Driver/DarwinLdDriver.cpp<br>
> > lld/trunk/lib/Driver/Driver.cpp<br>
> > lld/trunk/lib/Driver/GnuLdDriver.cpp<br>
> > lld/trunk/lib/Driver/WinLinkDriver.cpp<br>
> > lld/trunk/lib/Passes/RoundTripNativePass.cpp<br>
> > lld/trunk/lib/Passes/RoundTripYAMLPass.cpp<br>
> > lld/trunk/lib/ReaderWriter/ELF/ELFReader.h<br>
> > lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFReader.h<br>
> > lld/trunk/lib/ReaderWriter/FileArchive.cpp<br>
> > lld/trunk/lib/ReaderWriter/MachO/ExecutableAtoms.hpp<br>
> > lld/trunk/lib/ReaderWriter/MachO/MachOLinkingContext.cpp<br>
> > lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp<br>
> > lld/trunk/lib/ReaderWriter/Native/ReaderNative.cpp<br>
> > lld/trunk/lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h<br>
> > lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp<br>
> > lld/trunk/lib/ReaderWriter/PECOFF/ReaderImportHeader.cpp<br>
> > lld/trunk/lib/ReaderWriter/Reader.cpp<br>
> > lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp<br>
> > lld/trunk/test/pecoff/hello64.test<br>
> > lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp<br>
> ><br>
> > Modified: lld/trunk/docs/Readers.rst<br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/docs/Readers.rst?rev=225764&r1=225763&r2=225764&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/docs/Readers.rst?rev=225764&r1=225763&r2=225764&view=diff</a><br>
> > ==============================================================================<br>
> > --- lld/trunk/docs/Readers.rst (original)<br>
> > +++ lld/trunk/docs/Readers.rst Mon Jan 12 22:33:07 2015<br>
> > @@ -66,7 +66,7 @@ Readers are factories<br>
> > ---------------------<br>
> ><br>
> > The linker will usually only instantiate your Reader once. That one Reader will<br>
> > -have its parseFile() method called many times with different input files.<br>
> > +have its loadFile() method called many times with different input files.<br>
> > To support multithreaded linking, the Reader may be parsing multiple input<br>
> > files in parallel. Therefore, there should be no parsing state in you Reader<br>
> > object. Any parsing state should be in ivars of your File subclass or in<br>
> > @@ -74,8 +74,8 @@ some temporary object.<br>
> ><br>
> > The key method to implement in a reader is::<br>
> ><br>
> > - virtual error_code parseFile(LinkerInput &input,<br>
> > - std::vector<std::unique_ptr<File>> &result);<br>
> > + virtual error_code loadFile(LinkerInput &input,<br>
> > + std::vector<std::unique_ptr<File>> &result);<br>
> ><br>
> > It takes a memory buffer (which contains the contents of the object file<br>
> > being read) and returns an instantiated lld::File object which is<br>
> ><br>
> > Modified: lld/trunk/include/lld/Core/ArchiveLibraryFile.h<br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/ArchiveLibraryFile.h?rev=225764&r1=225763&r2=225764&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/ArchiveLibraryFile.h?rev=225764&r1=225763&r2=225764&view=diff</a><br>
> > ==============================================================================<br>
> > --- lld/trunk/include/lld/Core/ArchiveLibraryFile.h (original)<br>
> > +++ lld/trunk/include/lld/Core/ArchiveLibraryFile.h Mon Jan 12 22:33:07 2015<br>
> > @@ -35,7 +35,7 @@ public:<br>
> > virtual const File *find(StringRef name, bool dataSymbolOnly) const = 0;<br>
> ><br>
> > virtual std::error_code<br>
> > - parseAllMembers(std::vector<std::unique_ptr<File>> &result) const = 0;<br>
> > + parseAllMembers(std::vector<std::unique_ptr<File>> &result) = 0;<br>
> ><br>
> > /// Returns a set of all defined symbols in the archive, i.e. all<br>
> > /// resolvable symbol using this file.<br>
> ><br>
> > Modified: lld/trunk/include/lld/Core/File.h<br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/File.h?rev=225764&r1=225763&r2=225764&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/File.h?rev=225764&r1=225763&r2=225764&view=diff</a><br>
> > ==============================================================================<br>
> > --- lld/trunk/include/lld/Core/File.h (original)<br>
> > +++ lld/trunk/include/lld/Core/File.h Mon Jan 12 22:33:07 2015<br>
> > @@ -274,7 +274,8 @@ protected:<br>
> > /// can do unit testing a driver using non-existing file paths.<br>
> > class ErrorFile : public File {<br>
> > public:<br>
> > - ErrorFile(StringRef p, std::error_code ec) : File(p, kindObject), _ec(ec) {}<br>
> > + ErrorFile(StringRef path, std::error_code ec)<br>
> > + : File(path, kindObject), _ec(ec) {}<br>
> ><br>
> > std::error_code doParse() override { return _ec; }<br>
> ><br>
> ><br>
> > Removed: lld/trunk/include/lld/Driver/DarwinInputGraph.h<br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Driver/DarwinInputGraph.h?rev=225763&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Driver/DarwinInputGraph.h?rev=225763&view=auto</a><br>
> > ==============================================================================<br>
> > --- lld/trunk/include/lld/Driver/DarwinInputGraph.h (original)<br>
> > +++ lld/trunk/include/lld/Driver/DarwinInputGraph.h (removed)<br>
> > @@ -1,56 +0,0 @@<br>
> > -//===- lld/Driver/DarwinInputGraph.h - Input Graph Node for Mach-O linker -===//<br>
> > -//<br>
> > -// The LLVM Linker<br>
> > -//<br>
> > -// This file is distributed under the University of Illinois Open Source<br>
> > -// License. See LICENSE.TXT for details.<br>
> > -//<br>
> > -//===----------------------------------------------------------------------===//<br>
> > -///<br>
> > -/// \file<br>
> > -///<br>
> > -/// Handles Options for MachO linking and provides InputElements<br>
> > -/// for MachO linker<br>
> > -///<br>
> > -//===----------------------------------------------------------------------===//<br>
> > -<br>
> > -#ifndef LLD_DRIVER_DARWIN_INPUT_GRAPH_H<br>
> > -#define LLD_DRIVER_DARWIN_INPUT_GRAPH_H<br>
> > -<br>
> > -#include "lld/Core/ArchiveLibraryFile.h"<br>
> > -#include "lld/Core/InputGraph.h"<br>
> > -#include "lld/ReaderWriter/MachOLinkingContext.h"<br>
> > -<br>
> > -namespace lld {<br>
> > -<br>
> > -/// \brief Represents a MachO File<br>
> > -class MachOFileNode : public FileNode {<br>
> > -public:<br>
> > - MachOFileNode(StringRef path, MachOLinkingContext &ctx)<br>
> > - : FileNode(path), _context(ctx), _isWholeArchive(false),<br>
> > - _upwardDylib(false) {}<br>
> > -<br>
> > - /// \brief Parse the input file to lld::File.<br>
> > - std::error_code parse(const LinkingContext &ctx,<br>
> > - raw_ostream &diagnostics) override;<br>
> > -<br>
> > - void setLoadWholeArchive(bool value=true) {<br>
> > - _isWholeArchive = value;<br>
> > - }<br>
> > -<br>
> > - void setUpwardDylib(bool value=true) {<br>
> > - _upwardDylib = value;<br>
> > - }<br>
> > -<br>
> > -private:<br>
> > - void narrowFatBuffer(std::unique_ptr<MemoryBuffer> &mb, StringRef filePath);<br>
> > -<br>
> > - MachOLinkingContext &_context;<br>
> > - std::unique_ptr<const ArchiveLibraryFile> _archiveFile;<br>
> > - bool _isWholeArchive;<br>
> > - bool _upwardDylib;<br>
> > -};<br>
> > -<br>
> > -} // namespace lld<br>
> > -<br>
> > -#endif<br>
> ><br>
> > Modified: lld/trunk/include/lld/Driver/Driver.h<br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Driver/Driver.h?rev=225764&r1=225763&r2=225764&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Driver/Driver.h?rev=225764&r1=225763&r2=225764&view=diff</a><br>
> > ==============================================================================<br>
> > --- lld/trunk/include/lld/Driver/Driver.h (original)<br>
> > +++ lld/trunk/include/lld/Driver/Driver.h Mon Jan 12 22:33:07 2015<br>
> > @@ -36,7 +36,7 @@ typedef std::vector<std::unique_ptr<File<br>
> ><br>
> > FileVector makeErrorFile(StringRef path, std::error_code ec);<br>
> > FileVector parseMemberFiles(FileVector &files);<br>
> > -FileVector parseFile(LinkingContext &ctx, StringRef path, bool wholeArchive);<br>
> > +FileVector loadFile(LinkingContext &ctx, StringRef path, bool wholeArchive);<br>
> ><br>
> > /// Base class for all Drivers.<br>
> > class Driver {<br>
> ><br>
> > Removed: lld/trunk/include/lld/Driver/GnuLdInputGraph.h<br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Driver/GnuLdInputGraph.h?rev=225763&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Driver/GnuLdInputGraph.h?rev=225763&view=auto</a><br>
> > ==============================================================================<br>
> > --- lld/trunk/include/lld/Driver/GnuLdInputGraph.h (original)<br>
> > +++ lld/trunk/include/lld/Driver/GnuLdInputGraph.h (removed)<br>
> > @@ -1,85 +0,0 @@<br>
> > -//===- lld/Driver/GnuLdInputGraph.h - Input Graph Node for ELF linker------===//<br>
> > -//<br>
> > -// The LLVM Linker<br>
> > -//<br>
> > -// This file is distributed under the University of Illinois Open Source<br>
> > -// License. See LICENSE.TXT for details.<br>
> > -//<br>
> > -//===----------------------------------------------------------------------===//<br>
> > -///<br>
> > -/// \file<br>
> > -///<br>
> > -/// Handles Options for the GNU style linker for ELF and provides InputElements<br>
> > -/// for the GNU style linker for ELF<br>
> > -///<br>
> > -//===----------------------------------------------------------------------===//<br>
> > -<br>
> > -#ifndef LLD_DRIVER_GNU_LD_INPUT_GRAPH_H<br>
> > -#define LLD_DRIVER_GNU_LD_INPUT_GRAPH_H<br>
> > -<br>
> > -#include "lld/Core/ArchiveLibraryFile.h"<br>
> > -#include "lld/Core/InputGraph.h"<br>
> > -#include "lld/Core/Resolver.h"<br>
> > -#include "lld/ReaderWriter/ELFLinkingContext.h"<br>
> > -<br>
> > -namespace lld {<br>
> > -<br>
> > -/// \brief Represents a ELF File<br>
> > -class ELFFileNode : public FileNode {<br>
> > -public:<br>
> > - /// \brief The attributes class provides a way for a input file to look into<br>
> > - /// all the positional attributes that were specified in the command line.<br>
> > - /// There are few positional operators and the number of arguments to the<br>
> > - /// ELFFileNode class keeps growing. This achieves code to be clean as well.<br>
> > - class Attributes {<br>
> > - public:<br>
> > - Attributes()<br>
> > - : _isWholeArchive(false), _asNeeded(false), _isDashlPrefix(false),<br>
> > - _isSysRooted(false) {}<br>
> > - void setWholeArchive(bool isWholeArchive) {<br>
> > - _isWholeArchive = isWholeArchive;<br>
> > - }<br>
> > - void setAsNeeded(bool asNeeded) { _asNeeded = asNeeded; }<br>
> > - void setDashlPrefix(bool isDashlPrefix) { _isDashlPrefix = isDashlPrefix; }<br>
> > - void setSysRooted(bool isSysRooted) { _isSysRooted = isSysRooted; }<br>
> > -<br>
> > - public:<br>
> > - bool _isWholeArchive;<br>
> > - bool _asNeeded;<br>
> > - bool _isDashlPrefix;<br>
> > - bool _isSysRooted;<br>
> > - };<br>
> > -<br>
> > - ELFFileNode(ELFLinkingContext &ctx, StringRef path, Attributes &attributes)<br>
> > - : FileNode(path), _elfLinkingContext(ctx), _attributes(attributes) {}<br>
> > -<br>
> > - ErrorOr<StringRef> getPath(const LinkingContext &ctx) const override;<br>
> > -<br>
> > - /// \brief create an error string for printing purposes<br>
> > - std::string errStr(std::error_code) override;<br>
> > -<br>
> > - /// \brief Dump the Input Element<br>
> > - bool dump(raw_ostream &diagnostics) override {<br>
> > - diagnostics << "Name : " << *getPath(_elfLinkingContext) << "\n"<br>
> > - << "Type : ELF File\n"<br>
> > - << "Attributes :\n"<br>
> > - << " - wholeArchive : "<br>
> > - << ((_attributes._isWholeArchive) ? "true" : "false") << "\n"<br>
> > - << " - asNeeded : "<br>
> > - << ((_attributes._asNeeded) ? "true" : "false") << "\n";<br>
> > - return true;<br>
> > - }<br>
> > -<br>
> > - /// \brief Parse the input file to lld::File.<br>
> > - std::error_code parse(const LinkingContext &, raw_ostream &) override;<br>
> > -<br>
> > -private:<br>
> > - llvm::BumpPtrAllocator _alloc;<br>
> > - const ELFLinkingContext &_elfLinkingContext;<br>
> > - std::unique_ptr<const ArchiveLibraryFile> _archiveFile;<br>
> > - const Attributes _attributes;<br>
> > -};<br>
> > -<br>
> > -} // namespace lld<br>
> > -<br>
> > -#endif<br>
> ><br>
> > Removed: lld/trunk/include/lld/Driver/WinLinkInputGraph.h<br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Driver/WinLinkInputGraph.h?rev=225763&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Driver/WinLinkInputGraph.h?rev=225763&view=auto</a><br>
> > ==============================================================================<br>
> > --- lld/trunk/include/lld/Driver/WinLinkInputGraph.h (original)<br>
> > +++ lld/trunk/include/lld/Driver/WinLinkInputGraph.h (removed)<br>
> > @@ -1,45 +0,0 @@<br>
> > -//===- lld/Driver/WinLinkInputGraph.h - Input Graph Node for COFF linker --===//<br>
> > -//<br>
> > -// The LLVM Linker<br>
> > -//<br>
> > -// This file is distributed under the University of Illinois Open Source<br>
> > -// License. See LICENSE.TXT for details.<br>
> > -//<br>
> > -//===----------------------------------------------------------------------===//<br>
> > -///<br>
> > -/// \file<br>
> > -///<br>
> > -/// Handles Options for PECOFF linking and provides InputElements<br>
> > -/// for PECOFF linker<br>
> > -///<br>
> > -//===----------------------------------------------------------------------===//<br>
> > -<br>
> > -#ifndef LLD_DRIVER_WIN_LINK_INPUT_GRAPH_H<br>
> > -#define LLD_DRIVER_WIN_LINK_INPUT_GRAPH_H<br>
> > -<br>
> > -#include "lld/Core/InputGraph.h"<br>
> > -#include "lld/ReaderWriter/PECOFFLinkingContext.h"<br>
> > -#include <map><br>
> > -<br>
> > -namespace lld {<br>
> > -<br>
> > -/// \brief Represents a PECOFF File<br>
> > -class PECOFFFileNode : public FileNode {<br>
> > -public:<br>
> > - PECOFFFileNode(PECOFFLinkingContext &ctx, StringRef path)<br>
> > - : FileNode(path), _ctx(ctx), _parsed(false) {}<br>
> > -<br>
> > - /// \brief Parse the input file to lld::File.<br>
> > - std::error_code parse(const LinkingContext &ctx,<br>
> > - raw_ostream &diagnostics) override;<br>
> > -<br>
> > -protected:<br>
> > - const PECOFFLinkingContext &_ctx;<br>
> > -<br>
> > -private:<br>
> > - bool _parsed;<br>
> > -};<br>
> > -<br>
> > -} // namespace lld<br>
> > -<br>
> > -#endif<br>
> ><br>
> > Modified: lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h<br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h?rev=225764&r1=225763&r2=225764&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h?rev=225764&r1=225763&r2=225764&view=diff</a><br>
> > ==============================================================================<br>
> > --- lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h (original)<br>
> > +++ lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h Mon Jan 12 22:33:07 2015<br>
> > @@ -290,6 +290,28 @@ public:<br>
> > bool alignSegments() const { return _alignSegments; }<br>
> > void setAlignSegments(bool align) { _alignSegments = align; }<br>
> ><br>
> > + /// \brief The attributes class provides a way for a input file to look into<br>
> > + /// all the positional attributes that were specified in the command line.<br>
> > + /// There are few positional operators and the number of arguments to the<br>
> > + /// ELFFileNode class keeps growing. This achieves code to be clean as well.<br>
> > + class Attributes {<br>
> > + public:<br>
> > + Attributes()<br>
> > + : _isWholeArchive(false), _asNeeded(false), _isDashlPrefix(false),<br>
> > + _isSysRooted(false) {}<br>
> > + void setWholeArchive(bool isWholeArchive) {<br>
> > + _isWholeArchive = isWholeArchive;<br>
> > + }<br>
> > + void setAsNeeded(bool asNeeded) { _asNeeded = asNeeded; }<br>
> > + void setDashlPrefix(bool isDashlPrefix) { _isDashlPrefix = isDashlPrefix; }<br>
> > + void setSysRooted(bool isSysRooted) { _isSysRooted = isSysRooted; }<br>
> > +<br>
> > + bool _isWholeArchive;<br>
> > + bool _asNeeded;<br>
> > + bool _isDashlPrefix;<br>
> > + bool _isSysRooted;<br>
> > + };<br>
> > +<br>
> > private:<br>
> > ELFLinkingContext() LLVM_DELETED_FUNCTION;<br>
> ><br>
> ><br>
> > Modified: lld/trunk/include/lld/ReaderWriter/MachOLinkingContext.h<br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/MachOLinkingContext.h?rev=225764&r1=225763&r2=225764&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/MachOLinkingContext.h?rev=225764&r1=225763&r2=225764&view=diff</a><br>
> > ==============================================================================<br>
> > --- lld/trunk/include/lld/ReaderWriter/MachOLinkingContext.h (original)<br>
> > +++ lld/trunk/include/lld/ReaderWriter/MachOLinkingContext.h Mon Jan 12 22:33:07 2015<br>
> > @@ -350,7 +350,7 @@ private:<br>
> > mutable llvm::StringMap<mach_o::MachODylibFile*> _pathToDylibMap;<br>
> > mutable std::set<mach_o::MachODylibFile*> _allDylibs;<br>
> > mutable std::set<mach_o::MachODylibFile*> _upwardDylibs;<br>
> > - mutable std::vector<std::unique_ptr<class MachOFileNode>> _indirectDylibs;<br>
> > + mutable std::vector<std::unique_ptr<File>> _indirectDylibs;<br>
> > ExportMode _exportMode;<br>
> > llvm::StringSet<> _exportedSymbols;<br>
> > DebugInfoMode _debugInfoMode;<br>
> ><br>
> > Modified: lld/trunk/include/lld/ReaderWriter/Reader.h<br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/Reader.h?rev=225764&r1=225763&r2=225764&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/Reader.h?rev=225764&r1=225763&r2=225764&view=diff</a><br>
> > ==============================================================================<br>
> > --- lld/trunk/include/lld/ReaderWriter/Reader.h (original)<br>
> > +++ lld/trunk/include/lld/ReaderWriter/Reader.h Mon Jan 12 22:33:07 2015<br>
> > @@ -55,8 +55,8 @@ public:<br>
> > /// file) and create a File object.<br>
> > /// The resulting File object takes ownership of the MemoryBuffer.<br>
> > virtual std::error_code<br>
> > - parseFile(std::unique_ptr<MemoryBuffer> mb, const class Registry &,<br>
> > - std::vector<std::unique_ptr<File>> &result) const = 0;<br>
> > + loadFile(std::unique_ptr<MemoryBuffer> mb, const class Registry &,<br>
> > + std::vector<std::unique_ptr<File>> &result) const = 0;<br>
> > };<br>
> ><br>
> ><br>
> > @@ -93,8 +93,8 @@ public:<br>
> ><br>
> > /// Walk the list of registered Readers and find one that can parse the<br>
> > /// supplied file and parse it.<br>
> > - std::error_code parseFile(std::unique_ptr<MemoryBuffer> mb,<br>
> > - std::vector<std::unique_ptr<File>> &result) const;<br>
> > + std::error_code loadFile(std::unique_ptr<MemoryBuffer> mb,<br>
> > + std::vector<std::unique_ptr<File>> &result) const;<br>
> ><br>
> > /// Walk the list of registered kind tables to convert a Reference Kind<br>
> > /// name to a value.<br>
> ><br>
> > Modified: lld/trunk/lib/Driver/CMakeLists.txt<br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/CMakeLists.txt?rev=225764&r1=225763&r2=225764&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/CMakeLists.txt?rev=225764&r1=225763&r2=225764&view=diff</a><br>
> > ==============================================================================<br>
> > --- lld/trunk/lib/Driver/CMakeLists.txt (original)<br>
> > +++ lld/trunk/lib/Driver/CMakeLists.txt Mon Jan 12 22:33:07 2015<br>
> > @@ -12,14 +12,11 @@ add_public_tablegen_target(DriverOptions<br>
> ><br>
> > add_lld_library(lldDriver<br>
> > CoreDriver.cpp<br>
> > - DarwinInputGraph.cpp<br>
> > DarwinLdDriver.cpp<br>
> > Driver.cpp<br>
> > GnuLdDriver.cpp<br>
> > - GnuLdInputGraph.cpp<br>
> > UniversalDriver.cpp<br>
> > WinLinkDriver.cpp<br>
> > - WinLinkInputGraph.cpp<br>
> > WinLinkModuleDef.cpp<br>
> > )<br>
> ><br>
> ><br>
> > Modified: lld/trunk/lib/Driver/CoreDriver.cpp<br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/CoreDriver.cpp?rev=225764&r1=225763&r2=225764&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/CoreDriver.cpp?rev=225764&r1=225763&r2=225764&view=diff</a><br>
> > ==============================================================================<br>
> > --- lld/trunk/lib/Driver/CoreDriver.cpp (original)<br>
> > +++ lld/trunk/lib/Driver/CoreDriver.cpp Mon Jan 12 22:33:07 2015<br>
> > @@ -152,7 +152,7 @@ bool CoreDriver::parse(int argc, const c<br>
> ><br>
> > case OPT_INPUT: {<br>
> > std::vector<std::unique_ptr<File>> files<br>
> > - = parseFile(ctx, inputArg->getValue(), false);<br>
> > + = loadFile(ctx, inputArg->getValue(), false);<br>
> > for (std::unique_ptr<File> &file : files) {<br>
> > inputGraph->addInputElement(std::unique_ptr<InputElement>(<br>
> > new WrapperNode(std::move(file))));<br>
> ><br>
> > Removed: lld/trunk/lib/Driver/DarwinInputGraph.cpp<br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/DarwinInputGraph.cpp?rev=225763&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/DarwinInputGraph.cpp?rev=225763&view=auto</a><br>
> > ==============================================================================<br>
> > --- lld/trunk/lib/Driver/DarwinInputGraph.cpp (original)<br>
> > +++ lld/trunk/lib/Driver/DarwinInputGraph.cpp (removed)<br>
> > @@ -1,83 +0,0 @@<br>
> > -//===- lib/ReaderWriter/MachO/DarwinInputGraph.cpp ------------------------===//<br>
> > -//<br>
> > -// The LLVM Linker<br>
> > -//<br>
> > -// This file is distributed under the University of Illinois Open Source<br>
> > -// License. See LICENSE.TXT for details.<br>
> > -//<br>
> > -//===----------------------------------------------------------------------===//<br>
> > -<br>
> > -#include "lld/Driver/DarwinInputGraph.h"<br>
> > -#include "lld/Core/ArchiveLibraryFile.h"<br>
> > -#include "lld/Core/DefinedAtom.h"<br>
> > -#include "lld/Core/File.h"<br>
> > -#include "lld/Core/LLVM.h"<br>
> > -#include "lld/Core/Reference.h"<br>
> > -#include "lld/Core/SharedLibraryFile.h"<br>
> > -<br>
> > -namespace lld {<br>
> > -<br>
> > -<br>
> > -/// \brief Parse the input file to lld::File.<br>
> > -std::error_code MachOFileNode::parse(const LinkingContext &ctx,<br>
> > - raw_ostream &diagnostics) {<br>
> > - ErrorOr<StringRef> filePath = getPath(ctx);<br>
> > - if (std::error_code ec = filePath.getError())<br>
> > - return ec;<br>
> > - ErrorOr<std::unique_ptr<MemoryBuffer>> mbOrErr =<br>
> > - MemoryBuffer::getFileOrSTDIN(*filePath);<br>
> > - if (std::error_code ec = mbOrErr.getError())<br>
> > - return ec;<br>
> > - std::unique_ptr<MemoryBuffer> mb = std::move(mbOrErr.get());<br>
> > -<br>
> > - _context.addInputFileDependency(*filePath);<br>
> > - if (ctx.logInputFiles())<br>
> > - diagnostics << *filePath << "\n";<br>
> > -<br>
> > - narrowFatBuffer(mb, *filePath);<br>
> > -<br>
> > - std::vector<std::unique_ptr<File>> parsedFiles;<br>
> > - if (std::error_code ec = ctx.registry().parseFile(std::move(mb), parsedFiles))<br>
> > - return ec;<br>
> > - for (std::unique_ptr<File> &pf : parsedFiles) {<br>
> > - // If file is a dylib, inform LinkingContext about it.<br>
> > - if (SharedLibraryFile *shl = dyn_cast<SharedLibraryFile>(pf.get())) {<br>
> > - _context.registerDylib(reinterpret_cast<mach_o::MachODylibFile*>(shl),<br>
> > - _upwardDylib);<br>
> > - }<br>
> > - // If file is an archive and -all_load, then add all members.<br>
> > - if (ArchiveLibraryFile *archive = dyn_cast<ArchiveLibraryFile>(pf.get())) {<br>
> > - if (_isWholeArchive) {<br>
> > - // Have this node own the FileArchive object.<br>
> > - _archiveFile.reset(archive);<br>
> > - pf.release();<br>
> > - // Add all members to _files vector<br>
> > - return archive->parseAllMembers(_files);<br>
> > - }<br>
> > - }<br>
> > - _files.push_back(std::move(pf));<br>
> > - }<br>
> > - return std::error_code();<br>
> > -}<br>
> > -<br>
> > -<br>
> > -/// If buffer contains a fat file, find required arch in fat buffer and<br>
> > -/// switch buffer to point to just that required slice.<br>
> > -void MachOFileNode::narrowFatBuffer(std::unique_ptr<MemoryBuffer> &mb,<br>
> > - StringRef filePath) {<br>
> > - // Check if buffer is a "fat" file that contains needed arch.<br>
> > - uint32_t offset;<br>
> > - uint32_t size;<br>
> > - if (!_context.sliceFromFatFile(*mb, offset, size)) {<br>
> > - return;<br>
> > - }<br>
> > - // Create new buffer containing just the needed slice.<br>
> > - auto subuf = MemoryBuffer::getFileSlice(filePath, size, offset);<br>
> > - if (subuf.getError())<br>
> > - return;<br>
> > - // The assignment to mb will release previous buffer.<br>
> > - mb = std::move(subuf.get());<br>
> > -}<br>
> > -<br>
> > -<br>
> > -} // end namesapce lld<br>
> ><br>
> > Modified: lld/trunk/lib/Driver/DarwinLdDriver.cpp<br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/DarwinLdDriver.cpp?rev=225764&r1=225763&r2=225764&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/DarwinLdDriver.cpp?rev=225764&r1=225763&r2=225764&view=diff</a><br>
> > ==============================================================================<br>
> > --- lld/trunk/lib/Driver/DarwinLdDriver.cpp (original)<br>
> > +++ lld/trunk/lib/Driver/DarwinLdDriver.cpp Mon Jan 12 22:33:07 2015<br>
> > @@ -13,8 +13,11 @@<br>
> > ///<br>
> > //===----------------------------------------------------------------------===//<br>
> ><br>
> > +#include "lld/Core/File.h"<br>
> > +#include "lld/Core/ArchiveLibraryFile.h"<br>
> > +#include "lld/Core/SharedLibraryFile.h"<br>
> > #include "lld/Driver/Driver.h"<br>
> > -#include "lld/Driver/DarwinInputGraph.h"<br>
> > +#include "lld/Driver/WrapperInputGraph.h"<br>
> > #include "lld/ReaderWriter/MachOLinkingContext.h"<br>
> > #include "llvm/ADT/ArrayRef.h"<br>
> > #include "llvm/ADT/STLExtras.h"<br>
> > @@ -22,6 +25,7 @@<br>
> > #include "llvm/Option/Arg.h"<br>
> > #include "llvm/Option/Option.h"<br>
> > #include "llvm/Support/CommandLine.h"<br>
> > +#include "llvm/Support/Debug.h"<br>
> > #include "llvm/Support/FileSystem.h"<br>
> > #include "llvm/Support/Format.h"<br>
> > #include "llvm/Support/Host.h"<br>
> > @@ -68,6 +72,50 @@ public:<br>
> > DarwinLdOptTable() : OptTable(infoTable, llvm::array_lengthof(infoTable)){}<br>
> > };<br>
> ><br>
> > +std::vector<std::unique_ptr<File>><br>
> > +loadFiles(MachOLinkingContext &ctx, StringRef path,<br>
> > + raw_ostream &diag, bool wholeArchive, bool upwardDylib) {<br>
> > + ErrorOr<std::unique_ptr<MemoryBuffer>> mbOrErr =<br>
> > + MemoryBuffer::getFileOrSTDIN(path);<br>
> > + if (std::error_code ec = mbOrErr.getError())<br>
> > + return makeErrorFile(path, ec);<br>
> > + std::unique_ptr<MemoryBuffer> mb = std::move(mbOrErr.get());<br>
> > +<br>
> > + ctx.addInputFileDependency(path);<br>
> > + if (ctx.logInputFiles())<br>
> > + diag << path << "\n";<br>
> > +<br>
> > + // If buffer contains a fat file, find required arch in fat buffer<br>
> > + // and switch buffer to point to just that required slice.<br>
> > + // Check if buffer is a "fat" file that contains needed arch.<br>
> > + uint32_t offset;<br>
> > + uint32_t size;<br>
> > + if (ctx.sliceFromFatFile(*mb, offset, size)) {<br>
> > + // Create new buffer containing just the needed slice.<br>
> > + auto subuf = MemoryBuffer::getFileSlice(path, size, offset);<br>
> > + if (std::error_code ec = subuf.getError())<br>
> > + return makeErrorFile(path, ec);<br>
> > + // The assignment to mb will release previous buffer.<br>
> > + mb = std::move(subuf.get());<br>
> > + }<br>
> > +<br>
> > + std::vector<std::unique_ptr<File>> files;<br>
> > + if (std::error_code ec = ctx.registry().loadFile(std::move(mb), files))<br>
> > + return makeErrorFile(path, ec);<br>
> > + for (std::unique_ptr<File> &pf : files) {<br>
> > + // If file is a dylib, inform LinkingContext about it.<br>
> > + if (SharedLibraryFile *shl = dyn_cast<SharedLibraryFile>(pf.get())) {<br>
> > + if (std::error_code ec = shl->parse())<br>
> > + return makeErrorFile(path, ec);<br>
> > + ctx.registerDylib(reinterpret_cast<mach_o::MachODylibFile*>(shl),<br>
> > + upwardDylib);<br>
> > + }<br>
> > + }<br>
> > + if (wholeArchive)<br>
> > + return parseMemberFiles(files);<br>
> > + return files;<br>
> > +}<br>
> > +<br>
> > } // anonymous namespace<br>
> ><br>
> > // Test may be running on Windows. Canonicalize the path<br>
> > @@ -85,13 +133,12 @@ static std::string canonicalizePath(Stri<br>
> ><br>
> > static void addFile(StringRef path, std::unique_ptr<InputGraph> &inputGraph,<br>
> > MachOLinkingContext &ctx, bool loadWholeArchive,<br>
> > - bool upwardDylib) {<br>
> > - auto node = llvm::make_unique<MachOFileNode>(path, ctx);<br>
> > - if (loadWholeArchive)<br>
> > - node->setLoadWholeArchive();<br>
> > - if (upwardDylib)<br>
> > - node->setUpwardDylib();<br>
> > - inputGraph->addInputElement(std::move(node));<br>
> > + bool upwardDylib, raw_ostream &diag) {<br>
> > + std::vector<std::unique_ptr<File>> files =<br>
> > + loadFiles(ctx, path, diag, loadWholeArchive, upwardDylib);<br>
> > + for (std::unique_ptr<File> &file : files)<br>
> > + inputGraph->addInputElement(<br>
> > + llvm::make_unique<WrapperNode>(std::move(file)));<br>
> > }<br>
> ><br>
> > // Export lists are one symbol per line. Blank lines are ignored.<br>
> > @@ -184,10 +231,10 @@ static std::error_code parseOrderFile(St<br>
> > // In this variant, the path is to a text file which contains a partial path<br>
> > // per line. The <dir> prefix is prepended to each partial path.<br>
> > //<br>
> > -static std::error_code parseFileList(StringRef fileListPath,<br>
> > - std::unique_ptr<InputGraph> &inputGraph,<br>
> > - MachOLinkingContext &ctx, bool forceLoad,<br>
> > - raw_ostream &diagnostics) {<br>
> > +static std::error_code loadFileList(StringRef fileListPath,<br>
> > + std::unique_ptr<InputGraph> &inputGraph,<br>
> > + MachOLinkingContext &ctx, bool forceLoad,<br>
> > + raw_ostream &diagnostics) {<br>
> > // If there is a comma, split off <dir>.<br>
> > std::pair<StringRef, StringRef> opt = fileListPath.split(',');<br>
> > StringRef filePath = opt.first;<br>
> > @@ -222,7 +269,7 @@ static std::error_code parseFileList(Str<br>
> > if (ctx.testingFileUsage()) {<br>
> > diagnostics << "Found filelist entry " << canonicalizePath(path) << '\n';<br>
> > }<br>
> > - addFile(path, inputGraph, ctx, forceLoad, false);<br>
> > + addFile(path, inputGraph, ctx, forceLoad, false, diagnostics);<br>
> > buffer = lineAndRest.second;<br>
> > }<br>
> > return std::error_code();<br>
> > @@ -244,13 +291,6 @@ bool DarwinLdDriver::linkMachO(int argc,<br>
> > return false;<br>
> > if (ctx.doNothing())<br>
> > return true;<br>
> > -<br>
> > - // Register possible input file parsers.<br>
> > - ctx.registry().addSupportMachOObjects(ctx);<br>
> > - ctx.registry().addSupportArchives(ctx.logInputFiles());<br>
> > - ctx.registry().addSupportNativeObjects();<br>
> > - ctx.registry().addSupportYamlFiles();<br>
> > -<br>
> > return link(ctx, diagnostics);<br>
> > }<br>
> ><br>
> > @@ -310,15 +350,15 @@ bool DarwinLdDriver::parse(int argc, con<br>
> > }<br>
> > }<br>
> > // If no -arch specified, scan input files to find first non-fat .o file.<br>
> > - if ((arch == MachOLinkingContext::arch_unknown)<br>
> > - && !parsedArgs->getLastArg(OPT_test_file_usage)) {<br>
> > + if (arch == MachOLinkingContext::arch_unknown) {<br>
> > for (auto &inFile: parsedArgs->filtered(OPT_INPUT)) {<br>
> > // This is expensive because it opens and maps the file. But that is<br>
> > // ok because no -arch is rare.<br>
> > if (MachOLinkingContext::isThinObjectFile(inFile->getValue(), arch))<br>
> > break;<br>
> > }<br>
> > - if (arch == MachOLinkingContext::arch_unknown) {<br>
> > + if (arch == MachOLinkingContext::arch_unknown<br>
> > + && !parsedArgs->getLastArg(OPT_test_file_usage)) {<br>
> > // If no -arch and no options at all, print usage message.<br>
> > if (parsedArgs->size() == 0)<br>
> > table.PrintHelp(llvm::outs(), argv[0], "LLVM Linker", false);<br>
> > @@ -521,6 +561,13 @@ bool DarwinLdDriver::parse(int argc, con<br>
> > }<br>
> > }<br>
> ><br>
> > + // Register possible input file parsers.<br>
> > + if (!ctx.doNothing()) {<br>
> > + ctx.registry().addSupportMachOObjects(ctx);<br>
> > + ctx.registry().addSupportArchives(ctx.logInputFiles());<br>
> > + ctx.registry().addSupportNativeObjects();<br>
> > + ctx.registry().addSupportYamlFiles();<br>
> > + }<br>
> > std::unique_ptr<InputGraph> inputGraph(new InputGraph());<br>
> ><br>
> > // Now construct the set of library search directories, following ld64's<br>
> > @@ -745,13 +792,13 @@ bool DarwinLdDriver::parse(int argc, con<br>
> > default:<br>
> > continue;<br>
> > case OPT_INPUT:<br>
> > - addFile(arg->getValue(), inputGraph, ctx, globalWholeArchive, false);<br>
> > + addFile(arg->getValue(), inputGraph, ctx, globalWholeArchive, false, diagnostics);<br>
> > break;<br>
> > case OPT_upward_library:<br>
> > - addFile(arg->getValue(), inputGraph, ctx, false, true);<br>
> > + addFile(arg->getValue(), inputGraph, ctx, false, true, diagnostics);<br>
> > break;<br>
> > case OPT_force_load:<br>
> > - addFile(arg->getValue(), inputGraph, ctx, true, false);<br>
> > + addFile(arg->getValue(), inputGraph, ctx, true, false, diagnostics);<br>
> > break;<br>
> > case OPT_l:<br>
> > case OPT_upward_l:<br>
> > @@ -765,7 +812,7 @@ bool DarwinLdDriver::parse(int argc, con<br>
> > diagnostics << "Found " << (upward ? "upward " : " ") << "library "<br>
> > << canonicalizePath(resolvedPath.get()) << '\n';<br>
> > }<br>
> > - addFile(resolvedPath.get(), inputGraph, ctx, globalWholeArchive, upward);<br>
> > + addFile(resolvedPath.get(), inputGraph, ctx, globalWholeArchive, upward, diagnostics);<br>
> > break;<br>
> > case OPT_framework:<br>
> > case OPT_upward_framework:<br>
> > @@ -779,12 +826,12 @@ bool DarwinLdDriver::parse(int argc, con<br>
> > diagnostics << "Found " << (upward ? "upward " : " ") << "framework "<br>
> > << canonicalizePath(resolvedPath.get()) << '\n';<br>
> > }<br>
> > - addFile(resolvedPath.get(), inputGraph, ctx, globalWholeArchive, upward);<br>
> > + addFile(resolvedPath.get(), inputGraph, ctx, globalWholeArchive, upward, diagnostics);<br>
> > break;<br>
> > case OPT_filelist:<br>
> > - if (std::error_code ec = parseFileList(arg->getValue(), inputGraph,<br>
> > - ctx, globalWholeArchive,<br>
> > - diagnostics)) {<br>
> > + if (std::error_code ec = loadFileList(arg->getValue(), inputGraph,<br>
> > + ctx, globalWholeArchive,<br>
> > + diagnostics)) {<br>
> > diagnostics << "error: " << ec.message()<br>
> > << ", processing '-filelist " << arg->getValue()<br>
> > << "'\n";<br>
> ><br>
> > Modified: lld/trunk/lib/Driver/Driver.cpp<br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/Driver.cpp?rev=225764&r1=225763&r2=225764&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/Driver.cpp?rev=225764&r1=225763&r2=225764&view=diff</a><br>
> > ==============================================================================<br>
> > --- lld/trunk/lib/Driver/Driver.cpp (original)<br>
> > +++ lld/trunk/lib/Driver/Driver.cpp Mon Jan 12 22:33:07 2015<br>
> > @@ -49,13 +49,13 @@ FileVector parseMemberFiles(FileVector &<br>
> > return members;<br>
> > }<br>
> ><br>
> > -FileVector parseFile(LinkingContext &ctx, StringRef path, bool wholeArchive) {<br>
> > +FileVector loadFile(LinkingContext &ctx, StringRef path, bool wholeArchive) {<br>
> > ErrorOr<std::unique_ptr<MemoryBuffer>> mb<br>
> > = MemoryBuffer::getFileOrSTDIN(path);<br>
> > if (std::error_code ec = mb.getError())<br>
> > return makeErrorFile(path, ec);<br>
> > std::vector<std::unique_ptr<File>> files;<br>
> > - if (std::error_code ec = ctx.registry().parseFile(std::move(mb.get()), files))<br>
> > + if (std::error_code ec = ctx.registry().loadFile(std::move(mb.get()), files))<br>
> > return makeErrorFile(path, ec);<br>
> > if (wholeArchive)<br>
> > return parseMemberFiles(files);<br>
> ><br>
> > Modified: lld/trunk/lib/Driver/GnuLdDriver.cpp<br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/GnuLdDriver.cpp?rev=225764&r1=225763&r2=225764&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/GnuLdDriver.cpp?rev=225764&r1=225763&r2=225764&view=diff</a><br>
> > ==============================================================================<br>
> > --- lld/trunk/lib/Driver/GnuLdDriver.cpp (original)<br>
> > +++ lld/trunk/lib/Driver/GnuLdDriver.cpp Mon Jan 12 22:33:07 2015<br>
> > @@ -14,7 +14,8 @@<br>
> > //===----------------------------------------------------------------------===//<br>
> ><br>
> > #include "lld/Driver/Driver.h"<br>
> > -#include "lld/Driver/GnuLdInputGraph.h"<br>
> > +#include "lld/Driver/WrapperInputGraph.h"<br>
> > +#include "lld/ReaderWriter/ELFLinkingContext.h"<br>
> > #include "lld/ReaderWriter/LinkerScript.h"<br>
> > #include "llvm/ADT/ArrayRef.h"<br>
> > #include "llvm/ADT/Optional.h"<br>
> > @@ -172,16 +173,6 @@ bool GnuLdDriver::linkELF(int argc, cons<br>
> > return false;<br>
> > if (!options)<br>
> > return true;<br>
> > -<br>
> > - // Register possible input file parsers.<br>
> > - options->registry().addSupportELFObjects(options->mergeCommonStrings(),<br>
> > - options->targetHandler());<br>
> > - options->registry().addSupportArchives(options->logInputFiles());<br>
> > - options->registry().addSupportYamlFiles();<br>
> > - options->registry().addSupportNativeObjects();<br>
> > - if (options->allowLinkWithDynamicLibraries())<br>
> > - options->registry().addSupportELFDynamicSharedObjects(<br>
> > - options->useShlibUndefines(), options->targetHandler());<br>
> > return link(*options, diagnostics);<br>
> > }<br>
> ><br>
> > @@ -218,6 +209,23 @@ static bool isLinkerScript(StringRef pat<br>
> > return magic == llvm::sys::fs::file_magic::unknown;<br>
> > }<br>
> ><br>
> > +static ErrorOr<StringRef><br>
> > +findFile(ELFLinkingContext &ctx, StringRef path, bool dashL) {<br>
> > + // If the path was referred to by using a -l argument, let's search<br>
> > + // for the file in the search path.<br>
> > + if (dashL) {<br>
> > + ErrorOr<StringRef> pathOrErr = ctx.searchLibrary(path);<br>
> > + if (std::error_code ec = pathOrErr.getError())<br>
> > + return make_dynamic_error_code(<br>
> > + Twine("Unable to find library -l") + path + ": " + ec.message());<br>
> > + path = pathOrErr->str();<br>
> > + }<br>
> > + if (!llvm::sys::fs::exists(path))<br>
> > + return make_dynamic_error_code(<br>
> > + Twine("lld: cannot find file ") + path);<br>
> > + return path;<br>
> > +}<br>
> > +<br>
> > static bool isPathUnderSysroot(StringRef sysroot, StringRef path) {<br>
> > if (sysroot.empty())<br>
> > return false;<br>
> > @@ -234,8 +242,6 @@ evaluateLinkerScript(ELFLinkingContext &<br>
> > MemoryBuffer::getFileOrSTDIN(path);<br>
> > if (std::error_code ec = mb.getError())<br>
> > return ec;<br>
> > - if (ctx.logInputFiles())<br>
> > - diag << path << "\n";<br>
> > auto lexer = llvm::make_unique<script::Lexer>(std::move(mb.get()));<br>
> > auto parser = llvm::make_unique<script::Parser>(*lexer);<br>
> > script::LinkerScript *script = parser->parse();<br>
> > @@ -253,13 +259,26 @@ evaluateLinkerScript(ELFLinkingContext &<br>
> > int numfiles = 0;<br>
> > for (const script::Path &path : group->getPaths()) {<br>
> > // TODO : Propagate Set WholeArchive/dashlPrefix<br>
> > - ELFFileNode::Attributes attr;<br>
> > + ELFLinkingContext::Attributes attr;<br>
> > attr.setSysRooted(sysroot);<br>
> > attr.setAsNeeded(path._asNeeded);<br>
> > attr.setDashlPrefix(path._isDashlPrefix);<br>
> > - ++numfiles;<br>
> > - inputGraph->addInputElement(llvm::make_unique<ELFFileNode>(<br>
> > - ctx, ctx.allocateString(path._path), attr));<br>
> > +<br>
> > + ErrorOr<StringRef> pathOrErr = path._isDashlPrefix<br>
> > + ? ctx.searchLibrary(path._path) : ctx.searchFile(path._path, sysroot);<br>
> > + if (std::error_code ec = pathOrErr.getError())<br>
> > + return make_dynamic_error_code(<br>
> > + Twine("Unable to find file ") + path._path + ": " + ec.message());<br>
> > +<br>
> > + std::vector<std::unique_ptr<File>> files<br>
> > + = loadFile(ctx, pathOrErr.get(), false);<br>
> > + for (std::unique_ptr<File> &file : files) {<br>
> > + if (ctx.logInputFiles())<br>
> > + diag << file->path() << "\n";<br>
> > + inputGraph->addInputElement(<br>
> > + std::unique_ptr<InputElement>(new WrapperNode(std::move(file))));<br>
> > + ++numfiles;<br>
> > + }<br>
> > }<br>
> > inputGraph->addInputElement(llvm::make_unique<GroupEnd>(numfiles));<br>
> > }<br>
> > @@ -341,7 +360,7 @@ bool GnuLdDriver::parse(int argc, const<br>
> > std::stack<int> groupStack;<br>
> > int numfiles = 0;<br>
> ><br>
> > - ELFFileNode::Attributes attributes;<br>
> > + ELFLinkingContext::Attributes attributes;<br>
> ><br>
> > bool _outputOptionSet = false;<br>
> ><br>
> > @@ -379,7 +398,6 @@ bool GnuLdDriver::parse(int argc, const<br>
> > ctx->setPrintRemainingUndefines(false);<br>
> > ctx->setAllowRemainingUndefines(true);<br>
> > break;<br>
> > -<br>
> > case OPT_static:<br>
> > ctx->setOutputELFType(llvm::ELF::ET_EXEC);<br>
> > ctx->setIsStaticExecutable(true);<br>
> > @@ -415,6 +433,37 @@ bool GnuLdDriver::parse(int argc, const<br>
> > }<br>
> > }<br>
> ><br>
> > + for (auto inputArg : *parsedArgs) {<br>
> > + switch (inputArg->getOption().getID()) {<br>
> > + case OPT_merge_strings:<br>
> > + ctx->setMergeCommonStrings(true);<br>
> > + break;<br>
> > + case OPT_t:<br>
> > + ctx->setLogInputFiles(true);<br>
> > + break;<br>
> > + case OPT_use_shlib_undefs:<br>
> > + ctx->setUseShlibUndefines(true);<br>
> > + break;<br>
> > + case OPT_no_allow_shlib_undefs:<br>
> > + ctx->setAllowShlibUndefines(false);<br>
> > + break;<br>
> > + case OPT_allow_shlib_undefs:<br>
> > + ctx->setAllowShlibUndefines(true);<br>
> > + break;<br>
> > + }<br>
> > + }<br>
> > +<br>
> > + // Register possible input file parsers.<br>
> > + ctx->registry().addSupportELFObjects(<br>
> > + ctx->mergeCommonStrings(),<br>
> > + ctx->targetHandler());<br>
> > + ctx->registry().addSupportArchives(ctx->logInputFiles());<br>
> > + ctx->registry().addSupportYamlFiles();<br>
> > + ctx->registry().addSupportNativeObjects();<br>
> > + if (ctx->allowLinkWithDynamicLibraries())<br>
> > + ctx->registry().addSupportELFDynamicSharedObjects(<br>
> > + ctx->useShlibUndefines(), ctx->targetHandler());<br>
> > +<br>
> > // Process all the arguments and create Input Elements<br>
> > for (auto inputArg : *parsedArgs) {<br>
> > switch (inputArg->getOption().getID()) {<br>
> > @@ -438,26 +487,6 @@ bool GnuLdDriver::parse(int argc, const<br>
> > ctx->setExportDynamic(true);<br>
> > break;<br>
> ><br>
> > - case OPT_merge_strings:<br>
> > - ctx->setMergeCommonStrings(true);<br>
> > - break;<br>
> > -<br>
> > - case OPT_t:<br>
> > - ctx->setLogInputFiles(true);<br>
> > - break;<br>
> > -<br>
> > - case OPT_no_allow_shlib_undefs:<br>
> > - ctx->setAllowShlibUndefines(false);<br>
> > - break;<br>
> > -<br>
> > - case OPT_allow_shlib_undefs:<br>
> > - ctx->setAllowShlibUndefines(true);<br>
> > - break;<br>
> > -<br>
> > - case OPT_use_shlib_undefs:<br>
> > - ctx->setUseShlibUndefines(true);<br>
> > - break;<br>
> > -<br>
> > case OPT_allow_multiple_definition:<br>
> > ctx->setAllowDuplicates(true);<br>
> > break;<br>
> > @@ -560,25 +589,19 @@ bool GnuLdDriver::parse(int argc, const<br>
> > bool dashL = (inputArg->getOption().getID() == OPT_l);<br>
> > attributes.setDashlPrefix(dashL);<br>
> > StringRef path = inputArg->getValue();<br>
> > - std::string realpath = path;<br>
> ><br>
> > - // If the path was referred to by using a -l argument, let's search<br>
> > - // for the file in the search path.<br>
> > - if (dashL) {<br>
> > - ErrorOr<StringRef> pathOrErr = ctx->searchLibrary(path);<br>
> > - if (!pathOrErr) {<br>
> > - diagnostics << " Unable to find library -l" << path << "\n";<br>
> > - return false;<br>
> > - }<br>
> > - realpath = pathOrErr->str();<br>
> > - }<br>
> > - if (!llvm::sys::fs::exists(realpath)) {<br>
> > - diagnostics << "lld: cannot find file " << path << "\n";<br>
> > + ErrorOr<StringRef> pathOrErr = findFile(*ctx, path, dashL);<br>
> > + if (std::error_code ec = pathOrErr.getError()) {<br>
> > + diagnostics << ec.message() << "\n";<br>
> > return false;<br>
> > }<br>
> > + std::string realpath = pathOrErr.get();<br>
> > +<br>
> > bool isScript =<br>
> > (!path.endswith(".objtxt") && isLinkerScript(realpath, diagnostics));<br>
> > if (isScript) {<br>
> > + if (ctx->logInputFiles())<br>
> > + diagnostics << path << "\n";<br>
> > std::error_code ec = evaluateLinkerScript(<br>
> > *ctx, inputGraph.get(), realpath, diagnostics);<br>
> > if (ec) {<br>
> > @@ -588,9 +611,15 @@ bool GnuLdDriver::parse(int argc, const<br>
> > }<br>
> > break;<br>
> > }<br>
> > - ++numfiles;<br>
> > - inputGraph->addInputElement(<br>
> > - llvm::make_unique<ELFFileNode>(*ctx, path, attributes));<br>
> > + std::vector<std::unique_ptr<File>> files<br>
> > + = loadFile(*ctx, realpath, attributes._isWholeArchive);<br>
> > + for (std::unique_ptr<File> &file : files) {<br>
> > + if (ctx->logInputFiles())<br>
> > + diagnostics << file->path() << "\n";<br>
> > + inputGraph->addInputElement(<br>
> > + std::unique_ptr<InputElement>(new WrapperNode(std::move(file))));<br>
> > + }<br>
> > + numfiles += files.size();<br>
> > break;<br>
> > }<br>
> ><br>
> ><br>
> > Removed: lld/trunk/lib/Driver/GnuLdInputGraph.cpp<br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/GnuLdInputGraph.cpp?rev=225763&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/GnuLdInputGraph.cpp?rev=225763&view=auto</a><br>
> > ==============================================================================<br>
> > --- lld/trunk/lib/Driver/GnuLdInputGraph.cpp (original)<br>
> > +++ lld/trunk/lib/Driver/GnuLdInputGraph.cpp (removed)<br>
> > @@ -1,65 +0,0 @@<br>
> > -//===- lib/Driver/GnuLdInputGraph.cpp -------------------------------------===//<br>
> > -//<br>
> > -// The LLVM Linker<br>
> > -//<br>
> > -// This file is distributed under the University of Illinois Open Source<br>
> > -// License. See LICENSE.TXT for details.<br>
> > -//<br>
> > -//===----------------------------------------------------------------------===//<br>
> > -<br>
> > -#include "lld/Driver/GnuLdInputGraph.h"<br>
> > -#include "lld/ReaderWriter/LinkerScript.h"<br>
> > -#include "llvm/Support/Errc.h"<br>
> > -#include "llvm/Support/FileSystem.h"<br>
> > -#include "llvm/Support/Path.h"<br>
> > -<br>
> > -using namespace lld;<br>
> > -<br>
> > -llvm::ErrorOr<StringRef> ELFFileNode::getPath(const LinkingContext &) const {<br>
> > - if (_attributes._isDashlPrefix)<br>
> > - return _elfLinkingContext.searchLibrary(_path);<br>
> > - return _elfLinkingContext.searchFile(_path, _attributes._isSysRooted);<br>
> > -}<br>
> > -<br>
> > -std::string ELFFileNode::errStr(std::error_code errc) {<br>
> > - if (errc == llvm::errc::no_such_file_or_directory) {<br>
> > - if (_attributes._isDashlPrefix)<br>
> > - return (Twine("Unable to find library -l") + _path).str();<br>
> > - return (Twine("Unable to find file ") + _path).str();<br>
> > - }<br>
> > - return FileNode::errStr(errc);<br>
> > -}<br>
> > -<br>
> > -/// \brief Parse the input file to lld::File.<br>
> > -std::error_code ELFFileNode::parse(const LinkingContext &ctx,<br>
> > - raw_ostream &diagnostics) {<br>
> > - ErrorOr<StringRef> filePath = getPath(ctx);<br>
> > - if (std::error_code ec = filePath.getError())<br>
> > - return ec;<br>
> > - ErrorOr<std::unique_ptr<MemoryBuffer>> mb =<br>
> > - MemoryBuffer::getFileOrSTDIN(*filePath);<br>
> > - if (std::error_code ec = mb.getError())<br>
> > - return ec;<br>
> > - if (ctx.logInputFiles())<br>
> > - diagnostics << *filePath << "\n";<br>
> > -<br>
> > - if (_attributes._isWholeArchive) {<br>
> > - std::vector<std::unique_ptr<File>> parsedFiles;<br>
> > - if (std::error_code ec = ctx.registry().parseFile(<br>
> > - std::move(mb.get()), parsedFiles))<br>
> > - return ec;<br>
> > - assert(parsedFiles.size() == 1);<br>
> > - std::unique_ptr<File> f(parsedFiles[0].release());<br>
> > - if (const auto *archive = dyn_cast<ArchiveLibraryFile>(f.get())) {<br>
> > - // Have this node own the FileArchive object.<br>
> > - _archiveFile.reset(archive);<br>
> > - f.release();<br>
> > - // Add all members to _files vector<br>
> > - return archive->parseAllMembers(_files);<br>
> > - }<br>
> > - // if --whole-archive is around non-archive, just use it as normal.<br>
> > - _files.push_back(std::move(f));<br>
> > - return std::error_code();<br>
> > - }<br>
> > - return ctx.registry().parseFile(std::move(mb.get()), _files);<br>
> > -}<br>
> ><br>
> > Modified: lld/trunk/lib/Driver/WinLinkDriver.cpp<br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkDriver.cpp?rev=225764&r1=225763&r2=225764&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkDriver.cpp?rev=225764&r1=225763&r2=225764&view=diff</a><br>
> > ==============================================================================<br>
> > --- lld/trunk/lib/Driver/WinLinkDriver.cpp (original)<br>
> > +++ lld/trunk/lib/Driver/WinLinkDriver.cpp Mon Jan 12 22:33:07 2015<br>
> > @@ -14,8 +14,8 @@<br>
> > //===----------------------------------------------------------------------===//<br>
> ><br>
> > #include "lld/Driver/Driver.h"<br>
> > -#include "lld/Driver/WinLinkInputGraph.h"<br>
> > #include "lld/Driver/WinLinkModuleDef.h"<br>
> > +#include "lld/Driver/WrapperInputGraph.h"<br>
> > #include "lld/ReaderWriter/PECOFFLinkingContext.h"<br>
> > #include "llvm/ADT/ArrayRef.h"<br>
> > #include "llvm/ADT/Optional.h"<br>
> > @@ -800,13 +800,11 @@ parseArgs(int argc, const char **argv, P<br>
> ><br>
> > // Returns true if the given file node has already been added to the input<br>
> > // graph.<br>
> > -static bool hasLibrary(const PECOFFLinkingContext &ctx, FileNode *fileNode) {<br>
> > - ErrorOr<StringRef> path = fileNode->getPath(ctx);<br>
> > - if (!path)<br>
> > - return false;<br>
> > +static bool hasLibrary(const PECOFFLinkingContext &ctx, File *file) {<br>
> > + StringRef path = file->path();<br>
> > for (std::unique_ptr<InputElement> &p : ctx.getInputGraph().inputElements())<br>
> > if (auto *f = dyn_cast<FileNode>(p.get()))<br>
> > - if (*path == *f->getPath(ctx))<br>
> > + if (*f->getPath(ctx) == path)<br>
> > return true;<br>
> > return false;<br>
> > }<br>
> > @@ -838,6 +836,16 @@ static bool maybeRunLibCommand(int argc,<br>
> > return true;<br>
> > }<br>
> ><br>
> > +/// \brief Parse the input file to lld::File.<br>
> > +void addFiles(PECOFFLinkingContext &ctx, StringRef path, raw_ostream &diag,<br>
> > + std::vector<std::unique_ptr<File>> &files) {<br>
> > + for (std::unique_ptr<File> &file : loadFile(ctx, path, false)) {<br>
> > + if (ctx.logInputFiles())<br>
> > + diag << file->path() << "\n";<br>
> > + files.push_back(std::move(file));<br>
> > + }<br>
> > +}<br>
> > +<br>
> > //<br>
> > // Main driver<br>
> > //<br>
> > @@ -847,6 +855,12 @@ bool WinLinkDriver::linkPECOFF(int argc,<br>
> > return true;<br>
> ><br>
> > PECOFFLinkingContext ctx;<br>
> > + ctx.registry().addSupportCOFFObjects(ctx);<br>
> > + ctx.registry().addSupportCOFFImportLibraries(ctx);<br>
> > + ctx.registry().addSupportArchives(ctx.logInputFiles());<br>
> > + ctx.registry().addSupportNativeObjects();<br>
> > + ctx.registry().addSupportYamlFiles();<br>
> > +<br>
> > std::vector<const char *> newargv = processLinkEnv(ctx, argc, argv);<br>
> > processLibEnv(ctx);<br>
> > if (!parse(newargv.size() - 1, &newargv[0], ctx, diag))<br>
> > @@ -857,13 +871,6 @@ bool WinLinkDriver::linkPECOFF(int argc,<br>
> > if (!createSideBySideManifestFile(ctx, diag))<br>
> > return false;<br>
> ><br>
> > - // Register possible input file parsers.<br>
> > - ctx.registry().addSupportCOFFObjects(ctx);<br>
> > - ctx.registry().addSupportCOFFImportLibraries(ctx);<br>
> > - ctx.registry().addSupportArchives(ctx.logInputFiles());<br>
> > - ctx.registry().addSupportNativeObjects();<br>
> > - ctx.registry().addSupportYamlFiles();<br>
> > -<br>
> > return link(ctx, diag);<br>
> > }<br>
> ><br>
> > @@ -884,8 +891,8 @@ bool WinLinkDriver::parse(int argc, cons<br>
> > return false;<br>
> ><br>
> > // The list of input files.<br>
> > - std::vector<std::unique_ptr<FileNode> > files;<br>
> > - std::vector<std::unique_ptr<FileNode> > libraries;<br>
> > + std::vector<std::unique_ptr<File>> files;<br>
> > + std::vector<std::unique_ptr<File>> libraries;<br>
> ><br>
> > // Handle /help<br>
> > if (parsedArgs->getLastArg(OPT_help)) {<br>
> > @@ -1363,11 +1370,9 @@ bool WinLinkDriver::parse(int argc, cons<br>
> > for (StringRef path : inputFiles) {<br>
> > path = ctx.allocate(path);<br>
> > if (isLibraryFile(path)) {<br>
> > - libraries.push_back(std::unique_ptr<FileNode>(<br>
> > - new PECOFFFileNode(ctx, getLibraryPath(ctx, path))));<br>
> > + addFiles(ctx, getLibraryPath(ctx, path), diag, libraries);<br>
> > } else {<br>
> > - files.push_back(std::unique_ptr<FileNode>(<br>
> > - new PECOFFFileNode(ctx, getObjectPath(ctx, path))));<br>
> > + addFiles(ctx, getObjectPath(ctx, path), diag, files);<br>
> > }<br>
> > }<br>
> ><br>
> > @@ -1389,8 +1394,7 @@ bool WinLinkDriver::parse(int argc, cons<br>
> > if (!ctx.getNoDefaultLibAll())<br>
> > for (const StringRef path : defaultLibs)<br>
> > if (!ctx.hasNoDefaultLib(path))<br>
> > - libraries.push_back(std::unique_ptr<FileNode>(<br>
> > - new PECOFFFileNode(ctx, getLibraryPath(ctx, path.lower()))));<br>
> > + addFiles(ctx, getLibraryPath(ctx, path.lower()), diag, libraries);<br>
> ><br>
> > if (files.empty() && !isReadingDirectiveSection) {<br>
> > diag << "No input files\n";<br>
> > @@ -1401,18 +1405,19 @@ bool WinLinkDriver::parse(int argc, cons<br>
> > // constructed by replacing an extension of the first input file<br>
> > // with ".exe".<br>
> > if (ctx.outputPath().empty()) {<br>
> > - StringRef path = *cast<FileNode>(&*files[0])->getPath(ctx);<br>
> > + StringRef path = files[0]->path();<br>
> > ctx.setOutputPath(replaceExtension(ctx, path, ".exe"));<br>
> > }<br>
> ><br>
> > // Add the input files to the input graph.<br>
> > if (!ctx.hasInputGraph())<br>
> > ctx.setInputGraph(std::unique_ptr<InputGraph>(new InputGraph()));<br>
> > - for (std::unique_ptr<FileNode> &file : files) {<br>
> > + for (std::unique_ptr<File> &file : files) {<br>
> > if (isReadingDirectiveSection)<br>
> > - if (file->parse(ctx, diag))<br>
> > + if (file->parse())<br>
> > return false;<br>
> > - ctx.getInputGraph().addInputElement(std::move(file));<br>
> > + ctx.getInputGraph().addInputElement(<br>
> > + std::unique_ptr<InputElement>(new WrapperNode(std::move(file))));<br>
> > }<br>
> ><br>
> > // Add the library group to the input graph.<br>
> > @@ -1427,12 +1432,13 @@ bool WinLinkDriver::parse(int argc, cons<br>
> > }<br>
> ><br>
> > // Add the library files to the library group.<br>
> > - for (std::unique_ptr<FileNode> &lib : libraries) {<br>
> > - if (!hasLibrary(ctx, lib.get())) {<br>
> > + for (std::unique_ptr<File> &file : libraries) {<br>
> > + if (!hasLibrary(ctx, file.get())) {<br>
> > if (isReadingDirectiveSection)<br>
> > - if (lib->parse(ctx, diag))<br>
> > + if (file->parse())<br>
> > return false;<br>
> > - ctx.addLibraryFile(std::move(lib));<br>
> > + ctx.addLibraryFile(<br>
> > + std::unique_ptr<FileNode>(new WrapperNode(std::move(file))));<br>
> > }<br>
> > }<br>
> ><br>
> ><br>
> > Removed: lld/trunk/lib/Driver/WinLinkInputGraph.cpp<br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkInputGraph.cpp?rev=225763&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkInputGraph.cpp?rev=225763&view=auto</a><br>
> > ==============================================================================<br>
> > --- lld/trunk/lib/Driver/WinLinkInputGraph.cpp (original)<br>
> > +++ lld/trunk/lib/Driver/WinLinkInputGraph.cpp (removed)<br>
> > @@ -1,39 +0,0 @@<br>
> > -//===- lib/Driver/WinLinkInputGraph.cpp -----------------------------------===//<br>
> > -//<br>
> > -// The LLVM Linker<br>
> > -//<br>
> > -// This file is distributed under the University of Illinois Open Source<br>
> > -// License. See LICENSE.TXT for details.<br>
> > -//<br>
> > -//===----------------------------------------------------------------------===//<br>
> > -<br>
> > -#include "lld/Driver/WinLinkInputGraph.h"<br>
> > -<br>
> > -namespace lld {<br>
> > -<br>
> > -/// \brief Parse the input file to lld::File.<br>
> > -std::error_code PECOFFFileNode::parse(const LinkingContext &ctx,<br>
> > - raw_ostream &diagnostics) {<br>
> > - if (_parsed)<br>
> > - return std::error_code();<br>
> > - _parsed = true;<br>
> > - ErrorOr<StringRef> filePath = getPath(ctx);<br>
> > - if (std::error_code ec = filePath.getError()) {<br>
> > - diagnostics << "File not found: " << _path << "\n";<br>
> > - return ec;<br>
> > - }<br>
> > -<br>
> > - ErrorOr<std::unique_ptr<MemoryBuffer>> mb =<br>
> > - MemoryBuffer::getFileOrSTDIN(*filePath);<br>
> > - if (std::error_code ec = mb.getError()) {<br>
> > - diagnostics << "Cannot open file: " << *filePath << "\n";<br>
> > - return ec;<br>
> > - }<br>
> > -<br>
> > - if (ctx.logInputFiles())<br>
> > - diagnostics << *filePath << "\n";<br>
> > -<br>
> > - return ctx.registry().parseFile(std::move(mb.get()), _files);<br>
> > -}<br>
> > -<br>
> > -} // end anonymous namespace<br>
> ><br>
> > Modified: lld/trunk/lib/Passes/RoundTripNativePass.cpp<br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Passes/RoundTripNativePass.cpp?rev=225764&r1=225763&r2=225764&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Passes/RoundTripNativePass.cpp?rev=225764&r1=225763&r2=225764&view=diff</a><br>
> > ==============================================================================<br>
> > --- lld/trunk/lib/Passes/RoundTripNativePass.cpp (original)<br>
> > +++ lld/trunk/lib/Passes/RoundTripNativePass.cpp Mon Jan 12 22:33:07 2015<br>
> > @@ -40,13 +40,15 @@ void RoundTripNativePass::perform(std::u<br>
> > if (!mb)<br>
> > return;<br>
> ><br>
> > - std::error_code ec = _context.registry().parseFile(<br>
> > + std::error_code ec = _context.registry().loadFile(<br>
> > std::move(mb.get()), _nativeFile);<br>
> > if (ec) {<br>
> > // Note: we need a way for Passes to report errors.<br>
> > llvm_unreachable("native reader not registered or read error");<br>
> > }<br>
> > File *objFile = _nativeFile[0].get();<br>
> > + if (objFile->parse())<br>
> > + llvm_unreachable("native reader parse error");<br>
> > mergedFile.reset(new SimpleFileWrapper(_context, *objFile));<br>
> ><br>
> > llvm::sys::fs::remove(tmpNativeFile.str());<br>
> ><br>
> > Modified: lld/trunk/lib/Passes/RoundTripYAMLPass.cpp<br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Passes/RoundTripYAMLPass.cpp?rev=225764&r1=225763&r2=225764&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Passes/RoundTripYAMLPass.cpp?rev=225764&r1=225763&r2=225764&view=diff</a><br>
> > ==============================================================================<br>
> > --- lld/trunk/lib/Passes/RoundTripYAMLPass.cpp (original)<br>
> > +++ lld/trunk/lib/Passes/RoundTripYAMLPass.cpp Mon Jan 12 22:33:07 2015<br>
> > @@ -40,13 +40,15 @@ void RoundTripYAMLPass::perform(std::uni<br>
> > if (!mb)<br>
> > return;<br>
> ><br>
> > - std::error_code ec = _context.registry().parseFile(<br>
> > + std::error_code ec = _context.registry().loadFile(<br>
> > std::move(mb.get()), _yamlFile);<br>
> > if (ec) {<br>
> > // Note: we need a way for Passes to report errors.<br>
> > llvm_unreachable("yaml reader not registered or read error");<br>
> > }<br>
> > File *objFile = _yamlFile[0].get();<br>
> > + if (objFile->parse())<br>
> > + llvm_unreachable("native reader parse error");<br>
> > mergedFile.reset(new SimpleFileWrapper(_context, *objFile));<br>
> > llvm::sys::fs::remove(tmpYAMLFile.str());<br>
> > }<br>
> ><br>
> > Modified: lld/trunk/lib/ReaderWriter/ELF/ELFReader.h<br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ELFReader.h?rev=225764&r1=225763&r2=225764&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ELFReader.h?rev=225764&r1=225763&r2=225764&view=diff</a><br>
> > ==============================================================================<br>
> > --- lld/trunk/lib/ReaderWriter/ELF/ELFReader.h (original)<br>
> > +++ lld/trunk/lib/ReaderWriter/ELF/ELFReader.h Mon Jan 12 22:33:07 2015<br>
> > @@ -33,8 +33,8 @@ public:<br>
> > }<br>
> ><br>
> > std::error_code<br>
> > - parseFile(std::unique_ptr<MemoryBuffer> mb, const class Registry &,<br>
> > - std::vector<std::unique_ptr<File>> &result) const override {<br>
> > + loadFile(std::unique_ptr<MemoryBuffer> mb, const class Registry &,<br>
> > + std::vector<std::unique_ptr<File>> &result) const override {<br>
> > std::size_t maxAlignment =<br>
> > 1ULL << llvm::countTrailingZeros(uintptr_t(mb->getBufferStart()));<br>
> > auto f =<br>
> > @@ -72,8 +72,8 @@ public:<br>
> > }<br>
> ><br>
> > std::error_code<br>
> > - parseFile(std::unique_ptr<MemoryBuffer> mb, const class Registry &,<br>
> > - std::vector<std::unique_ptr<File>> &result) const override {<br>
> > + loadFile(std::unique_ptr<MemoryBuffer> mb, const class Registry &,<br>
> > + std::vector<std::unique_ptr<File>> &result) const override {<br>
> > std::size_t maxAlignment =<br>
> > 1ULL << llvm::countTrailingZeros(uintptr_t(mb->getBufferStart()));<br>
> > auto f =<br>
> ><br>
> > Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFReader.h<br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFReader.h?rev=225764&r1=225763&r2=225764&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFReader.h?rev=225764&r1=225763&r2=225764&view=diff</a><br>
> > ==============================================================================<br>
> > --- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFReader.h (original)<br>
> > +++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFReader.h Mon Jan 12 22:33:07 2015<br>
> > @@ -49,12 +49,12 @@ public:<br>
> > _flagMerger(flagMerger) {}<br>
> ><br>
> > std::error_code<br>
> > - parseFile(std::unique_ptr<MemoryBuffer> mb, const Registry ®istry,<br>
> > - std::vector<std::unique_ptr<File>> &result) const override {<br>
> > + loadFile(std::unique_ptr<MemoryBuffer> mb, const Registry ®istry,<br>
> > + std::vector<std::unique_ptr<File>> &result) const override {<br>
> > auto &hdr = *elfHeader(*mb);<br>
> > if (std::error_code ec = _flagMerger.merge(hdr.getFileClass(), hdr.e_flags))<br>
> > return ec;<br>
> > - return BaseReaderType::parseFile(std::move(mb), registry, result);<br>
> > + return BaseReaderType::loadFile(std::move(mb), registry, result);<br>
> > }<br>
> ><br>
> > private:<br>
> > @@ -72,12 +72,12 @@ public:<br>
> > _flagMerger(flagMerger) {}<br>
> ><br>
> > std::error_code<br>
> > - parseFile(std::unique_ptr<MemoryBuffer> mb, const Registry ®istry,<br>
> > - std::vector<std::unique_ptr<File>> &result) const override {<br>
> > + loadFile(std::unique_ptr<MemoryBuffer> mb, const Registry ®istry,<br>
> > + std::vector<std::unique_ptr<File>> &result) const override {<br>
> > auto &hdr = *elfHeader(*mb);<br>
> > if (std::error_code ec = _flagMerger.merge(hdr.getFileClass(), hdr.e_flags))<br>
> > return ec;<br>
> > - return BaseReaderType::parseFile(std::move(mb), registry, result);<br>
> > + return BaseReaderType::loadFile(std::move(mb), registry, result);<br>
> > }<br>
> ><br>
> > private:<br>
> ><br>
> > Modified: lld/trunk/lib/ReaderWriter/FileArchive.cpp<br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/FileArchive.cpp?rev=225764&r1=225763&r2=225764&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/FileArchive.cpp?rev=225764&r1=225763&r2=225764&view=diff</a><br>
> > ==============================================================================<br>
> > --- lld/trunk/lib/ReaderWriter/FileArchive.cpp (original)<br>
> > +++ lld/trunk/lib/ReaderWriter/FileArchive.cpp Mon Jan 12 22:33:07 2015<br>
> > @@ -67,7 +67,9 @@ public:<br>
> ><br>
> > /// \brief parse each member<br>
> > std::error_code<br>
> > - parseAllMembers(std::vector<std::unique_ptr<File>> &result) const override {<br>
> > + parseAllMembers(std::vector<std::unique_ptr<File>> &result) override {<br>
> > + if (std::error_code ec = parse())<br>
> > + return ec;<br>
> > for (auto mf = _archive->child_begin(), me = _archive->child_end();<br>
> > mf != me; ++mf) {<br>
> > std::unique_ptr<File> file;<br>
> > @@ -152,9 +154,12 @@ private:<br>
> > mb.getBuffer(), memberPath, false));<br>
> ><br>
> > std::vector<std::unique_ptr<File>> files;<br>
> > - _registry.parseFile(std::move(memberMB), files);<br>
> > + if (std::error_code ec = _registry.loadFile(std::move(memberMB), files))<br>
> > + return ec;<br>
> > assert(files.size() == 1);<br>
> > result = std::move(files[0]);<br>
> > + if (std::error_code ec = result->parse())<br>
> > + return ec;<br>
> ><br>
> > // The memory buffer is co-owned by the archive file and the children,<br>
> > // so that the bufffer is deallocated when all the members are destructed.<br>
> > @@ -232,8 +237,8 @@ public:<br>
> > }<br>
> ><br>
> > std::error_code<br>
> > - parseFile(std::unique_ptr<MemoryBuffer> mb, const Registry ®,<br>
> > - std::vector<std::unique_ptr<File>> &result) const override {<br>
> > + loadFile(std::unique_ptr<MemoryBuffer> mb, const Registry ®,<br>
> > + std::vector<std::unique_ptr<File>> &result) const override {<br>
> > StringRef path = mb->getBufferIdentifier();<br>
> > std::unique_ptr<FileArchive> file(<br>
> > new FileArchive(std::move(mb), reg, path, _logLoading));<br>
> ><br>
> > Modified: lld/trunk/lib/ReaderWriter/MachO/ExecutableAtoms.hpp<br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/ExecutableAtoms.hpp?rev=225764&r1=225763&r2=225764&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/ExecutableAtoms.hpp?rev=225764&r1=225763&r2=225764&view=diff</a><br>
> > ==============================================================================<br>
> > --- lld/trunk/lib/ReaderWriter/MachO/ExecutableAtoms.hpp (original)<br>
> > +++ lld/trunk/lib/ReaderWriter/MachO/ExecutableAtoms.hpp Mon Jan 12 22:33:07 2015<br>
> > @@ -91,7 +91,7 @@ public:<br>
> > }<br>
> ><br>
> > std::error_code<br>
> > - parseAllMembers(std::vector<std::unique_ptr<File>> &result) const override {<br>
> > + parseAllMembers(std::vector<std::unique_ptr<File>> &result) override {<br>
> > return std::error_code();<br>
> > }<br>
> ><br>
> ><br>
> > Modified: lld/trunk/lib/ReaderWriter/MachO/MachOLinkingContext.cpp<br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/MachOLinkingContext.cpp?rev=225764&r1=225763&r2=225764&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/MachOLinkingContext.cpp?rev=225764&r1=225763&r2=225764&view=diff</a><br>
> > ==============================================================================<br>
> > --- lld/trunk/lib/ReaderWriter/MachO/MachOLinkingContext.cpp (original)<br>
> > +++ lld/trunk/lib/ReaderWriter/MachO/MachOLinkingContext.cpp Mon Jan 12 22:33:07 2015<br>
> > @@ -12,8 +12,8 @@<br>
> > #include "File.h"<br>
> > #include "MachONormalizedFile.h"<br>
> > #include "MachOPasses.h"<br>
> > +#include "lld/Core/ArchiveLibraryFile.h"<br>
> > #include "lld/Core/PassManager.h"<br>
> > -#include "lld/Driver/DarwinInputGraph.h"<br>
> > #include "lld/Passes/LayoutPass.h"<br>
> > #include "lld/Passes/RoundTripYAMLPass.h"<br>
> > #include "lld/ReaderWriter/Reader.h"<br>
> > @@ -605,20 +605,18 @@ Writer &MachOLinkingContext::writer() co<br>
> > }<br>
> ><br>
> > MachODylibFile* MachOLinkingContext::loadIndirectDylib(StringRef path) {<br>
> > - std::unique_ptr<MachOFileNode> node(new MachOFileNode(path, *this));<br>
> > - std::error_code ec = node->parse(*this, llvm::errs());<br>
> > - if (ec)<br>
> > + ErrorOr<std::unique_ptr<MemoryBuffer>> mbOrErr<br>
> > + = MemoryBuffer::getFileOrSTDIN(path);<br>
> > + if (mbOrErr.getError())<br>
> > return nullptr;<br>
> ><br>
> > - assert(node->files().size() == 1 && "expected one file in dylib");<br>
> > - // lld::File object is owned by MachOFileNode object. This method returns<br>
> > - // an unowned pointer to the lld::File object.<br>
> > - MachODylibFile* result = reinterpret_cast<MachODylibFile*>(<br>
> > - node->files().front().get());<br>
> > -<br>
> > + std::vector<std::unique_ptr<File>> files;<br>
> > + if (registry().loadFile(std::move(mbOrErr.get()), files))<br>
> > + return nullptr;<br>
> > + assert(files.size() == 1 && "expected one file in dylib");<br>
> > + MachODylibFile* result = reinterpret_cast<MachODylibFile*>(files[0].get());<br>
> > // Node object now owned by _indirectDylibs vector.<br>
> > - _indirectDylibs.push_back(std::move(node));<br>
> > -<br>
> > + _indirectDylibs.push_back(std::move(files[0]));<br>
> > return result;<br>
> > }<br>
> ><br>
> ><br>
> > Modified: lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp<br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp?rev=225764&r1=225763&r2=225764&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp?rev=225764&r1=225763&r2=225764&view=diff</a><br>
> > ==============================================================================<br>
> > --- lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp (original)<br>
> > +++ lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp Mon Jan 12 22:33:07 2015<br>
> > @@ -527,8 +527,8 @@ public:<br>
> > }<br>
> ><br>
> > std::error_code<br>
> > - parseFile(std::unique_ptr<MemoryBuffer> mb, const Registry ®istry,<br>
> > - std::vector<std::unique_ptr<File>> &result) const override {<br>
> > + loadFile(std::unique_ptr<MemoryBuffer> mb, const Registry ®istry,<br>
> > + std::vector<std::unique_ptr<File>> &result) const override {<br>
> > auto *file = new MachOFile(std::move(mb), &_ctx);<br>
> > result.push_back(std::unique_ptr<MachOFile>(file));<br>
> > return std::error_code();<br>
> > @@ -554,8 +554,8 @@ public:<br>
> > }<br>
> ><br>
> > std::error_code<br>
> > - parseFile(std::unique_ptr<MemoryBuffer> mb, const Registry ®istry,<br>
> > - std::vector<std::unique_ptr<File>> &result) const override {<br>
> > + loadFile(std::unique_ptr<MemoryBuffer> mb, const Registry ®istry,<br>
> > + std::vector<std::unique_ptr<File>> &result) const override {<br>
> > auto *file = new MachODylibFile(std::move(mb), &_ctx);<br>
> > result.push_back(std::unique_ptr<MachODylibFile>(file));<br>
> > return std::error_code();<br>
> > @@ -580,4 +580,3 @@ void Registry::addSupportMachOObjects(Ma<br>
> ><br>
> ><br>
> > } // namespace lld<br>
> > -<br>
> ><br>
> > Modified: lld/trunk/lib/ReaderWriter/Native/ReaderNative.cpp<br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/Native/ReaderNative.cpp?rev=225764&r1=225763&r2=225764&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/Native/ReaderNative.cpp?rev=225764&r1=225763&r2=225764&view=diff</a><br>
> > ==============================================================================<br>
> > --- lld/trunk/lib/ReaderWriter/Native/ReaderNative.cpp (original)<br>
> > +++ lld/trunk/lib/ReaderWriter/Native/ReaderNative.cpp Mon Jan 12 22:33:07 2015<br>
> > @@ -999,8 +999,8 @@ public:<br>
> > }<br>
> ><br>
> > virtual std::error_code<br>
> > - parseFile(std::unique_ptr<MemoryBuffer> mb, const class Registry &,<br>
> > - std::vector<std::unique_ptr<File>> &result) const override {<br>
> > + loadFile(std::unique_ptr<MemoryBuffer> mb, const class Registry &,<br>
> > + std::vector<std::unique_ptr<File>> &result) const override {<br>
> > auto *file = new lld::native::File(std::move(mb));<br>
> > result.push_back(std::unique_ptr<File>(file));<br>
> > return std::error_code();<br>
> ><br>
> > Modified: lld/trunk/lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h<br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h?rev=225764&r1=225763&r2=225764&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h?rev=225764&r1=225763&r2=225764&view=diff</a><br>
> > ==============================================================================<br>
> > --- lld/trunk/lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h (original)<br>
> > +++ lld/trunk/lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h Mon Jan 12 22:33:07 2015<br>
> > @@ -88,7 +88,7 @@ public:<br>
> > }<br>
> ><br>
> > std::error_code<br>
> > - parseAllMembers(std::vector<std::unique_ptr<File>> &result) const override {<br>
> > + parseAllMembers(std::vector<std::unique_ptr<File>> &result) override {<br>
> > return std::error_code();<br>
> > }<br>
> ><br>
> ><br>
> > Modified: lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp<br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp?rev=225764&r1=225763&r2=225764&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp?rev=225764&r1=225763&r2=225764&view=diff</a><br>
> > ==============================================================================<br>
> > --- lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp (original)<br>
> > +++ lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp Mon Jan 12 22:33:07 2015<br>
> > @@ -1077,8 +1077,8 @@ public:<br>
> > }<br>
> ><br>
> > std::error_code<br>
> > - parseFile(std::unique_ptr<MemoryBuffer> mb, const Registry &,<br>
> > - std::vector<std::unique_ptr<File>> &result) const override {<br>
> > + loadFile(std::unique_ptr<MemoryBuffer> mb, const Registry &,<br>
> > + std::vector<std::unique_ptr<File>> &result) const override {<br>
> > // Parse the memory buffer as PECOFF file.<br>
> > auto *file = new FileCOFF(std::move(mb), _ctx);<br>
> > result.push_back(std::unique_ptr<File>(file));<br>
> ><br>
> > Modified: lld/trunk/lib/ReaderWriter/PECOFF/ReaderImportHeader.cpp<br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/ReaderImportHeader.cpp?rev=225764&r1=225763&r2=225764&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/ReaderImportHeader.cpp?rev=225764&r1=225763&r2=225764&view=diff</a><br>
> > ==============================================================================<br>
> > --- lld/trunk/lib/ReaderWriter/PECOFF/ReaderImportHeader.cpp (original)<br>
> > +++ lld/trunk/lib/ReaderWriter/PECOFF/ReaderImportHeader.cpp Mon Jan 12 22:33:07 2015<br>
> > @@ -364,8 +364,8 @@ public:<br>
> > }<br>
> ><br>
> > std::error_code<br>
> > - parseFile(std::unique_ptr<MemoryBuffer> mb, const class Registry &,<br>
> > - std::vector<std::unique_ptr<File> > &result) const override {<br>
> > + loadFile(std::unique_ptr<MemoryBuffer> mb, const class Registry &,<br>
> > + std::vector<std::unique_ptr<File> > &result) const override {<br>
> > auto *file = new FileImportLibrary(std::move(mb), _machine);<br>
> > result.push_back(std::unique_ptr<File>(file));<br>
> > return std::error_code();<br>
> ><br>
> > Modified: lld/trunk/lib/ReaderWriter/Reader.cpp<br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/Reader.cpp?rev=225764&r1=225763&r2=225764&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/Reader.cpp?rev=225764&r1=225763&r2=225764&view=diff</a><br>
> > ==============================================================================<br>
> > --- lld/trunk/lib/ReaderWriter/Reader.cpp (original)<br>
> > +++ lld/trunk/lib/ReaderWriter/Reader.cpp Mon Jan 12 22:33:07 2015<br>
> > @@ -30,8 +30,8 @@ void Registry::add(std::unique_ptr<YamlI<br>
> > }<br>
> ><br>
> > std::error_code<br>
> > -Registry::parseFile(std::unique_ptr<MemoryBuffer> mb,<br>
> > - std::vector<std::unique_ptr<File>> &result) const {<br>
> > +Registry::loadFile(std::unique_ptr<MemoryBuffer> mb,<br>
> > + std::vector<std::unique_ptr<File>> &result) const {<br>
> > // Get file type.<br>
> > StringRef content(mb->getBufferStart(), mb->getBufferSize());<br>
> > llvm::sys::fs::file_magic fileType = llvm::sys::fs::identify_magic(content);<br>
> > @@ -42,11 +42,8 @@ Registry::parseFile(std::unique_ptr<Memo<br>
> > for (const std::unique_ptr<Reader> &reader : _readers) {<br>
> > if (!reader->canParse(fileType, extension, *mb))<br>
> > continue;<br>
> > - if (std::error_code ec = reader->parseFile(std::move(mb), *this, result))<br>
> > + if (std::error_code ec = reader->loadFile(std::move(mb), *this, result))<br>
> > return ec;<br>
> > - for (std::unique_ptr<File> &file : result)<br>
> > - if (std::error_code ec = file->parse())<br>
> > - return ec;<br>
> > return std::error_code();<br>
> > }<br>
> ><br>
> ><br>
> > Modified: lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp<br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp?rev=225764&r1=225763&r2=225764&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp?rev=225764&r1=225763&r2=225764&view=diff</a><br>
> > ==============================================================================<br>
> > --- lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp (original)<br>
> > +++ lld/trunk/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp Mon Jan 12 22:33:07 2015<br>
> > @@ -648,7 +648,7 @@ template <> struct MappingTraits<const l<br>
> > }<br>
> ><br>
> > virtual std::error_code<br>
> > - parseAllMembers(std::vector<std::unique_ptr<File>> &result) const override {<br>
> > + parseAllMembers(std::vector<std::unique_ptr<File>> &result) override {<br>
> > return std::error_code();<br>
> > }<br>
> ><br>
> > @@ -1325,8 +1325,8 @@ public:<br>
> > }<br>
> ><br>
> > std::error_code<br>
> > - parseFile(std::unique_ptr<MemoryBuffer> mb, const class Registry &,<br>
> > - std::vector<std::unique_ptr<File>> &result) const override {<br>
> > + loadFile(std::unique_ptr<MemoryBuffer> mb, const class Registry &,<br>
> > + std::vector<std::unique_ptr<File>> &result) const override {<br>
> > // Create YAML Input Reader.<br>
> > YamlContext yamlContext;<br>
> > yamlContext._registry = &_registry;<br>
> > @@ -1343,7 +1343,7 @@ public:<br>
> ><br>
> > std::shared_ptr<MemoryBuffer> smb(mb.release());<br>
> > for (const File *file : createdFiles) {<br>
> > - // Note: parseFile() should return vector of *const* File<br>
> > + // Note: loadFile() should return vector of *const* File<br>
> > File *f = const_cast<File *>(file);<br>
> > f->setLastError(std::error_code());<br>
> > f->setSharedMemoryBuffer(smb);<br>
> ><br>
> > Removed: lld/trunk/test/Driver/libsearch-inputGraph.test<br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/Driver/libsearch-inputGraph.test?rev=225763&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/test/Driver/libsearch-inputGraph.test?rev=225763&view=auto</a><br>
> > ==============================================================================<br>
> > --- lld/trunk/test/Driver/libsearch-inputGraph.test (original)<br>
> > +++ lld/trunk/test/Driver/libsearch-inputGraph.test (removed)<br>
> > @@ -1,39 +0,0 @@<br>
> > -RUN: lld -flavor gnu -target x86_64-linux -L%p/../elf/Inputs -lfnarchive \<br>
> > -RUN: --output-filetype=yaml --noinhibit-exec 2> %t.err<br>
> > -RUN: FileCheck %s < %t.err<br>
> > -<br>
> > -RUN: lld -flavor gnu -target x86_64-linux -L%p/../elf/Inputs --whole-archive \<br>
> > -RUN: -lfnarchive --output-filetype=yaml --noinhibit-exec 2> %t1.err<br>
> > -RUN: FileCheck %s -check-prefix="WHOLEARCHIVE" < %t1.err<br>
> > -<br>
> > -RUN: lld -flavor gnu -target x86_64-linux -L%p/../elf/Inputs --whole-archive \<br>
> > -RUN: --as-needed -lfnarchive --output-filetype=yaml --noinhibit-exec 2> %t2.err<br>
> > -RUN: FileCheck %s -check-prefix="ASNEEDED" < %t2.err<br>
> > -<br>
> > -RUN: lld -flavor gnu -target x86_64-linux --sysroot=%p/../elf -L=/Inputs \<br>
> > -RUN: -lfnarchive --output-filetype=yaml --noinhibit-exec 2> %t3.err<br>
> > -RUN: FileCheck -check-prefix="SYSROOT" %s < %t3.err<br>
> > -<br>
> > -CHECK: Name : {{[^ ]+}}elf/Inputs{{[\\/]}}libfnarchive.a<br>
> > -CHECK: Type : ELF File<br>
> > -CHECK: Attributes :<br>
> > -CHECK: - wholeArchive : false<br>
> > -CHECK: - asNeeded : false<br>
> > -<br>
> > -WHOLEARCHIVE: Name : {{[^ ]+}}elf/Inputs{{[\\/]}}libfnarchive.a<br>
> > -WHOLEARCHIVE: Type : ELF File<br>
> > -WHOLEARCHIVE: Attributes :<br>
> > -WHOLEARCHIVE: - wholeArchive : true<br>
> > -WHOLEARCHIVE: - asNeeded : false<br>
> > -<br>
> > -ASNEEDED: Name : {{[^ ]+}}elf/Inputs{{[\\/]}}libfnarchive.a<br>
> > -ASNEEDED: Type : ELF File<br>
> > -ASNEEDED: Attributes :<br>
> > -ASNEEDED: - wholeArchive : true<br>
> > -ASNEEDED: - asNeeded : true<br>
> > -<br>
> > -SYSROOT: Name : {{[^ ]+}}elf/Inputs{{[\\/]}}libfnarchive.a<br>
> > -SYSROOT: Type : ELF File<br>
> > -SYSROOT: Attributes :<br>
> > -SYSROOT: - wholeArchive : false<br>
> > -SYSROOT: - asNeeded : false<br>
> ><br>
> > Modified: lld/trunk/test/pecoff/hello64.test<br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/pecoff/hello64.test?rev=225764&r1=225763&r2=225764&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/test/pecoff/hello64.test?rev=225764&r1=225763&r2=225764&view=diff</a><br>
> > ==============================================================================<br>
> > --- lld/trunk/test/pecoff/hello64.test (original)<br>
> > +++ lld/trunk/test/pecoff/hello64.test Mon Jan 12 22:33:07 2015<br>
> > @@ -12,9 +12,9 @@ CHECK: 6019: 41 b9 00 00 00 00 mov<br>
> > CHECK: 601f: e8 0a 00 00 00 callq 10<br>
> > CHECK: 6024: b9 00 00 00 00 movl $0, %ecx<br>
> > CHECK: 6029: e8 08 00 00 00 callq 8<br>
> > -CHECK: 602e: ff 25 d4 cf ff ff jmpq *-12332(%rip)<br>
> > +CHECK: 602e: ff 25 d2 cf ff ff jmpq *-12334(%rip)<br>
> > CHECK: 6034: cc int3<br>
> > CHECK: 6035: cc int3<br>
> > -CHECK: 6036: ff 25 c4 cf ff ff jmpq *-12348(%rip)<br>
> > +CHECK: 6036: ff 25 c2 cf ff ff jmpq *-12350(%rip)<br>
> > CHECK: 603c: cc int3<br>
> > CHECK: 603d: cc int3<br>
> ><br>
> > Modified: lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp<br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp?rev=225764&r1=225763&r2=225764&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp?rev=225764&r1=225763&r2=225764&view=diff</a><br>
> > ==============================================================================<br>
> > --- lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp (original)<br>
> > +++ lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp Mon Jan 12 22:33:07 2015<br>
> > @@ -698,10 +698,9 @@ TEST_F(WinLinkParserTest, Ignore) {<br>
> > // compatibility with link.exe.<br>
> > EXPECT_TRUE(parse("link.exe", "/nologo", "/errorreport:prompt",<br>
> > "/incremental", "/incremental:no", "/delay:unload",<br>
> > - "/disallowlib:foo", "/pdbaltpath:bar", "/verbose",<br>
> > - "/verbose:icf", "/wx", "/wx:no", "/tlbid:1",<br>
> > - "/tlbout:foo", "/idlout:foo", "/ignore:4000",<br>
</div></div><div class="HOEnZb"><div class="h5">> > - "/ignoreidl", "/implib:foo", "/safeseh",<br>
> > + "/disallowlib:foo", "/pdbaltpath:bar",<br>
> > + "/wx", "/wx:no", "/tlbid:1", "/tlbout:foo", "/idlout:foo",<br>
> > + "/ignore:4000", "/ignoreidl", "/implib:foo", "/safeseh",<br>
> > "/safeseh:no", "/functionpadmin", "/maxilksize:1024",<br>
> > "a.obj", nullptr));<br>
> > EXPECT_EQ("", errorMessage());<br>
> ><br>
> ><br>
> > _______________________________________________<br>
> > llvm-commits mailing list<br>
> > <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> > <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br>
</div></div></blockquote></div><br></div>