llvm-project
60 строк · 2.9 Кб
1Check that /winsysroot results in the correct machine-specific subdirectory
2being searched for the defaultlibs, for a 32-bit .obj.
3# RUN: yaml2obj %p/Inputs/hello32.yaml -o %t.obj
4# RUN: mkdir -p %t.dir/sysroot/VC/Tools/MSVC/1.1.1.1/lib/x86
5# RUN: mkdir -p %t.dir/sysroot/VC/Tools/MSVC/1.1.1.1/lib/x64
6# RUN: cp %p/Inputs/std32.lib %t.dir/sysroot/VC/Tools/MSVC/1.1.1.1/lib/x86
7# RUN: cp %p/Inputs/std64.lib %t.dir/sysroot/VC/Tools/MSVC/1.1.1.1/lib/x64
8# RUN: lld-link %t.obj /winsysroot:%t.dir/sysroot \
9# RUN: /defaultlib:std32 /entry:main@0
10
11Check the same for a 64-bit input .obj.
12# RUN: lld-link %p/Inputs/hello64.obj /winsysroot:%t.dir/sysroot \
13# RUN: /defaultlib:std64 /entry:main
14
15Check directly passed lib with /machine:
16# RUN: lld-link %p/Inputs/hello64.obj /winsysroot:%t.dir/sysroot /machine:x64 \
17# RUN: std64.lib /entry:main
18
19# RUN: lld-link %t.obj /winsysroot:%t.dir/sysroot /machine:x86 \
20# RUN: std32.lib /entry:main
21
22Check directly passed lib without /machine: (should infer from obj arch)
23# RUN: lld-link %p/Inputs/hello64.obj /winsysroot:%t.dir/sysroot \
24# RUN: std64.lib /entry:main
25
26# RUN: lld-link %t.obj /winsysroot:%t.dir/sysroot \
27# RUN: std32.lib /entry:main
28
29Check that passing a lib from /winsysroot twice is ok
30# RUN: lld-link %p/Inputs/hello64.obj /winsysroot:%t.dir/sysroot \
31# RUN: std64.lib std64.lib /entry:main
32
33Check unknown library
34# RUN: not lld-link %p/Inputs/hello64.obj /winsysroot:%t.dir/sysroot \
35# RUN: notfound.lib /entry:main 2>&1 | FileCheck --check-prefix=UNKNOWNLIB %s
36UNKNOWNLIB: could not open 'notfound.lib'
37
38If winsysroot lib appears before we can detect arch we don't find it
39# RUN: not lld-link std64.lib %p/Inputs/hello64.obj /winsysroot:%t.dir/sysroot \
40# RUN: /entry:main 2>&1 | FileCheck --check-prefix=NO64 %s
41
42Check we don't choose the wrong arch
43# RUN: not lld-link %t.obj /winsysroot:%t.dir/sysroot \
44# RUN: std64.lib /entry:main 2>&1 | FileCheck --check-prefix=NO64 %s
45NO64: could not open 'std64.lib'
46
47# RUN: not lld-link %p/Inputs/hello64.obj /winsysroot:%t.dir/sysroot \
48# RUN: std32.lib /entry:main 2>&1 | FileCheck --check-prefix=NO32 %s
49NO32: could not open 'std32.lib'
50
51Check that when /winsysroot is specified, %LIB% is ignored.
52# RUN: env LIB=%t.dir/sysroot/VC/Tools/MSVC/1.1.1.1/lib/x86 not lld-link %t.obj /winsysroot:%t.dir/doesnotexist /defaultlib:std32 2>&1 | FileCheck -check-prefix=LIBIGNORED %s
53LIBIGNORED: could not open 'std32.lib'
54
55Check that when -lldmingw is specified, %LIB% is ignored.
56# RUN: env LIB=%t.dir/sysroot/VC/Tools/MSVC/1.1.1.1/lib/x86 not lld-link -lldmingw %t.obj /defaultlib:std32 2>&1 | FileCheck -check-prefix=LIBIGNORED_MINGW %s
57LIBIGNORED_MINGW: could not open 'libstd32.a'
58
59# RUN: not lld-link -lldmingw %t.obj /defaultlib:std32 /winsysroot:%t.dir/sysroot 2>&1 | FileCheck -check-prefix=IGNORED_ARG %s
60IGNORED_ARG: warning: ignoring /vctoolsdir or /winsysroot flags in MinGW mode
61