1 Check that /winsysroot results in the correct machine-specific subdirectory
2 being 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
11 Check 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
15 Check 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
19 # RUN: lld-link %t.obj /winsysroot:%t.dir/sysroot /machine:x86 \
20 # RUN: std32.lib /entry:main
22 Check 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
26 # RUN: lld-link %t.obj /winsysroot:%t.dir/sysroot \
27 # RUN: std32.lib /entry:main
29 Check 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
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
36 UNKNOWNLIB: could not open 'notfound.lib'
38 If 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
42 Check 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
45 NO64: could not open 'std64.lib'
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
49 NO32: could not open 'std32.lib'
51 Check 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
53 LIBIGNORED: could not open 'std32.lib'
55 Check 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
57 LIBIGNORED_MINGW: could not open 'libstd32.a'
59 # RUN: not lld-link -lldmingw %t.obj /defaultlib:std32 /winsysroot:%t.dir/sysroot 2>&1 | FileCheck -check-prefix=IGNORED_ARG %s
60 IGNORED_ARG: warning: ignoring /vctoolsdir or /winsysroot flags in MinGW mode