1# REQUIRES: x86
2# RUN: llvm-mc -triple=x86_64-windows-gnu -filetype=obj -o %t.o %s
3# RUN: not lld-link /lldmingw /out:%t.exe %t.o /entry:entry 2>&1 | FileCheck %s
4
5# CHECK: error: undefined symbol: bar()
6# CHECK-NEXT: >>> referenced by /path/to/src{{[/\\]}}undef.cpp:17
7# CHECK-NEXT: >>>               {{.*}}.o:(entry)
8# CHECK-EMPTY:
9# CHECK-NEXT: error: undefined symbol: foo()
10# CHECK-NEXT: >>> referenced by /path/to/src{{[/\\]}}undef.cpp:7
11# CHECK-NEXT: >>>               {{.*}}.o:(A::afunc())
12
13        .text
14        .file   "undef.cpp"
15        .file   1 "/path/to/src" "undef.cpp"
16        .globl  entry                   # -- Begin function entry
17entry:                                  # @entry
18.Lfunc_begin0:
19        .loc    1 14 0                  # undef.cpp:14:0
20        subq    $40, %rsp
21.Ltmp0:
22        leaq    32(%rsp), %rcx
23.Ltmp1:
24        .loc    1 16 4 prologue_end     # undef.cpp:16:4
25        callq   _ZN1A5afuncEv
26        .loc    1 17 2                  # undef.cpp:17:2
27        callq   _Z3barv
28        .loc    1 18 1                  # undef.cpp:18:1
29        addq    $40, %rsp
30        retq
31.Ltmp2:
32.Lfunc_end0:
33
34        .def     _ZN1A5afuncEv;
35        .scl    2;
36        .type   32;
37        .endef
38        .section        .text$_ZN1A5afuncEv,"xr",discard,_ZN1A5afuncEv
39        .globl  _ZN1A5afuncEv           # -- Begin function _ZN1A5afuncEv
40        .p2align        1, 0x90
41_ZN1A5afuncEv:                          # @_ZN1A5afuncEv
42.Lfunc_begin1:
43        .loc    1 6 0                   # undef.cpp:6:0
44        .loc    1 7 3 prologue_end      # undef.cpp:7:3
45        jmp     _Z3foov                 # TAILCALL
46.Ltmp3:
47.Lfunc_end1:
48
49        .section        .debug_abbrev,"dr"
50.Lsection_abbrev:
51        .byte   1                       # Abbreviation Code
52        .byte   17                      # DW_TAG_compile_unit
53        .byte   1                       # DW_CHILDREN_yes
54        .byte   37                      # DW_AT_producer
55        .byte   37                      # DW_FORM_strx1
56        .byte   19                      # DW_AT_language
57        .byte   5                       # DW_FORM_data2
58        .byte   3                       # DW_AT_name
59        .byte   37                      # DW_FORM_strx1
60        .byte   16                      # DW_AT_stmt_list
61        .byte   23                      # DW_FORM_sec_offset
62        .byte   27                      # DW_AT_comp_dir
63        .byte   37                      # DW_FORM_strx1
64        .byte   17                      # DW_AT_low_pc
65        .byte   1                       # DW_FORM_addr
66        .byte   85                      # DW_AT_ranges
67        .byte   23                      # DW_FORM_sec_offset
68        .byte   0                       # EOM(1)
69        .byte   0                       # EOM(2)
70        .byte   0                       # EOM(3)
71        .section        .debug_info,"dr"
72.Lsection_info:
73.Lcu_begin0:
74        .long   .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
75.Ldebug_info_start0:
76        .short  4                       # DWARF version number
77        .secrel32       .Lsection_abbrev # Offset Into Abbrev. Section
78        .byte   8                       # Address Size (in bytes)
79        .byte   1                       # Abbrev [1] 0xb:0xb0 DW_TAG_compile_unit
80        .byte   0                       # DW_AT_producer
81        .short  4                       # DW_AT_language
82        .byte   0                       # DW_AT_name
83        .secrel32       .Lline_table_start0 # DW_AT_stmt_list
84        .byte   0                       # DW_AT_comp_dir
85        .quad   0                       # DW_AT_low_pc
86        .secrel32       .Ldebug_ranges0 # DW_AT_ranges
87        .byte   0                       # End Of Children Mark
88.Ldebug_info_end0:
89        .section        .debug_ranges,"dr"
90.Ldebug_range:
91.Ldebug_ranges0:
92        .quad   .Lfunc_begin0
93        .quad   .Lfunc_end0
94        .quad   .Lfunc_begin1
95        .quad   .Lfunc_end1
96        .quad   0
97        .quad   0
98
99        .section        .debug_line,"dr"
100.Lline_table_start0:
101