1# REQUIRES: x86
2# RUN: llvm-mc -triple=i386-windows-gnu -filetype=obj -o %t.o %s
3# RUN: not lld-link /lldmingw /out:%t.exe %t.o 2>&1 | FileCheck %s
4# RUN: not lld-link /lldmingw /out:%t.exe /demangle %t.o 2>&1 | FileCheck %s
5# RUN: not lld-link /lldmingw /out:%t.exe /demangle:no %t.o 2>&1 | FileCheck --check-prefix=NODEMANGLE %s
6
7# NODEMANGLE: error: undefined symbol: __Z3fooi
8# NODEMANGLE: error: undefined symbol: __Z3barPKc
9# NODEMANGLE: error: undefined symbol: __imp___Z3bazv
10# NODEMANGLE: error: undefined symbol: _Z3fooi
11# NODEMANGLE: error: undefined symbol: __imp__cfunc
12
13# CHECK: error: undefined symbol: foo(int)
14# CHECK-NEXT: >>> referenced by {{.*}}.o:(_main)
15# CHECK-NEXT: >>> referenced by {{.*}}.o:(_main)
16# CHECK-EMPTY:
17# CHECK-NEXT: error: undefined symbol: bar(char const*)
18# CHECK-NEXT: >>> referenced by {{.*}}.o:(_main)
19# CHECK-NEXT: >>> referenced by {{.*}}.o:(_f1)
20# CHECK-EMPTY:
21# CHECK-NEXT: error: undefined symbol: __declspec(dllimport) baz()
22# CHECK-NEXT: >>> referenced by {{.*}}.o:(_f2)
23# CHECK-EMPTY:
24# CHECK-NEXT: error: undefined symbol: _Z3fooi
25# CHECK-NEXT: >>> referenced by {{.*}}.o:(_f2)
26# CHECK-EMPTY:
27# CHECK-NEXT: error: undefined symbol: __declspec(dllimport) _cfunc
28# CHECK-NEXT: >>> referenced by {{.*}}.o:(_f2)
29
30        .section        .text,"xr",one_only,_main
31.globl _main
32_main:
33	call	__Z3fooi
34	call	__Z3fooi
35	call	__Z3barPKc
36
37_f1:
38	call	__Z3barPKc
39.Lfunc_end1:
40
41        .section        .text,"xr",one_only,_f2
42.globl _f2
43_f2:
44	call	*__imp___Z3bazv
45	call	_Z3fooi
46	call	*__imp__cfunc
47