File tree Expand file tree Collapse file tree 2 files changed +42
-1
lines changed Expand file tree Collapse file tree 2 files changed +42
-1
lines changed Original file line number Diff line number Diff line change @@ -2351,7 +2351,7 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
23512351 // and after the early return when just writing an import library.
23522352 if (config->subsystem == IMAGE_SUBSYSTEM_UNKNOWN) {
23532353 llvm::TimeTraceScope timeScope (" Infer subsystem" );
2354- config->subsystem = ctx. symtab .inferSubsystem ();
2354+ config->subsystem = mainSymtab .inferSubsystem ();
23552355 if (config->subsystem == IMAGE_SUBSYSTEM_UNKNOWN)
23562356 Fatal (ctx) << " subsystem must be defined" ;
23572357 }
Original file line number Diff line number Diff line change 1+ REQUIRES: aarch64
2+ RUN: split-file %s %t.dir && cd %t.dir
3+
4+ RUN: llvm-mc -filetype=obj -triple=arm64ec-windows main.s -o main-arm64ec.obj
5+ RUN: llvm-mc -filetype=obj -triple=aarch64-windows main.s -o main-arm64.obj
6+ RUN: llvm-mc -filetype=obj -triple=arm64ec-windows winmain.s -o winmain-arm64ec.obj
7+ RUN: llvm-mc -filetype=obj -triple=aarch64-windows winmain.s -o winmain-arm64.obj
8+ RUN: llvm-mc -filetype=obj -triple=arm64ec-windows %S/Inputs/loadconfig-arm64ec.s -o loadconfig-arm64ec.obj
9+ RUN: llvm-mc -filetype=obj -triple=aarch64-windows %S/Inputs/loadconfig-arm64.s -o loadconfig-arm64.obj
10+
11+ Check that the subsystem is inferred from EC symbols.
12+
13+ RUN: lld-link -machine:arm64x -entry:entry -out:out.exe main-arm64.obj winmain-arm64ec.obj \
14+ RUN: loadconfig-arm64.obj loadconfig-arm64ec.obj
15+ RUN: llvm-readobj --headers out.exe | FileCheck --check-prefix=GUI %s
16+ GUI: Subsystem: IMAGE_SUBSYSTEM_WINDOWS_GUI (0x2)
17+ GUI: Subsystem: IMAGE_SUBSYSTEM_WINDOWS_GUI (0x2)
18+
19+ RUN: lld-link -machine:arm64x -entry:entry -out:out.exe main-arm64ec.obj winmain-arm64.obj \
20+ RUN: loadconfig-arm64.obj loadconfig-arm64ec.obj
21+ RUN: llvm-readobj --headers out.exe | FileCheck --check-prefix=CUI %s
22+ CUI: Subsystem: IMAGE_SUBSYSTEM_WINDOWS_CUI (0x3)
23+ CUI: Subsystem: IMAGE_SUBSYSTEM_WINDOWS_CUI (0x3)
24+
25+ #--- main.s
26+ .globl "#main"
27+ .globl main
28+ .globl entry
29+ "#main":
30+ main:
31+ entry:
32+ ret
33+
34+ #--- winmain.s
35+ .globl "#WinMain"
36+ .globl WinMain
37+ .globl entry
38+ "#WinMain":
39+ WinMain:
40+ entry:
41+ ret
You can’t perform that action at this time.
0 commit comments