[lld] r182784 - [lld][PECOFF] Add WinLinkDriver and PECOFFTargetInfo.

Rui Ueyama ruiu at google.com
Tue May 28 11:13:31 PDT 2013


Author: ruiu
Date: Tue May 28 13:13:31 2013
New Revision: 182784

URL: http://llvm.org/viewvc/llvm-project?rev=182784&view=rev
Log:
[lld][PECOFF] Add WinLinkDriver and PECOFFTargetInfo.

Add WinLinkDriver and connect it to the existing COFF reader. Remaining
parts are still stubs, so while it can now read a COFF file, it still
cannot link or output PE/COFF files yet.

Reviewers: Bigcheese

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D865

Added:
    lld/trunk/include/lld/ReaderWriter/PECOFFTargetInfo.h
    lld/trunk/lib/Driver/WinLinkDriver.cpp
    lld/trunk/lib/Driver/WinLinkOptions.td
    lld/trunk/lib/ReaderWriter/PECOFF/PECOFFTargetInfo.cpp
    lld/trunk/test/pecoff/
    lld/trunk/test/pecoff/Inputs/
    lld/trunk/test/pecoff/Inputs/nop.asm
    lld/trunk/test/pecoff/Inputs/nop.obj
    lld/trunk/test/pecoff/basic.test
Modified:
    lld/trunk/include/lld/Driver/Driver.h
    lld/trunk/include/lld/ReaderWriter/Reader.h
    lld/trunk/lib/Driver/CMakeLists.txt
    lld/trunk/lib/Driver/UniversalDriver.cpp
    lld/trunk/lib/ReaderWriter/PECOFF/CMakeLists.txt
    lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
    lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp

Modified: lld/trunk/include/lld/Driver/Driver.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Driver/Driver.h?rev=182784&r1=182783&r2=182784&view=diff
==============================================================================
--- lld/trunk/include/lld/Driver/Driver.h (original)
+++ lld/trunk/include/lld/Driver/Driver.h Tue May 28 13:13:31 2013
@@ -9,7 +9,7 @@
 ///
 /// \file
 ///
-/// Interface for Drivers which convert command line arguments into 
+/// Interface for Drivers which convert command line arguments into
 /// TargetInfo objects, then perform the link.
 ///
 //===----------------------------------------------------------------------===//
@@ -29,6 +29,7 @@ namespace lld {
 class TargetInfo;
 class CoreTargetInfo;
 class MachOTargetInfo;
+class PECOFFTargetInfo;
 class ELFTargetInfo;
 
 /// Base class for all Drivers.
@@ -39,7 +40,7 @@ protected:
   static bool link(const TargetInfo &targetInfo,
                    raw_ostream &diagnostics = llvm::errs());
 private:
-  Driver() LLVM_DELETED_FUNCTION; 
+  Driver() LLVM_DELETED_FUNCTION;
 };
 
 
@@ -52,7 +53,7 @@ public:
                    raw_ostream &diagnostics = llvm::errs());
 
 private:
-  UniversalDriver() LLVM_DELETED_FUNCTION; 
+  UniversalDriver() LLVM_DELETED_FUNCTION;
 };
 
 
@@ -66,13 +67,13 @@ public:
 
   /// Uses gnu/binutils style ld command line options to fill in options struct.
   /// Returns true iff there was an error.
-  static std::unique_ptr<ELFTargetInfo> parse(int argc, const char *argv[], 
+  static std::unique_ptr<ELFTargetInfo> parse(int argc, const char *argv[],
                                       raw_ostream &diagnostics = llvm::errs());
-  
+
 private:
   static llvm::Triple getDefaultTarget(const char *progName);
 
-  GnuLdDriver() LLVM_DELETED_FUNCTION; 
+  GnuLdDriver() LLVM_DELETED_FUNCTION;
 };
 
 
@@ -83,13 +84,31 @@ public:
   /// Returns true iff there was an error.
   static bool linkMachO(int argc, const char *argv[],
                         raw_ostream &diagnostics = llvm::errs());
-                        
+
   /// Uses darwin style ld command line options to update targetInfo object.
   /// Returns true iff there was an error.
-  static bool parse(int argc, const char *argv[], MachOTargetInfo &info, 
+  static bool parse(int argc, const char *argv[], MachOTargetInfo &info,
                     raw_ostream &diagnostics = llvm::errs());
 private:
-  DarwinLdDriver() LLVM_DELETED_FUNCTION; 
+  DarwinLdDriver() LLVM_DELETED_FUNCTION;
+};
+
+
+/// Driver for Windows 'link.exe' command line options
+class WinLinkDriver : public Driver {
+public:
+  /// Parses command line arguments same as Windows link.exe and performs link.
+  /// Returns true iff there was an error.
+  static bool linkPECOFF(int argc, const char *argv[],
+                         raw_ostream &diagnostics = llvm::errs());
+
+  /// Uses Windows style link command line options to fill in options struct.
+  /// Returns true iff there was an error.
+  static bool parse(int argc, const char *argv[], PECOFFTargetInfo &info,
+                    raw_ostream &diagnostics = llvm::errs());
+
+private:
+  WinLinkDriver() LLVM_DELETED_FUNCTION;
 };
 
 
@@ -100,15 +119,15 @@ public:
   /// Parses command line arguments same as lld-core and performs link.
   /// Returns true iff there was an error.
   static bool link(int argc, const char *argv[],
-                        raw_ostream &diagnostics = llvm::errs());
-  
+                   raw_ostream &diagnostics = llvm::errs());
+
   /// Uses lld-core command line options to fill in options struct.
   /// Returns true iff there was an error.
-  static bool parse(int argc, const char *argv[], CoreTargetInfo &info, 
+  static bool parse(int argc, const char *argv[], CoreTargetInfo &info,
                     raw_ostream &diagnostics = llvm::errs());
 
 private:
-  CoreDriver() LLVM_DELETED_FUNCTION; 
+  CoreDriver() LLVM_DELETED_FUNCTION;
 };
 
 

Added: lld/trunk/include/lld/ReaderWriter/PECOFFTargetInfo.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/PECOFFTargetInfo.h?rev=182784&view=auto
==============================================================================
--- lld/trunk/include/lld/ReaderWriter/PECOFFTargetInfo.h (added)
+++ lld/trunk/include/lld/ReaderWriter/PECOFFTargetInfo.h Tue May 28 13:13:31 2013
@@ -0,0 +1,44 @@
+//===- lld/ReaderWriter/PECOFFTargetInfo.h ---------------------------------===//
+//
+//                             The LLVM Linker
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLD_READER_WRITER_PECOFF_TARGET_INFO_H
+#define LLD_READER_WRITER_PECOFF_TARGET_INFO_H
+
+#include "lld/Core/TargetInfo.h"
+#include "lld/ReaderWriter/Reader.h"
+#include "lld/ReaderWriter/Writer.h"
+
+#include "llvm/Support/ErrorHandling.h"
+
+namespace lld {
+
+class PECOFFTargetInfo : public TargetInfo {
+public:
+  PECOFFTargetInfo() {}
+
+  virtual error_code parseFile(
+      std::unique_ptr<MemoryBuffer> &mb,
+      std::vector<std::unique_ptr<File>> &result) const;
+
+  virtual Writer &writer() const;
+  virtual bool validate(raw_ostream &diagnostics);
+
+  virtual void addPasses(PassManager &pm) const {}
+
+  virtual ErrorOr<Reference::Kind> relocKindFromString(StringRef str) const;
+  virtual ErrorOr<std::string> stringFromRelocKind(Reference::Kind kind) const;
+
+private:
+  mutable std::unique_ptr<Reader> _reader;
+  mutable std::unique_ptr<Writer> _writer;
+};
+
+} // end namespace lld
+
+#endif

Modified: lld/trunk/include/lld/ReaderWriter/Reader.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/Reader.h?rev=182784&r1=182783&r2=182784&view=diff
==============================================================================
--- lld/trunk/include/lld/ReaderWriter/Reader.h (original)
+++ lld/trunk/include/lld/ReaderWriter/Reader.h Tue May 28 13:13:31 2013
@@ -55,8 +55,7 @@ typedef ErrorOr<Reader &> ReaderFunc(con
 std::unique_ptr<Reader> createReaderELF(const ELFTargetInfo &);
 std::unique_ptr<Reader> createReaderMachO(const TargetInfo &);
 std::unique_ptr<Reader> createReaderNative(const TargetInfo &);
-std::unique_ptr<Reader> createReaderPECOFF(const TargetInfo &,
-                                           std::function<ReaderFunc>);
+std::unique_ptr<Reader> createReaderPECOFF(const TargetInfo &);
 std::unique_ptr<Reader> createReaderYAML(const TargetInfo &);
 } // end namespace lld
 

Modified: lld/trunk/lib/Driver/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/CMakeLists.txt?rev=182784&r1=182783&r2=182784&view=diff
==============================================================================
--- lld/trunk/lib/Driver/CMakeLists.txt (original)
+++ lld/trunk/lib/Driver/CMakeLists.txt Tue May 28 13:13:31 2013
@@ -4,6 +4,8 @@ set(LLVM_TARGET_DEFINITIONS CoreOptions.
 tablegen(LLVM CoreOptions.inc -gen-opt-parser-defs)
 set(LLVM_TARGET_DEFINITIONS DarwinOptions.td)
 tablegen(LLVM DarwinOptions.inc -gen-opt-parser-defs)
+set(LLVM_TARGET_DEFINITIONS WinLinkOptions.td)
+tablegen(LLVM WinLinkOptions.inc -gen-opt-parser-defs)
 add_public_tablegen_target(DriverOptionsTableGen)
 
 add_lld_library(lldDriver
@@ -11,6 +13,7 @@ add_lld_library(lldDriver
   DarwinLdDriver.cpp
   Driver.cpp
   GnuLdDriver.cpp
+  WinLinkDriver.cpp
   UniversalDriver.cpp
   )
 

Modified: lld/trunk/lib/Driver/UniversalDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/UniversalDriver.cpp?rev=182784&r1=182783&r2=182784&view=diff
==============================================================================
--- lld/trunk/lib/Driver/UniversalDriver.cpp (original)
+++ lld/trunk/lib/Driver/UniversalDriver.cpp Tue May 28 13:13:31 2013
@@ -103,7 +103,7 @@ Flavor selectFlavor(std::vector<const ch
   if (flavor == Flavor::invalid)
     diag << "error: failed to determine driver flavor from program name"
          << " '" << args[0] << "'.\n"
-         << "select a flavor with -flavor [gnu|darwin|core].\n";
+         << "select a flavor with -flavor [gnu|darwin|link|core].\n";
   return flavor;
 }
 }
@@ -124,10 +124,10 @@ bool UniversalDriver::link(int argc, con
     return GnuLdDriver::linkELF(args.size(), args.data(), diagnostics);
   case Flavor::darwin_ld:
     return DarwinLdDriver::linkMachO(args.size(), args.data(), diagnostics);
+  case Flavor::win_link:
+    return WinLinkDriver::linkPECOFF(args.size(), args.data(), diagnostics);
   case Flavor::core:
     return CoreDriver::link(args.size(), args.data(), diagnostics);
-  case Flavor::win_link:
-    llvm_unreachable("Unsupported flavor");
   case Flavor::invalid:
     return true;
   }

Added: lld/trunk/lib/Driver/WinLinkDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkDriver.cpp?rev=182784&view=auto
==============================================================================
--- lld/trunk/lib/Driver/WinLinkDriver.cpp (added)
+++ lld/trunk/lib/Driver/WinLinkDriver.cpp Tue May 28 13:13:31 2013
@@ -0,0 +1,127 @@
+//===- lib/Driver/WinLinkDriver.cpp ---------------------------------------===//
+//
+//                             The LLVM Linker
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+///
+/// Concrete instance of the Driver for Windows link.exe.
+///
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Option/Arg.h"
+#include "llvm/Option/Option.h"
+
+#include "lld/Driver/Driver.h"
+#include "lld/ReaderWriter/PECOFFTargetInfo.h"
+
+namespace lld {
+
+namespace {
+
+// Create enum with OPT_xxx values for each option in WinLinkOptions.td
+enum WinLinkOpt {
+  OPT_INVALID = 0,
+#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, FLAGS, PARAM, HELP, META) \
+          OPT_##ID,
+#include "WinLinkOptions.inc"
+  LastOption
+#undef OPTION
+};
+
+// Create prefix string literals used in WinLinkOptions.td
+#define PREFIX(NAME, VALUE) const char *const NAME[] = VALUE;
+#include "WinLinkOptions.inc"
+#undef PREFIX
+
+// Create table mapping all options defined in WinLinkOptions.td
+static const llvm::opt::OptTable::Info infoTable[] = {
+#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, FLAGS, PARAM, \
+               HELPTEXT, METAVAR)   \
+  { PREFIX, NAME, HELPTEXT, METAVAR, OPT_##ID, llvm::opt::Option::KIND##Class, \
+    PARAM, FLAGS, OPT_##GROUP, OPT_##ALIAS },
+#include "WinLinkOptions.inc"
+#undef OPTION
+};
+
+// Create OptTable class for parsing actual command line arguments
+class WinLinkOptTable : public llvm::opt::OptTable {
+public:
+  WinLinkOptTable() : OptTable(infoTable, llvm::array_lengthof(infoTable)){}
+};
+
+// Returns the index of "--" or -1 if not found.
+int findDoubleDash(int argc, const char *argv[]) {
+  for (int i = 0; i < argc; ++i)
+    if (std::strcmp(argv[i], "--") == 0)
+      return i;
+  return -1;
+}
+
+} // namespace
+
+
+bool WinLinkDriver::linkPECOFF(int argc, const char *argv[],
+                               raw_ostream &diagnostics) {
+  PECOFFTargetInfo info;
+  if (parse(argc, argv, info, diagnostics))
+    return true;
+  return link(info, diagnostics);
+}
+
+bool WinLinkDriver::parse(int argc, const char *argv[],
+                          PECOFFTargetInfo &info, raw_ostream &diagnostics) {
+  // Arguments after "--" are interpreted as filenames even if they start with
+  // a hyphen or a slash. This is not compatible with link.exe but useful for
+  // us to test lld on Unix.
+  int doubleDashPosition = findDoubleDash(argc, argv);
+  int argEnd = (doubleDashPosition > 0) ? doubleDashPosition : argc;
+
+  // Parse command line options using WinLinkOptions.td
+  std::unique_ptr<llvm::opt::InputArgList> parsedArgs;
+  WinLinkOptTable table;
+  unsigned missingIndex;
+  unsigned missingCount;
+  parsedArgs.reset(
+      table.ParseArgs(&argv[1], &argv[argEnd], missingIndex, missingCount));
+  if (missingCount) {
+    diagnostics << "error: missing arg value for '"
+                << parsedArgs->getArgString(missingIndex) << "' expected "
+                << missingCount << " argument(s).\n";
+    return true;
+  }
+
+  // Handle -help
+  if (parsedArgs->getLastArg(OPT_help)) {
+    table.PrintHelp(llvm::outs(), argv[0], "LLVM Linker", false);
+    return true;
+  }
+
+  // Copy -mllvm
+  for (llvm::opt::arg_iterator it = parsedArgs->filtered_begin(OPT_mllvm),
+                               ie = parsedArgs->filtered_end();
+       it != ie; ++it) {
+    info.appendLLVMOption((*it)->getValue());
+  }
+
+  // Add input files
+  for (llvm::opt::arg_iterator it = parsedArgs->filtered_begin(OPT_INPUT),
+                               ie = parsedArgs->filtered_end();
+       it != ie; ++it) {
+    info.appendInputFile((*it)->getValue());
+  }
+
+  // Arguments after "--" are also input files
+  if (doubleDashPosition > 0)
+    for (int i = doubleDashPosition + 1; i < argc; ++i)
+      info.appendInputFile(argv[i]);
+
+  // Validate the combination of options used.
+  return info.validate(diagnostics);
+}
+
+} // namespace lld

Added: lld/trunk/lib/Driver/WinLinkOptions.td
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkOptions.td?rev=182784&view=auto
==============================================================================
--- lld/trunk/lib/Driver/WinLinkOptions.td (added)
+++ lld/trunk/lib/Driver/WinLinkOptions.td Tue May 28 13:13:31 2013
@@ -0,0 +1,9 @@
+include "llvm/Option/OptParser.td"
+
+// link.exe accepts options starting with either a dash or a slash.
+
+def mllvm : Separate<["-", "/"], "mllvm">,
+    HelpText<"Options to pass to LLVM">;
+
+def help : Flag<["-", "/"], "help">;
+def help_q : Flag<["-", "/"], "?">, Alias<help>;

Modified: lld/trunk/lib/ReaderWriter/PECOFF/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/CMakeLists.txt?rev=182784&r1=182783&r2=182784&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/CMakeLists.txt (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/CMakeLists.txt Tue May 28 13:13:31 2013
@@ -1,4 +1,5 @@
 add_lld_library(lldPECOFF
+  PECOFFTargetInfo.cpp
   ReaderCOFF.cpp
   WriterPECOFF.cpp
   )

Added: lld/trunk/lib/ReaderWriter/PECOFF/PECOFFTargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/PECOFFTargetInfo.cpp?rev=182784&view=auto
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/PECOFFTargetInfo.cpp (added)
+++ lld/trunk/lib/ReaderWriter/PECOFF/PECOFFTargetInfo.cpp Tue May 28 13:13:31 2013
@@ -0,0 +1,45 @@
+//===- lib/ReaderWriter/PECOFF/PECOFFTargetInfo.cpp -----------------------===//
+//
+//                             The LLVM Linker
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lld/ReaderWriter/PECOFFTargetInfo.h"
+
+#include "lld/ReaderWriter/Reader.h"
+#include "lld/ReaderWriter/Writer.h"
+
+#include "llvm/Support/Debug.h"
+
+namespace lld {
+
+error_code PECOFFTargetInfo::parseFile(
+    std::unique_ptr<MemoryBuffer> &mb,
+    std::vector<std::unique_ptr<File>> &result) const {
+  return _reader->parseFile(mb, result);
+}
+
+bool PECOFFTargetInfo::validate(raw_ostream &diagnostics) {
+  _reader = createReaderPECOFF(*this);
+  _writer = createWriterPECOFF(*this);
+  return false;
+}
+
+Writer &PECOFFTargetInfo::writer() const {
+  return *_writer;
+}
+
+ErrorOr<Reference::Kind>
+PECOFFTargetInfo::relocKindFromString(StringRef str) const {
+  return make_error_code(yaml_reader_error::illegal_value);
+}
+
+ErrorOr<std::string>
+PECOFFTargetInfo::stringFromRelocKind(Reference::Kind kind) const {
+  return make_error_code(yaml_reader_error::illegal_value);
+}
+
+} // end namespace lld

Modified: lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp?rev=182784&r1=182783&r2=182784&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp Tue May 28 13:13:31 2013
@@ -7,12 +7,15 @@
 //
 //===----------------------------------------------------------------------===//
 
+#define DEBUG_TYPE "ReaderCOFF"
+
 #include "lld/ReaderWriter/Reader.h"
 #include "lld/Core/File.h"
 
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/Object/COFF.h"
 #include "llvm/Support/Casting.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/Memory.h"
 #include "llvm/Support/MemoryBuffer.h"
@@ -368,8 +371,6 @@ private:
   const TargetInfo &_targetInfo;
 };
 
-
-
 class ReaderCOFF : public Reader {
 public:
   ReaderCOFF(const TargetInfo &ti) : Reader(ti) {}
@@ -377,20 +378,26 @@ public:
   error_code parseFile(std::unique_ptr<MemoryBuffer> &mb,
                        std::vector<std::unique_ptr<File> > &result) const {
     llvm::error_code ec;
-    std::unique_ptr<File> f(new FileCOFF(_targetInfo, std::move(mb), ec));
-    if (ec) {
+    std::unique_ptr<File> file(new FileCOFF(_targetInfo, std::move(mb), ec));
+    if (ec)
       return ec;
-    }
 
-    result.push_back(std::move(f));
+    DEBUG({
+      llvm::dbgs() << "Defined atoms:\n";
+      for (const auto &atom : file->defined())
+        llvm::dbgs() << "  " << atom->name() << "\n";
+    });
+
+    result.push_back(std::move(file));
     return error_code::success();
   }
 };
+
 } // end namespace anonymous
 
 namespace lld {
-std::unique_ptr<Reader> createReaderPECOFF(const TargetInfo & ti,
-                                           std::function<ReaderFunc>) {
+std::unique_ptr<Reader> createReaderPECOFF(const TargetInfo & ti) {
   return std::unique_ptr<Reader>(new ReaderCOFF(ti));
 }
+
 }

Modified: lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp?rev=182784&r1=182783&r2=182784&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp Tue May 28 13:13:31 2013
@@ -10,11 +10,25 @@
 #include "lld/ReaderWriter/Writer.h"
 
 #include "llvm/Support/ErrorHandling.h"
-
+#include "llvm/Support/ErrorOr.h"
 
 namespace lld {
-std::unique_ptr<Writer> createWriterPECOFF(const TargetInfo &) {
-  llvm_unreachable("PE/COFF support not implemented yet");
-  return nullptr;
+namespace pecoff {
+
+class ExecutableWriter : public Writer {
+ public:
+  ExecutableWriter(const TargetInfo &) {}
+
+  virtual error_code writeFile(const File &linkedFile, StringRef path) {
+    // TODO: implement this
+    return error_code::success();
+  }
+};
+
+} // end namespace pecoff
+
+std::unique_ptr<Writer> createWriterPECOFF(const TargetInfo &info) {
+  return std::unique_ptr<Writer>(new pecoff::ExecutableWriter(info));
 }
+
 } // end namespace lld

Added: lld/trunk/test/pecoff/Inputs/nop.asm
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/pecoff/Inputs/nop.asm?rev=182784&view=auto
==============================================================================
--- lld/trunk/test/pecoff/Inputs/nop.asm (added)
+++ lld/trunk/test/pecoff/Inputs/nop.asm Tue May 28 13:13:31 2013
@@ -0,0 +1,9 @@
+.386
+.model flat, stdcall
+option casemap :none
+
+.code
+start:
+	mov eax, 42
+	ret
+end start

Added: lld/trunk/test/pecoff/Inputs/nop.obj
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/pecoff/Inputs/nop.obj?rev=182784&view=auto
==============================================================================
Binary files lld/trunk/test/pecoff/Inputs/nop.obj (added) and lld/trunk/test/pecoff/Inputs/nop.obj Tue May 28 13:13:31 2013 differ

Added: lld/trunk/test/pecoff/basic.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/pecoff/basic.test?rev=182784&view=auto
==============================================================================
--- lld/trunk/test/pecoff/basic.test (added)
+++ lld/trunk/test/pecoff/basic.test Tue May 28 13:13:31 2013
@@ -0,0 +1,5 @@
+# RUN: lld -flavor link -mllvm -debug-only=ReaderCOFF -- %p/Inputs/nop.obj \
+# RUN:   2>&1 | FileCheck %s
+
+CHECK: Defined atoms:
+CHECK:   _start





More information about the llvm-commits mailing list