2 # Test -y symbol and -trace-symbol=symbol
4 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
5 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux \
6 # RUN: %p/Inputs/trace-symbols-foo-weak.s -o %t1
7 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux \
8 # RUN: %p/Inputs/trace-symbols-foo-strong.s -o %t2
9 # RUN: ld.lld -shared %t1 -o %t1.so
10 # RUN: ld.lld -shared %t2 -o %t2.so
12 # RUN: llvm-ar rcs %t1.a %t1
14 # RUN: llvm-ar rcs %t2.a %t2
16 # RUN: ld.lld -y foo -shared %t1 %t1.so -o /dev/null | \
17 # RUN: FileCheck --check-prefix=PREEMPT %s --implicit-check-not=foo
18 # PREEMPT: trace-symbols.s.tmp1: definition of foo
19 # PREEMPT-NEXT: trace-symbols.s.tmp1.so: shared definition of foo
21 # RUN: ld.lld -y foo -trace-symbol common -trace-symbol=hsymbol \
22 # RUN: %t %t1 %t2 -o %t3 | FileCheck -check-prefix=OBJECTRFOO %s
23 # OBJECTRFOO: trace-symbols.s.tmp: reference to foo
25 # RUN: ld.lld -y foo -trace-symbol=common -trace-symbol=hsymbol \
26 # RUN: %t %t1 %t2 -o %t3 | FileCheck -check-prefix=OBJECTDCOMMON %s
27 # OBJECTDCOMMON: trace-symbols.s.tmp1: common definition of common
29 # RUN: ld.lld -y foo -trace-symbol=common -trace-symbol=hsymbol \
30 # RUN: %t %t1 %t2 -o %t3 | FileCheck -check-prefix=OBJECTD1FOO %s
31 # OBJECTD1FOO: trace-symbols.s.tmp: reference to foo
32 # OBJECTD1FOO: trace-symbols.s.tmp1: common definition of common
33 # OBJECTD1FOO: trace-symbols.s.tmp1: definition of foo
34 # OBJECTD1FOO: trace-symbols.s.tmp2: definition of foo
36 # RUN: ld.lld -y foo %t1 %t2 %t -o %t3 | FileCheck -check-prefix=REFLAST %s
37 # REFLAST: trace-symbols.s.tmp1: definition of foo
38 # REFLAST: trace-symbols.s.tmp2: definition of foo
39 # REFLAST: trace-symbols.s.tmp: reference to foo
41 # RUN: ld.lld -y foo -trace-symbol=common -trace-symbol=hsymbol \
42 # RUN: %t %t1 %t2 -o %t3 | FileCheck -check-prefix=OBJECTD2FOO %s
43 # RUN: ld.lld -y foo -y common --trace-symbol=hsymbol \
44 # RUN: %t %t2 %t1 -o %t3 | FileCheck -check-prefix=OBJECTD2FOO %s
45 # RUN: ld.lld -y foo -y common %t %t1.so %t2 -o %t3 | \
46 # RUN: FileCheck -check-prefix=OBJECTD2FOO %s
47 # OBJECTD2FOO: trace-symbols.s.tmp2: definition of foo
49 # RUN: ld.lld -y foo -y common %t %t2 %t1.a -o %t3 | \
50 # RUN: FileCheck -check-prefix=FOO_AND_COMMON %s
51 # FOO_AND_COMMON: trace-symbols.s.tmp: reference to foo
52 # FOO_AND_COMMON: trace-symbols.s.tmp2: definition of foo
53 # FOO_AND_COMMON: trace-symbols.s.tmp1.a({{.*}}.tmp1): lazy definition of common
55 # RUN: ld.lld -y foo -y common %t %t1.so %t2 -o %t3 | \
56 # RUN: FileCheck -check-prefix=SHLIBDCOMMON %s
57 # SHLIBDCOMMON: trace-symbols.s.tmp1.so: shared definition of common
59 # RUN: ld.lld -y foo -y common %t %t2.so %t1.so -o %t3 | \
60 # RUN: FileCheck -check-prefix=SHLIBD2FOO %s
61 # RUN: ld.lld -y foo %t %t1.a %t2.so -o %t3 | \
62 # RUN: FileCheck -check-prefix=NO-SHLIBD2FOO %s
63 # SHLIBD2FOO: trace-symbols.s.tmp2.so: shared definition of foo
64 # NO-SHLIBD2FOO-NOT: trace-symbols.s.tmp2.so: definition of foo
66 # RUN: ld.lld -y foo -y common %t %t2 %t1.a -o %t3 | \
67 # RUN: FileCheck -check-prefix=ARCHIVEDCOMMON %s
68 # ARCHIVEDCOMMON-NOT: trace-symbols.s.tmp1.a(trace-symbols.s.tmp1): definition of \
71 # RUN: ld.lld -y foo %t %t1.a %t2.so -o %t3 | \
72 # RUN: FileCheck -check-prefix=ARCHIVED1FOO %s
73 # ARCHIVED1FOO: trace-symbols.s.tmp1.a(trace-symbols.s.tmp1): definition of foo
75 # RUN: ld.lld -y foo %t %t1.a %t2.a -o %t3 | \
76 # RUN: FileCheck -check-prefix=ARCHIVED2FOO %s
77 # ARCHIVED2FOO: trace-symbols.s.tmp2.a(trace-symbols.s.tmp2): definition of foo
79 # RUN: ld.lld -y bar %t %t1.so %t2.so -o %t3 | \
80 # RUN: FileCheck -check-prefix=SHLIBDBAR %s
81 # SHLIBDBAR: trace-symbols.s.tmp2.so: shared definition of bar
83 # RUN: ld.lld -y foo -y bar %t %t1.so %t2.so -o %t3 | \
84 # RUN: FileCheck -check-prefix=SHLIBRBAR %s
85 # SHLIBRBAR: trace-symbols.s.tmp1.so: reference to bar
87 # RUN: ld.lld -y foo -y bar %t -u bar --start-lib %t1 %t2 --end-lib -o %t3 | \
88 # RUN: FileCheck -check-prefix=STARTLIB %s
89 # STARTLIB: trace-symbols.s.tmp1: reference to bar
91 ## Check we do not crash when trying to trace special symbol.
92 # RUN: ld.lld -trace-symbol=_end %t %t1 %t2 -o /dev/null
96 .type _start, @function