[lld] r198015 - [PECOFF] Set default subsystem to the DLL header.

Rui Ueyama ruiu at google.com
Wed Dec 25 05:34:32 PST 2013


Author: ruiu
Date: Wed Dec 25 07:34:31 2013
New Revision: 198015

URL: http://llvm.org/viewvc/llvm-project?rev=198015&view=rev
Log:
[PECOFF] Set default subsystem to the DLL header.

Subsystem field in the PE/COFF file header has no meanining for the DLL.
It looks like MSVC link.exe sets the default subsystem (Windows GUI) to
the field if no /subsystem option is specified.

Modified:
    lld/trunk/lib/ReaderWriter/PECOFF/SetSubsystemPass.h
    lld/trunk/test/pecoff/export.test

Modified: lld/trunk/lib/ReaderWriter/PECOFF/SetSubsystemPass.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/SetSubsystemPass.h?rev=198015&r1=198014&r2=198015&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/SetSubsystemPass.h (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/SetSubsystemPass.h Wed Dec 25 07:34:31 2013
@@ -41,6 +41,10 @@ public:
         return;
       }
     }
+    if (_ctx.getImageType() == PECOFFLinkingContext::IMAGE_DLL) {
+      _ctx.setSubsystem(WindowsSubsystem::IMAGE_SUBSYSTEM_WINDOWS_GUI);
+      return;
+    }
     llvm_unreachable("Failed to infer the subsystem.");
   }
 

Modified: lld/trunk/test/pecoff/export.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/pecoff/export.test?rev=198015&r1=198014&r2=198015&view=diff
==============================================================================
--- lld/trunk/test/pecoff/export.test (original)
+++ lld/trunk/test/pecoff/export.test Wed Dec 25 07:34:31 2013
@@ -1,6 +1,6 @@
 # RUN: yaml2obj %p/Inputs/export.obj.yaml > %t.obj
 #
-# RUN: lld -flavor link /out:%t1.dll /dll /subsystem:console /entry:_init \
+# RUN: lld -flavor link /out:%t1.dll /dll /entry:_init \
 # RUN:   /export:exportfn1 /export:exportfn2 -- %t.obj
 # RUN: llvm-objdump -s %t1.dll | FileCheck -check-prefix=CHECK1 %s
 





More information about the llvm-commits mailing list