99 lines · plain
1# REQUIRES: x862# Test -y symbol and -trace-symbol=symbol3 4# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t5# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux \6# RUN: %p/Inputs/trace-symbols-foo-weak.s -o %t17# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux \8# RUN: %p/Inputs/trace-symbols-foo-strong.s -o %t29# RUN: ld.lld -shared %t1 -o %t1.so10# RUN: ld.lld -shared %t2 -o %t2.so11# RUN: rm -f %t1.a12# RUN: llvm-ar rcs %t1.a %t113# RUN: rm -f %t2.a14# RUN: llvm-ar rcs %t2.a %t215 16# RUN: ld.lld -y foo -shared %t1 %t1.so -o /dev/null | \17# RUN: FileCheck --check-prefix=PREEMPT %s --implicit-check-not=foo18# PREEMPT: trace-symbols.s.tmp1: definition of foo19# PREEMPT-NEXT: trace-symbols.s.tmp1.so: shared definition of foo20 21# RUN: ld.lld -y foo -trace-symbol common -trace-symbol=hsymbol \22# RUN: %t %t1 %t2 -o %t3 | FileCheck -check-prefix=OBJECTRFOO %s23# OBJECTRFOO: trace-symbols.s.tmp: reference to foo24 25# RUN: ld.lld -y foo -trace-symbol=common -trace-symbol=hsymbol \26# RUN: %t %t1 %t2 -o %t3 | FileCheck -check-prefix=OBJECTDCOMMON %s27# OBJECTDCOMMON: trace-symbols.s.tmp1: common definition of common28 29# RUN: ld.lld -y foo -trace-symbol=common -trace-symbol=hsymbol \30# RUN: %t %t1 %t2 -o %t3 | FileCheck -check-prefix=OBJECTD1FOO %s31# OBJECTD1FOO: trace-symbols.s.tmp: reference to foo32# OBJECTD1FOO: trace-symbols.s.tmp1: common definition of common33# OBJECTD1FOO: trace-symbols.s.tmp1: definition of foo34# OBJECTD1FOO: trace-symbols.s.tmp2: definition of foo35 36# RUN: ld.lld -y foo %t1 %t2 %t -o %t3 | FileCheck -check-prefix=REFLAST %s37# REFLAST: trace-symbols.s.tmp1: definition of foo38# REFLAST: trace-symbols.s.tmp2: definition of foo39# REFLAST: trace-symbols.s.tmp: reference to foo40 41# RUN: ld.lld -y foo -trace-symbol=common -trace-symbol=hsymbol \42# RUN: %t %t1 %t2 -o %t3 | FileCheck -check-prefix=OBJECTD2FOO %s43# RUN: ld.lld -y foo -y common --trace-symbol=hsymbol \44# RUN: %t %t2 %t1 -o %t3 | FileCheck -check-prefix=OBJECTD2FOO %s45# RUN: ld.lld -y foo -y common %t %t1.so %t2 -o %t3 | \46# RUN: FileCheck -check-prefix=OBJECTD2FOO %s47# OBJECTD2FOO: trace-symbols.s.tmp2: definition of foo48 49# RUN: ld.lld -y foo -y common %t %t2 %t1.a -o %t3 | \50# RUN: FileCheck -check-prefix=FOO_AND_COMMON %s51# FOO_AND_COMMON: trace-symbols.s.tmp: reference to foo52# FOO_AND_COMMON: trace-symbols.s.tmp2: definition of foo53# FOO_AND_COMMON: trace-symbols.s.tmp1.a({{.*}}.tmp1): lazy definition of common54 55# RUN: ld.lld -y foo -y common %t %t1.so %t2 -o %t3 | \56# RUN: FileCheck -check-prefix=SHLIBDCOMMON %s57# SHLIBDCOMMON: trace-symbols.s.tmp1.so: shared definition of common58 59# RUN: ld.lld -y foo -y common %t %t2.so %t1.so -o %t3 | \60# RUN: FileCheck -check-prefix=SHLIBD2FOO %s61# RUN: ld.lld -y foo %t %t1.a %t2.so -o %t3 | \62# RUN: FileCheck -check-prefix=NO-SHLIBD2FOO %s63# SHLIBD2FOO: trace-symbols.s.tmp2.so: shared definition of foo64# NO-SHLIBD2FOO-NOT: trace-symbols.s.tmp2.so: definition of foo65 66# RUN: ld.lld -y foo -y common %t %t2 %t1.a -o %t3 | \67# RUN: FileCheck -check-prefix=ARCHIVEDCOMMON %s68# ARCHIVEDCOMMON-NOT: trace-symbols.s.tmp1.a(trace-symbols.s.tmp1): definition of \69# common70 71# RUN: ld.lld -y foo %t %t1.a %t2.so -o %t3 | \72# RUN: FileCheck -check-prefix=ARCHIVED1FOO %s73# ARCHIVED1FOO: trace-symbols.s.tmp1.a(trace-symbols.s.tmp1): definition of foo74 75# RUN: ld.lld -y foo %t %t1.a %t2.a -o %t3 | \76# RUN: FileCheck -check-prefix=ARCHIVED2FOO %s77# ARCHIVED2FOO: trace-symbols.s.tmp2.a(trace-symbols.s.tmp2): definition of foo78 79# RUN: ld.lld -y bar %t %t1.so %t2.so -o %t3 | \80# RUN: FileCheck -check-prefix=SHLIBDBAR %s81# SHLIBDBAR: trace-symbols.s.tmp2.so: shared definition of bar82 83# RUN: ld.lld -y foo -y bar %t %t1.so %t2.so -o %t3 | \84# RUN: FileCheck -check-prefix=SHLIBRBAR %s85# SHLIBRBAR: trace-symbols.s.tmp1.so: reference to bar86 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 %s89# STARTLIB: trace-symbols.s.tmp1: reference to bar90 91## Check we do not crash when trying to trace special symbol.92# RUN: ld.lld -trace-symbol=_end %t %t1 %t2 -o /dev/null93 94.hidden hsymbol95.globl _start96.type _start, @function97_start:98call foo99