[lld] r228461 - PECOFF: Move error check for invalid command line combination to validateImpl.

Rui Ueyama ruiu at google.com
Fri Feb 6 15:09:14 PST 2015


Author: ruiu
Date: Fri Feb  6 17:09:13 2015
New Revision: 228461

URL: http://llvm.org/viewvc/llvm-project?rev=228461&view=rev
Log:
PECOFF: Move error check for invalid command line combination to validateImpl.

Modified:
    lld/trunk/lib/Driver/WinLinkDriver.cpp
    lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp
    lld/trunk/test/pecoff/noentry.test

Modified: lld/trunk/lib/Driver/WinLinkDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkDriver.cpp?rev=228461&r1=228460&r2=228461&view=diff
==============================================================================
--- lld/trunk/lib/Driver/WinLinkDriver.cpp (original)
+++ lld/trunk/lib/Driver/WinLinkDriver.cpp Fri Feb  6 17:09:13 2015
@@ -1377,12 +1377,6 @@ bool WinLinkDriver::parse(int argc, cons
     }
   }
 
-  // Specify /noentry without /dll is an error.
-  if (!ctx.hasEntry() && !parsedArgs->getLastArg(OPT_dll)) {
-    diag << "/noentry must be specified with /dll\n";
-    return false;
-  }
-
   // If dead-stripping is enabled, we need to add the entry symbol and
   // symbols given by /include to the dead strip root set, so that it
   // won't be removed from the output.

Modified: lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp?rev=228461&r1=228460&r2=228461&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp Fri Feb  6 17:09:13 2015
@@ -51,6 +51,12 @@ bool PECOFFLinkingContext::validateImpl(
     return false;
   }
 
+  // Specifing /noentry without /dll is an error.
+  if (!hasEntry() && !isDll()) {
+    diagnostics << "/noentry must be specified with /dll\n";
+    return false;
+  }
+
   // Check for duplicate export ordinals.
   std::set<int> exports;
   for (const PECOFFLinkingContext::ExportDesc &desc : getDllExports()) {

Modified: lld/trunk/test/pecoff/noentry.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/pecoff/noentry.test?rev=228461&r1=228460&r2=228461&view=diff
==============================================================================
--- lld/trunk/test/pecoff/noentry.test (original)
+++ lld/trunk/test/pecoff/noentry.test Fri Feb  6 17:09:13 2015
@@ -3,3 +3,8 @@
 # RUN: llvm-readobj -file-headers %t.exe | FileCheck %s
 
 CHECK: AddressOfEntryPoint: 0x0
+
+# RUN: not lld -flavor link /out:%t.exe /noentry -- %t.obj >& %t.log
+# RUN: FileCheck --check-prefix=ERROR %s < %t.log
+
+ERROR: /noentry must be specified with /dll





More information about the llvm-commits mailing list