• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj -triple=i686-windows-msvc %s -o %t.obj
3# RUN: echo -e "LIBRARY foo\nEXPORTS\n  stdcall\n  fastcall\n  vectorcall\n  _underscored" > %t.def
4# RUN: lld-link -safeseh:no -entry:dllmain -dll -def:%t.def %t.obj -out:%t.dll -implib:%t.lib
5# RUN: llvm-readobj %t.lib | FileCheck -check-prefix UNDECORATED-IMPLIB %s
6# RUN: llvm-readobj --coff-exports %t.dll | FileCheck -check-prefix UNDECORATED-EXPORTS %s
7
8# UNDECORATED-IMPLIB: Name type: noprefix
9# UNDECORATED-IMPLIB-NEXT: __imp___underscored
10# UNDECORATED-IMPLIB-NEXT: __underscored
11# UNDECORATED-IMPLIB: Name type: undecorate
12# UNDECORATED-IMPLIB-NEXT: __imp_@fastcall@8
13# UNDECORATED-IMPLIB-NEXT: fastcall@8
14# UNDECORATED-IMPLIB: Name type: undecorate
15# UNDECORATED-IMPLIB-NEXT: __imp__stdcall@8
16# UNDECORATED-IMPLIB-NEXT: _stdcall@8
17# UNDECORATED-IMPLIB: Name type: undecorate
18# UNDECORATED-IMPLIB-NEXT: __imp_vectorcall@@8
19# UNDECORATED-IMPLIB-NEXT: vectorcall@@8
20
21# UNDECORATED-EXPORTS: Name: _underscored
22# UNDECORATED-EXPORTS: Name: fastcall
23# UNDECORATED-EXPORTS: Name: stdcall
24# UNDECORATED-EXPORTS: Name: vectorcall
25
26
27# RUN: echo -e "LIBRARY foo\nEXPORTS\n  _stdcall@8\n  @fastcall@8\n  vectorcall@@8" > %t.def
28# RUN: lld-link -safeseh:no -entry:dllmain -dll -def:%t.def %t.obj -out:%t.dll -implib:%t.lib
29# RUN: llvm-readobj %t.lib | FileCheck -check-prefix DECORATED-IMPLIB %s
30# RUN: llvm-readobj --coff-exports %t.dll | FileCheck -check-prefix DECORATED-EXPORTS %s
31
32# DECORATED-IMPLIB: Name type: name
33# DECORATED-IMPLIB-NEXT: __imp_@fastcall@8
34# DECORATED-IMPLIB-NEXT: @fastcall@8
35# DECORATED-IMPLIB: Name type: name
36# DECORATED-IMPLIB-NEXT: __imp__stdcall@8
37# DECORATED-IMPLIB-NEXT: _stdcall@8
38# DECORATED-IMPLIB: Name type: name
39# DECORATED-IMPLIB-NEXT: __imp_vectorcall@@8
40# DECORATED-IMPLIB-NEXT: vectorcall@@8
41
42# DECORATED-EXPORTS: Name: @fastcall@8
43# DECORATED-EXPORTS: Name: _stdcall@8
44# DECORATED-EXPORTS: Name: vectorcall@@8
45
46
47# GNU tools don't support vectorcall at the moment, but test it for completeness.
48# RUN: echo -e "LIBRARY foo\nEXPORTS\n  stdcall@8\n  @fastcall@8\n  vectorcall@@8" > %t.def
49# RUN: lld-link -lldmingw -entry:dllmain -dll -def:%t.def %t.obj -out:%t.dll -implib:%t.lib
50# RUN: llvm-readobj %t.lib | FileCheck -check-prefix DECORATED-MINGW-IMPLIB %s
51# RUN: llvm-readobj --coff-exports %t.dll | FileCheck -check-prefix DECORATED-MINGW-EXPORTS %s
52
53# DECORATED-MINGW-IMPLIB: Name type: name
54# DECORATED-MINGW-IMPLIB-NEXT: __imp_@fastcall@8
55# DECORATED-MINGW-IMPLIB-NEXT: fastcall@8
56# DECORATED-MINGW-IMPLIB: Name type: noprefix
57# DECORATED-MINGW-IMPLIB-NEXT: __imp__stdcall@8
58# DECORATED-MINGW-IMPLIB-NEXT: _stdcall@8
59# GNU tools don't support vectorcall, but this test is just to track that
60# lld's behaviour remains consistent over time.
61# DECORATED-MINGW-IMPLIB: Name type: name
62# DECORATED-MINGW-IMPLIB-NEXT: __imp_vectorcall@@8
63# DECORATED-MINGW-IMPLIB-NEXT: vectorcall@@8
64
65# DECORATED-MINGW-EXPORTS: Name: @fastcall@8
66# DECORATED-MINGW-EXPORTS: Name: stdcall@8
67# DECORATED-MINGW-EXPORTS: Name: vectorcall@@8
68
69# RUN: lld-link -lldmingw -kill-at -entry:dllmain -dll -def:%t.def %t.obj -out:%t.dll -implib:%t.lib
70# RUN: llvm-readobj %t.lib | FileCheck -check-prefix MINGW-KILL-AT-IMPLIB %s
71# RUN: llvm-readobj --coff-exports %t.dll | FileCheck -check-prefix MINGW-KILL-AT-EXPORTS %s
72
73# RUN: lld-link -lldmingw -kill-at -entry:dllmain -dll %t.obj -out:%t.dll -implib:%t.lib
74# RUN: llvm-readobj %t.lib | FileCheck -check-prefix MINGW-KILL-AT-IMPLIB %s
75# RUN: llvm-readobj --coff-exports %t.dll | FileCheck -check-prefix MINGW-KILL-AT-EXPORTS %s
76
77# MINGW-KILL-AT-IMPLIB: Name type: noprefix
78# MINGW-KILL-AT-IMPLIB: __imp__fastcall
79# MINGW-KILL-AT-IMPLIB-NEXT: _fastcall
80# MINGW-KILL-AT-IMPLIB: Name type: noprefix
81# MINGW-KILL-AT-IMPLIB-NEXT: __imp__stdcall
82# MINGW-KILL-AT-IMPLIB-NEXT: _stdcall
83# GNU tools don't support vectorcall, but this test is just to track that
84# lld's behaviour remains consistent over time.
85# MINGW-KILL-AT-IMPLIB: Name type: noprefix
86# MINGW-KILL-AT-IMPLIB-NEXT: __imp__vectorcall
87# MINGW-KILL-AT-IMPLIB-NEXT: _vectorcall
88
89# MINGW-KILL-AT-EXPORTS: Name: fastcall
90# MINGW-KILL-AT-EXPORTS: Name: stdcall
91# MINGW-KILL-AT-EXPORTS: Name: vectorcall
92
93
94        .def     _stdcall@8;
95        .scl    2;
96        .type   32;
97        .endef
98        .globl  _stdcall@8
99        .globl  @fastcall@8
100        .globl  vectorcall@@8
101        .globl  __underscored
102_stdcall@8:
103        movl    8(%esp), %eax
104        addl    4(%esp), %eax
105        retl    $8
106@fastcall@8:
107        movl    8(%esp), %eax
108        addl    4(%esp), %eax
109        retl    $8
110vectorcall@@8:
111        movl    8(%esp), %eax
112        addl    4(%esp), %eax
113        retl    $8
114__underscored:
115        ret
116
117        .def     _dllmain;
118        .scl    2;
119        .type   32;
120        .endef
121        .globl  _dllmain
122_dllmain:
123        retl
124
125