Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / ELF / undef.s
blob2b42ae12be2c1297c2afe608e5ceb0b57269f738
1 # REQUIRES: x86
2 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
3 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/undef.s -o %t2.o
4 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/undef-debug.s -o %t3.o
5 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/undef-bad-debug.s -o %t4.o
6 # RUN: rm -f %t2.a
7 # RUN: llvm-ar rc %t2.a %t2.o
8 # RUN: not ld.lld --threads=1 %t.o %t2.a %t3.o %t4.o -o /dev/null 2>&1 \
9 # RUN: | FileCheck %s --implicit-check-not="error:" --implicit-check-not="warning:"
10 # RUN: not ld.lld --threads=1 -pie %t.o %t2.a %t3.o %t4.o -o /dev/null 2>&1 \
11 # RUN: | FileCheck %s --implicit-check-not="error:" --implicit-check-not="warning:"
13 # CHECK: error: undefined symbol: foo
14 # CHECK-NEXT: >>> referenced by undef.s
15 # CHECK-NEXT: {{.*}}:(.text+0x1)
17 # CHECK: error: undefined symbol: bar
18 # CHECK-NEXT: >>> referenced by undef.s
19 # CHECK-NEXT: >>> {{.*}}:(.text+0x6)
21 # CHECK: error: undefined symbol: foo(int)
22 # CHECK-NEXT: >>> referenced by undef.s
23 # CHECK-NEXT: >>> {{.*}}:(.text+0x10)
25 # CHECK: error: undefined symbol: vtable for Foo
26 # CHECK-NEXT: >>> referenced by undef.s
27 # CHECK-NEXT: >>> {{.*}}:(.text+0x15)
28 # CHECK-NEXT: >>> the vtable symbol may be undefined because the class is missing its key function (see https://lld.llvm.org/missingkeyfunction)
30 # CHECK: error: undefined symbol: foo(int)
31 # CHECK-NEXT: >>> referenced by undef.s
32 # CHECK-NEXT: >>> {{.*}}:(.text+0x1A)
34 # CHECK: error: undefined symbol: Pi
35 # CHECK-NEXT: >>> referenced by undef.s
36 # CHECK-NEXT: >>> {{.*}}:(.text+0x1F)
38 # CHECK: error: undefined symbol: D main
39 # CHECK-NEXT: >>> referenced by undef.s
40 # CHECK-NEXT: >>> {{.*}}:(.text+0x24)
42 # CHECK: error: undefined symbol: a::main
43 # CHECK-NEXT: >>> referenced by undef.s
44 # CHECK-NEXT: >>> {{.*}}:(.text+0x29)
46 # CHECK: error: undefined symbol: zed2
47 # CHECK-NEXT: >>> referenced by {{.*}}.o:(.text+0x0) in archive {{.*}}2.a
49 # CHECK: error: undefined symbol: zed3
50 # CHECK-NEXT: >>> referenced by undef-debug.s:3 (dir{{/|\\}}undef-debug.s:3)
51 # CHECK-NEXT: >>> {{.*}}.o:(.text+0x0)
53 # CHECK: error: undefined symbol: zed4
54 # CHECK-NEXT: >>> referenced by undef-debug.s:7 (dir{{/|\\}}undef-debug.s:7)
55 # CHECK-NEXT: >>> {{.*}}.o:(.text.1+0x0)
57 # CHECK: error: undefined symbol: zed5
58 # CHECK-NEXT: >>> referenced by undef-debug.s:11 (dir{{/|\\}}undef-debug.s:11)
59 # CHECK-NEXT: >>> {{.*}}.o:(.text.2+0x0)
61 # Show that all line table problems are mentioned as soon as the object's line information
62 # is requested, even if that particular part of the line information is not currently required.
63 # Also show that the warnings are only printed once.
64 # CHECK: warning: unknown data in line table prologue at offset 0x00000000: parsing ended (at offset 0x00000037) before reaching the prologue end at offset 0x00000038
65 # CHECK-NEXT: warning: parsing line table prologue at offset 0x0000005b: unsupported version 1
66 # CHECK-NEXT: warning: last sequence in debug line table at offset 0x00000061 is not terminated
67 # CHECK: error: undefined symbol: zed6a
68 # CHECK-NEXT: >>> referenced by undef-bad-debug.s:11 (dir{{/|\\}}undef-bad-debug.s:11)
69 # CHECK-NEXT: >>> {{.*}}4.o:(.text+0x0)
70 # CHECK: error: undefined symbol: zed6b
71 # CHECK-NEXT: >>> referenced by undef-bad-debug.s:21 (dir{{/|\\}}undef-bad-debug.s:21)
72 # CHECK-NEXT: >>> {{.*}}4.o:(.text+0x8)
74 # Show that a problem in a line table that prevents further parsing of that
75 # table means that no line information is displayed in the wardning.
76 # CHECK: error: undefined symbol: zed7
77 # CHECK-NEXT: >>> referenced by {{.*}}4.o:(.text+0x10)
79 # Show that a problem with one line table's information doesn't affect getting information from
80 # a different one in the same object.
81 # CHECK: error: undefined symbol: zed8
82 # CHECK-NEXT: >>> referenced by undef-bad-debug2.s:11 (dir2{{/|\\}}undef-bad-debug2.s:11)
83 # CHECK-NEXT: >>> {{.*}}tmp4.o:(.text+0x18)
85 # RUN: not ld.lld %t.o %t2.a -o /dev/null -no-demangle 2>&1 | \
86 # RUN: FileCheck -check-prefix=NO-DEMANGLE %s
87 # NO-DEMANGLE: error: undefined symbol: _Z3fooi
89 .file "undef.s"
91 .globl _start
92 _start:
93 call foo
94 call bar
95 call zed1
96 call _Z3fooi
97 call _ZTV3Foo
98 call __Z3fooi
99 call Pi
100 call _Dmain
101 call _RNvC1a4main