1# REQUIRES: x86
2# RUN: llvm-mc -triple=x86_64-windows-gnu %s -filetype=obj -o %t.o
3
4# RUN: lld-link -lldmingw %t.o -out:%t-default.exe 2>&1 | FileCheck -allow-empty -check-prefix=LINK %s
5# RUN: lld-link -lldmingw %t.o -out:%t-cui.exe -subsystem:console 2>&1 | FileCheck -allow-empty -check-prefix=LINK %s
6# RUN: lld-link -lldmingw %t.o -out:%t-gui.exe -subsystem:windows 2>&1 | FileCheck -allow-empty -check-prefix=LINK %s
7
8# RUN: llvm-readobj --file-headers %t-default.exe | FileCheck -check-prefix=CUI %s
9# RUN: llvm-readobj --file-headers %t-cui.exe | FileCheck -check-prefix=CUI %s
10# RUN: llvm-readobj --file-headers %t-gui.exe | FileCheck -check-prefix=GUI %s
11
12# Check that this doesn't print any warnings.
13# LINK-NOT: found both wmain and main
14
15# CUI: AddressOfEntryPoint: 0x1001
16# CUI: Subsystem: IMAGE_SUBSYSTEM_WINDOWS_CUI (0x3)
17
18# GUI: AddressOfEntryPoint: 0x1002
19# GUI: Subsystem: IMAGE_SUBSYSTEM_WINDOWS_GUI (0x2)
20
21
22        .text
23        .globl mainCRTStartup
24        .globl WinMainCRTStartup
25# MinGW only uses the entry points above, these other ones aren't
26# used as entry.
27        .globl main
28        .globl wmain
29        .globl wmainCRTStartup
30        .globl wWinMainCRTStartup
31foo:
32        ret
33mainCRTStartup:
34        ret
35WinMainCRTStartup:
36        ret
37main:
38        ret
39wmain:
40        ret
41wmainCRTStartup:
42        ret
43wWinMainCRTStartup:
44        ret
45