94 lines · plain
1# REQUIRES: x862 3# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/shared.s -o %t2.o4# RUN: ld.lld -shared %t2.o -soname shared -o %t2.so5 6# RUN: echo "{ global: foo1; foo3; local: *; };" > %t.script7# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o8# RUN: ld.lld --version-script %t.script -shared %t.o %t2.so -o %t.so --fatal-warnings9# RUN: llvm-readelf --dyn-syms %t.so | FileCheck --check-prefix=DSO %s10 11# RUN: echo "# comment" > %t3.script12# RUN: echo "{ local: *; # comment" >> %t3.script13# RUN: echo -n "}; # comment" >> %t3.script14# RUN: ld.lld --version-script %t3.script -shared %t.o %t2.so -o %t3.so15# RUN: llvm-readelf --dyn-syms %t3.so | FileCheck --check-prefix=DSO2 %s16 17## Also check that both "global:" and "global :" forms are accepted18# RUN: echo "VERSION_1.0 { global : foo1; local : *; };" > %t4.script19# RUN: echo "VERSION_2.0 { global: foo3; local: *; };" >> %t4.script20# RUN: ld.lld --version-script %t4.script -shared %t.o %t2.so -o %t4.so --fatal-warnings21# RUN: llvm-readelf --dyn-syms %t4.so | FileCheck --check-prefix=VERDSO %s22 23# RUN: echo "VERSION_1.0 { global: foo1; local: *; };" > %t5.script24# RUN: echo "{ global: foo3; local: *; };" >> %t5.script25# RUN: not ld.lld --version-script %t5.script -shared %t.o %t2.so -o /dev/null 2>&1 | \26# RUN: FileCheck -check-prefix=ERR1 %s27# ERR1: anonymous version definition is used in combination with other version definitions28 29# RUN: echo "{ global: foo1; local: *; };" > %t5.script30# RUN: echo "VERSION_2.0 { global: foo3; local: *; };" >> %t5.script31# RUN: not ld.lld --version-script %t5.script -shared %t.o %t2.so -o /dev/null 2>&1 | \32# RUN: FileCheck -check-prefix=ERR2 %s33# ERR2: EOF expected, but got VERSION_2.034 35# RUN: echo "{ foo1; foo2; };" > %t.list36# RUN: ld.lld --version-script %t.script --dynamic-list %t.list %t.o %t2.so -o %t237# RUN: llvm-readobj %t2 > /dev/null38 39## Check that we can handle multiple "--version-script" options.40# RUN: echo "VERSION_1.0 { global : foo1; local : *; };" > %t7a.script41# RUN: echo "VERSION_2.0 { global: foo3; local: *; };" > %t7b.script42# RUN: ld.lld --version-script %t7a.script --version-script %t7b.script -shared %t.o %t2.so -o %t7.so43# RUN: llvm-readelf --dyn-syms %t7.so | FileCheck --check-prefix=VERDSO %s44 45# DSO: bar{{$}}46# DSO-NEXT: foo1{{$}}47# DSO-NEXT: foo3{{$}}48# DSO-NOT: {{.}}49 50# DSO2: bar{{$}}51# DSO2-NOT: {{.}}52 53# VERDSO: bar{{$}}54# VERDSO-NEXT: foo1@@VERSION_1.055# VERDSO-NEXT: foo3@@VERSION_2.056# VERDSO-NOT: {{.}}57 58# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o59# RUN: ld.lld --hash-style=sysv -shared %t.o %t2.so -o %t.so60# RUN: llvm-readelf --dyn-syms %t.so | FileCheck --check-prefix=ALL %s61 62# RUN: echo "{ global: foo1; foo3; };" > %t2.script63# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o64# RUN: ld.lld --hash-style=sysv --version-script %t2.script -shared %t.o %t2.so -o %t.so65# RUN: llvm-readelf --dyn-syms %t.so | FileCheck --check-prefix=ALL %s66 67# ALL: foo1{{$}}68# ALL-NEXT: bar{{$}}69# ALL-NEXT: foo2{{$}}70# ALL-NEXT: foo3{{$}}71# ALL-NEXT: _start{{$}}72# ALL-NOT: {{.}}73 74# RUN: echo "VERSION_1.0 { global: foo1; foo1; local: *; };" > %t8.script75# RUN: ld.lld --version-script %t8.script -shared %t.o -o /dev/null --fatal-warnings76 77.globl foo178foo1:79 call bar@PLT80 ret81 82.globl foo283foo2:84 ret85 86.globl foo387foo3:88 call foo2@PLT89 ret90 91.globl _start92_start:93 ret94