1// REQUIRES: x86
2// RUN: split-file %s %t.dir
3
4// RUN: llvm-mc -filetype=obj -triple=x86_64-win32-gnu %t.dir/main.s -o %t.main.o
5// RUN: llvm-mc -filetype=obj -triple=x86_64-win32-gnu %t.dir/lib1.s -o %t.lib1.o
6// RUN: llvm-mc -filetype=obj -triple=x86_64-win32-gnu %t.dir/lib2.s -o %t.lib2.o
7
8// RUN: rm -f %t.lib.a
9// RUN: llvm-ar cru %t.lib.a %t.lib1.o %t.lib2.o
10// RUN: lld-link -dll -out:%t-1.dll -entry:entry %t.main.o %t.lib.a
11// RUN: lld-link -dll -out:%t-2.dll -entry:entry %t.main.o %t.lib.a -includeoptional:libfunc
12
13// RUN: llvm-readobj --coff-exports %t-1.dll | FileCheck --implicit-check-not=Name: %s --check-prefix=CHECK-DEFAULT
14// RUN: llvm-readobj --coff-exports %t-2.dll | FileCheck --implicit-check-not=Name: %s --check-prefix=CHECK-INCLUDEOPTIONAL
15
16// CHECK-DEFAULT: Name:
17// CHECK-DEFAULT: Name: myfunc
18
19// CHECK-INCLUDEOPTIONAL: Name:
20// CHECK-INCLUDEOPTIONAL: Name: libfunc
21// CHECK-INCLUDEOPTIONAL: Name: myfunc
22// CHECK-INCLUDEOPTIONAL: Name: otherlibfunc
23
24#--- main.s
25.global entry
26entry:
27  ret
28
29.global myfunc
30myfunc:
31  ret
32
33.section .drectve
34.ascii "-export:myfunc "
35
36#--- lib1.s
37.global libfunc
38libfunc:
39  call otherlibfunc
40  ret
41
42.section .drectve
43.ascii "-export:libfunc "
44
45#--- lib2.s
46.global otherlibfunc
47otherlibfunc:
48  ret
49
50.section .drectve
51.ascii "-export:otherlibfunc "
52