2018-06-06 21:56:51 +08:00
|
|
|
# REQUIRES: x86
|
2016-06-23 15:00:17 +08:00
|
|
|
# Test -y symbol and -trace-symbol=symbol
|
|
|
|
|
|
|
|
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
|
|
|
|
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux \
|
|
|
|
# RUN: %p/Inputs/trace-symbols-foo-weak.s -o %t1
|
|
|
|
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux \
|
|
|
|
# RUN: %p/Inputs/trace-symbols-foo-strong.s -o %t2
|
|
|
|
# RUN: ld.lld -shared %t1 -o %t1.so
|
|
|
|
# RUN: ld.lld -shared %t2 -o %t2.so
|
2018-08-02 19:33:54 +08:00
|
|
|
# RUN: rm -f %t1.a
|
2016-06-23 15:14:09 +08:00
|
|
|
# RUN: llvm-ar rcs %t1.a %t1
|
2018-08-02 19:33:54 +08:00
|
|
|
# RUN: rm -f %t2.a
|
2016-06-23 15:14:09 +08:00
|
|
|
# RUN: llvm-ar rcs %t2.a %t2
|
2016-06-23 15:00:17 +08:00
|
|
|
|
2020-05-19 01:15:59 +08:00
|
|
|
# RUN: ld.lld -y foo -shared %t1 %t1.so -o /dev/null | \
|
|
|
|
# RUN: FileCheck --check-prefix=PREEMPT %s --implicit-check-not=foo
|
|
|
|
# PREEMPT: trace-symbols.s.tmp1: definition of foo
|
|
|
|
# PREEMPT-NEXT: trace-symbols.s.tmp1.so: shared definition of foo
|
|
|
|
|
2017-02-02 10:21:47 +08:00
|
|
|
# RUN: ld.lld -y foo -trace-symbol common -trace-symbol=hsymbol \
|
2019-05-16 03:01:51 +08:00
|
|
|
# RUN: %t %t1 %t2 -o %t3 | FileCheck -check-prefix=OBJECTRFOO %s
|
2016-06-23 15:00:17 +08:00
|
|
|
# OBJECTRFOO: trace-symbols.s.tmp: reference to foo
|
|
|
|
|
|
|
|
# RUN: ld.lld -y foo -trace-symbol=common -trace-symbol=hsymbol \
|
2019-05-16 03:01:51 +08:00
|
|
|
# RUN: %t %t1 %t2 -o %t3 | FileCheck -check-prefix=OBJECTDCOMMON %s
|
2016-07-18 01:50:09 +08:00
|
|
|
# OBJECTDCOMMON: trace-symbols.s.tmp1: common definition of common
|
2016-06-23 15:00:17 +08:00
|
|
|
|
|
|
|
# RUN: ld.lld -y foo -trace-symbol=common -trace-symbol=hsymbol \
|
2019-05-16 03:01:51 +08:00
|
|
|
# RUN: %t %t1 %t2 -o %t3 | FileCheck -check-prefix=OBJECTD1FOO %s
|
2016-07-18 01:50:09 +08:00
|
|
|
# OBJECTD1FOO: trace-symbols.s.tmp: reference to foo
|
|
|
|
# OBJECTD1FOO: trace-symbols.s.tmp1: common definition of common
|
|
|
|
# OBJECTD1FOO: trace-symbols.s.tmp1: definition of foo
|
|
|
|
# OBJECTD1FOO: trace-symbols.s.tmp2: definition of foo
|
2016-06-23 15:00:17 +08:00
|
|
|
|
2019-05-24 21:29:17 +08:00
|
|
|
# RUN: ld.lld -y foo %t1 %t2 %t -o %t3 | FileCheck -check-prefix=REFLAST %s
|
|
|
|
# REFLAST: trace-symbols.s.tmp1: definition of foo
|
|
|
|
# REFLAST: trace-symbols.s.tmp2: definition of foo
|
|
|
|
# REFLAST: trace-symbols.s.tmp: reference to foo
|
|
|
|
|
2016-06-23 15:00:17 +08:00
|
|
|
# RUN: ld.lld -y foo -trace-symbol=common -trace-symbol=hsymbol \
|
2019-05-16 03:01:51 +08:00
|
|
|
# RUN: %t %t1 %t2 -o %t3 | FileCheck -check-prefix=OBJECTD2FOO %s
|
2016-06-23 15:00:17 +08:00
|
|
|
# RUN: ld.lld -y foo -y common --trace-symbol=hsymbol \
|
2019-05-24 21:29:17 +08:00
|
|
|
# RUN: %t %t2 %t1 -o %t3 | FileCheck -check-prefix=OBJECTD2FOO %s
|
2019-05-16 03:01:51 +08:00
|
|
|
# RUN: ld.lld -y foo -y common %t %t1.so %t2 -o %t3 | \
|
2016-06-23 15:00:17 +08:00
|
|
|
# RUN: FileCheck -check-prefix=OBJECTD2FOO %s
|
|
|
|
# OBJECTD2FOO: trace-symbols.s.tmp2: definition of foo
|
|
|
|
|
2019-05-16 03:01:51 +08:00
|
|
|
# RUN: ld.lld -y foo -y common %t %t2 %t1.a -o %t3 | \
|
2017-10-28 02:30:11 +08:00
|
|
|
# RUN: FileCheck -check-prefix=FOO_AND_COMMON %s
|
|
|
|
# FOO_AND_COMMON: trace-symbols.s.tmp: reference to foo
|
|
|
|
# FOO_AND_COMMON: trace-symbols.s.tmp2: definition of foo
|
|
|
|
# FOO_AND_COMMON: trace-symbols.s.tmp1.a: lazy definition of common
|
|
|
|
|
2019-05-16 03:01:51 +08:00
|
|
|
# RUN: ld.lld -y foo -y common %t %t1.so %t2 -o %t3 | \
|
2016-06-23 15:00:17 +08:00
|
|
|
# RUN: FileCheck -check-prefix=SHLIBDCOMMON %s
|
2017-10-28 02:30:11 +08:00
|
|
|
# SHLIBDCOMMON: trace-symbols.s.tmp1.so: shared definition of common
|
2016-06-23 15:00:17 +08:00
|
|
|
|
2019-05-16 03:01:51 +08:00
|
|
|
# RUN: ld.lld -y foo -y common %t %t2.so %t1.so -o %t3 | \
|
2016-06-23 15:00:17 +08:00
|
|
|
# RUN: FileCheck -check-prefix=SHLIBD2FOO %s
|
|
|
|
# RUN: ld.lld -y foo %t %t1.a %t2.so -o %t3 | \
|
2016-07-17 09:34:39 +08:00
|
|
|
# RUN: FileCheck -check-prefix=NO-SHLIBD2FOO %s
|
2017-10-28 02:30:11 +08:00
|
|
|
# SHLIBD2FOO: trace-symbols.s.tmp2.so: shared definition of foo
|
2016-07-17 09:34:39 +08:00
|
|
|
# NO-SHLIBD2FOO-NOT: trace-symbols.s.tmp2.so: definition of foo
|
2016-06-23 15:00:17 +08:00
|
|
|
|
2019-05-16 03:01:51 +08:00
|
|
|
# RUN: ld.lld -y foo -y common %t %t2 %t1.a -o %t3 | \
|
2016-07-17 09:34:39 +08:00
|
|
|
# RUN: FileCheck -check-prefix=ARCHIVEDCOMMON %s
|
|
|
|
# ARCHIVEDCOMMON-NOT: trace-symbols.s.tmp1.a(trace-symbols.s.tmp1): definition of \
|
2016-06-23 15:00:17 +08:00
|
|
|
# common
|
|
|
|
|
|
|
|
# RUN: ld.lld -y foo %t %t1.a %t2.so -o %t3 | \
|
|
|
|
# RUN: FileCheck -check-prefix=ARCHIVED1FOO %s
|
|
|
|
# ARCHIVED1FOO: trace-symbols.s.tmp1.a(trace-symbols.s.tmp1): definition of foo
|
|
|
|
|
|
|
|
# RUN: ld.lld -y foo %t %t1.a %t2.a -o %t3 | \
|
|
|
|
# RUN: FileCheck -check-prefix=ARCHIVED2FOO %s
|
|
|
|
# ARCHIVED2FOO: trace-symbols.s.tmp2.a(trace-symbols.s.tmp2): definition of foo
|
|
|
|
|
|
|
|
# RUN: ld.lld -y bar %t %t1.so %t2.so -o %t3 | \
|
|
|
|
# RUN: FileCheck -check-prefix=SHLIBDBAR %s
|
2017-10-28 02:30:11 +08:00
|
|
|
# SHLIBDBAR: trace-symbols.s.tmp2.so: shared definition of bar
|
2016-06-23 15:00:17 +08:00
|
|
|
|
|
|
|
# RUN: ld.lld -y foo -y bar %t %t1.so %t2.so -o %t3 | \
|
2016-07-17 09:34:39 +08:00
|
|
|
# RUN: FileCheck -check-prefix=SHLIBRBAR %s
|
2018-02-28 04:31:22 +08:00
|
|
|
# SHLIBRBAR: trace-symbols.s.tmp1.so: reference to bar
|
2016-06-23 15:00:17 +08:00
|
|
|
|
|
|
|
# RUN: ld.lld -y foo -y bar %t -u bar --start-lib %t1 %t2 --end-lib -o %t3 | \
|
|
|
|
# RUN: FileCheck -check-prefix=STARTLIB %s
|
|
|
|
# STARTLIB: trace-symbols.s.tmp1: reference to bar
|
|
|
|
|
2018-07-05 20:48:29 +08:00
|
|
|
## Check we do not crash when trying to trace special symbol.
|
2019-05-16 03:01:51 +08:00
|
|
|
# RUN: ld.lld -trace-symbol=_end %t %t1 %t2 -o /dev/null
|
2018-07-05 20:48:29 +08:00
|
|
|
|
2016-06-23 15:00:17 +08:00
|
|
|
.hidden hsymbol
|
|
|
|
.globl _start
|
|
|
|
.type _start, @function
|
|
|
|
_start:
|
|
|
|
call foo
|