[llvm] Do not replace dead constant references in metadata with undef
[llvm-project.git] / lld / test / ELF / cref.s
blob662a2ce339c33948e06dd86cb5791154e6b005c0
1 // REQUIRES: x86
3 // RUN: echo '.global foo; foo:' | llvm-mc -filetype=obj -triple=x86_64-pc-linux - -o %t1.o
4 // RUN: echo '.global foo, bar; bar:' | llvm-mc -filetype=obj -triple=x86_64-pc-linux - -o %t2.o
5 // RUN: echo '.global zed; zed:' | llvm-mc -filetype=obj -triple=x86_64-pc-linux - -o %ta.o
6 // RUN: rm -f %t.a
7 // RUN: llvm-ar rcs %t.a %ta.o
8 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t3.o
9 // RUN: ld.lld -shared -o %t1.so %t1.o
10 // RUN: ld.lld -o /dev/null %t1.so %t2.o %t3.o %t.a --gc-sections --cref | FileCheck -strict-whitespace %s
12 /// If -Map is specified, print to the map file.
13 // RUN: ld.lld -o /dev/null %t1.so %t2.o %t3.o %t.a --gc-sections -Map=%t.map --cref
14 // RUN: FileCheck --input-file=%t.map %s --check-prefix=CHECK2
16 // CHECK: {{^$}}
17 // CHECK-NEXT: Cross Reference Table
18 // CHECK-EMPTY:
19 // CHECK-NEXT: Symbol File
20 // CHECK-NEXT: foo {{.*}}1.so
21 // CHECK-NEXT: {{.*}}2.o
22 // CHECK-NEXT: {{.*}}3.o
23 // CHECK-NEXT: bar {{.*}}2.o
24 // CHECK-NEXT: {{.*}}3.o
25 // CHECK-NEXT: _start {{.*}}3.o
26 // CHECK-NEXT: baz {{.*}}3.o
27 // CHECK-NEXT: zed {{.*}}.a({{.*}}a.o)
28 // CHECK-NEXT: {{.*}}3.o
29 // CHECK-NOT: discarded
31 // CHECK2: VMA LMA Size Align Out In Symbol
32 // CHECK2: .strtab
33 // CHECK2-NEXT: <internal>:(.strtab)
35 /// There is a blank line before the "Cross Reference Table" header.
36 // CHECK2-EMPTY:
37 // CHECK2-NEXT: Cross Reference Table
39 .global _start, foo, bar, baz, discarded
40 _start:
41 call foo
42 call bar
43 call zed
44 localsym:
45 baz:
47 .section .text.a,"ax",@progbits
48 discarded: