[PATCH] D63248: [LLD] [COFF] Allow setting subsystem versions while inferring the subsystem type implicitly
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 14 10:47:42 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL363431: [COFF] Allow setting subsystem versions while inferring the subsystem type… (authored by mstorsjo, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D63248?vs=204476&id=204809#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D63248/new/
https://reviews.llvm.org/D63248
Files:
lld/trunk/COFF/DriverUtils.cpp
lld/trunk/test/COFF/subsystem-inference.test
lld/trunk/test/COFF/subsystem.test
Index: lld/trunk/test/COFF/subsystem.test
===================================================================
--- lld/trunk/test/COFF/subsystem.test
+++ lld/trunk/test/COFF/subsystem.test
@@ -17,3 +17,12 @@
CHECK2: MajorSubsystemVersion: 8
CHECK2: MinorSubsystemVersion: 9
CHECK2: Subsystem: IMAGE_SUBSYSTEM_WINDOWS_GUI
+
+# RUN: lld-link /entry:main /out:%t.exe /subsystem:default,8.9 \
+# RUN: %p/Inputs/ret42.obj
+# RUN: llvm-readobj --file-headers %t.exe | FileCheck -check-prefix=CHECK3 %s
+
+CHECK3: MajorOperatingSystemVersion: 8
+CHECK3: MinorOperatingSystemVersion: 9
+CHECK3: MajorSubsystemVersion: 8
+CHECK3: MinorSubsystemVersion: 9
Index: lld/trunk/test/COFF/subsystem-inference.test
===================================================================
--- lld/trunk/test/COFF/subsystem-inference.test
+++ lld/trunk/test/COFF/subsystem-inference.test
@@ -1,6 +1,8 @@
# RUN: sed -e s/ENTRYNAME/main/ %s | yaml2obj > %t.obj
# RUN: lld-link /out:%t.exe %t.obj
# RUN: llvm-readobj --file-headers %t.exe | FileCheck -check-prefix=MAIN %s
+# RUN: lld-link /out:%t.exe %t.obj /subsystem:default,6.0
+# RUN: llvm-readobj --file-headers %t.exe | FileCheck -check-prefix=MAIN %s
# RUN: sed s/ENTRYNAME/wmain/ %s | yaml2obj > %t.obj
# RUN: lld-link /out:%t.exe %t.obj
@@ -9,6 +11,8 @@
# RUN: sed s/ENTRYNAME/WinMain/ %s | yaml2obj > %t.obj
# RUN: lld-link /out:%t.exe %t.obj
# RUN: llvm-readobj --file-headers %t.exe | FileCheck -check-prefix=WINMAIN %s
+# RUN: lld-link /out:%t.exe %t.obj /subsystem:default,6.0
+# RUN: llvm-readobj --file-headers %t.exe | FileCheck -check-prefix=WINMAIN %s
# RUN: sed s/ENTRYNAME/wWinMain/ %s | yaml2obj > %t.obj
# RUN: lld-link /out:%t.exe %t.obj
Index: lld/trunk/COFF/DriverUtils.cpp
===================================================================
--- lld/trunk/COFF/DriverUtils.cpp
+++ lld/trunk/COFF/DriverUtils.cpp
@@ -114,9 +114,11 @@
uint32_t *Minor) {
StringRef SysStr, Ver;
std::tie(SysStr, Ver) = Arg.split(',');
- *Sys = StringSwitch<WindowsSubsystem>(SysStr.lower())
+ std::string SysStrLower = SysStr.lower();
+ *Sys = StringSwitch<WindowsSubsystem>(SysStrLower)
.Case("boot_application", IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION)
.Case("console", IMAGE_SUBSYSTEM_WINDOWS_CUI)
+ .Case("default", IMAGE_SUBSYSTEM_UNKNOWN)
.Case("efi_application", IMAGE_SUBSYSTEM_EFI_APPLICATION)
.Case("efi_boot_service_driver", IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER)
.Case("efi_rom", IMAGE_SUBSYSTEM_EFI_ROM)
@@ -125,7 +127,7 @@
.Case("posix", IMAGE_SUBSYSTEM_POSIX_CUI)
.Case("windows", IMAGE_SUBSYSTEM_WINDOWS_GUI)
.Default(IMAGE_SUBSYSTEM_UNKNOWN);
- if (*Sys == IMAGE_SUBSYSTEM_UNKNOWN)
+ if (*Sys == IMAGE_SUBSYSTEM_UNKNOWN && SysStrLower != "default")
fatal("unknown subsystem: " + SysStr);
if (!Ver.empty())
parseVersion(Ver, Major, Minor);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63248.204809.patch
Type: text/x-patch
Size: 2895 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190614/cb861dfb/attachment.bin>
More information about the llvm-commits
mailing list