[memprof] Remove an unused using directive (#117004)
[llvm-project.git] / lld / test / COFF / link-dll-stdcall.s
blobd9a6dbb342240a2db47b40995b64d8c5f4ef8093
1 # REQUIRES: x86
3 ## Test creating a DLL and linking against the DLL without using an import
4 ## library.
6 ## Test on i386 with stdcall/fastcall/vectorcall decorated symbols.
8 ## Check that we normally warn about these fixups. If -stdcall-fixup:no
9 ## (--disable-stdcall-fixup on the MinGW linker level) is passed, we don't
10 ## do these fixups. If we -stdcall-fixup (--enable-stdcall-fixup on the MinGW
11 ## linker level) is passed, we don't warn about it at all.
13 # RUN: split-file %s %t.dir
15 # RUN: llvm-mc -filetype=obj -triple=i386-windows-gnu %t.dir/lib.s -o %t.lib.o
16 # RUN: lld-link -safeseh:no -noentry -dll -def:%t.dir/lib.def %t.lib.o -out:%t.lib.dll -implib:%t.implib.lib
17 # RUN: llvm-mc -filetype=obj -triple=i386-windows-gnu %t.dir/main.s -o %t.main.o
18 # RUN: lld-link -lldmingw %t.main.o -out:%t.main.exe %t.lib.dll -opt:noref 2>&1 | FileCheck --check-prefix=LOG %s
19 # RUN: llvm-readobj --coff-imports %t.main.exe | FileCheck %s
20 # RUN: not lld-link -lldmingw %t.main.o -out:%t.main.exe %t.lib.dll -opt:noref -stdcall-fixup:no 2>&1 | FileCheck --check-prefix=ERROR %s
21 # RUN: lld-link -lldmingw %t.main.o -out:%t.main.exe %t.lib.dll -opt:noref -stdcall-fixup 2>&1 | count 0
23 #--- lib.s
24 .text
25 .globl _stdcall@8
26 .globl @fastcall@8
27 .globl vectorcall@@8
28 .globl __underscored
29 _stdcall@8:
30 movl 8(%esp), %eax
31 addl 4(%esp), %eax
32 retl $8
33 @fastcall@8:
34 movl 8(%esp), %eax
35 addl 4(%esp), %eax
36 retl $8
37 vectorcall@@8:
38 movl 8(%esp), %eax
39 addl 4(%esp), %eax
40 retl $8
41 __underscored:
42 ret
44 #--- lib.def
45 EXPORTS
46 stdcall
47 fastcall
48 vectorcall
49 _underscored
51 #--- main.s
52 .text
53 .global _mainCRTStartup
54 _mainCRTStartup:
55 pushl $2
56 pushl $1
57 calll _stdcall@8
58 movl $1, %ecx
59 movl $2, %edx
60 calll @fastcall@8
61 movl $1, %ecx
62 movl $2, %edx
63 calll vectorcall@@8
64 pushl $2
65 pushl $1
66 calll __underscored
67 addl $8, %esp
68 xorl %eax, %eax
69 popl %ebp
70 retl
72 # CHECK: Import {
73 # CHECK-NEXT: Name: link-dll-stdcall.s.tmp.lib.dll
74 # CHECK-NEXT: ImportLookupTableRVA:
75 # CHECK-NEXT: ImportAddressTableRVA
76 # CHECK-NEXT: Symbol: _underscored
77 # CHECK-NEXT: Symbol: fastcall
78 # CHECK-NEXT: Symbol: stdcall
79 # CHECK-NEXT: Symbol: vectorcall
80 # CHECK-NEXT: }
82 # LOG-DAG: Resolving vectorcall@@8 by linking to _vectorcall
83 # LOG-DAG: Resolving @fastcall@8 by linking to _fastcall
84 # LOG-DAG: Resolving _stdcall@8 by linking to _stdcall
86 # ERROR-DAG: undefined symbol: _stdcall@8
87 # ERROR-DAG: undefined symbol: @fastcall@8
88 # ERROR-DAG: undefined symbol: vectorcall@@8