3 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/shared.s -o %t2.o
4 # RUN: ld.lld -shared %t2.o -soname shared -o %t2.so
6 # RUN: echo "{ global: foo1; foo3; local: *; };" > %t.script
7 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
8 # RUN: ld.lld --version-script %t.script -shared %t.o %t2.so -o %t.so --fatal-warnings
9 # RUN: llvm-readelf --dyn-syms %t.so | FileCheck --check-prefix=DSO %s
11 # RUN: echo "# comment" > %t3.script
12 # RUN: echo "{ local: *; # comment" >> %t3.script
13 # RUN: echo -n "}; # comment" >> %t3.script
14 # RUN: ld.lld --version-script %t3.script -shared %t.o %t2.so -o %t3.so
15 # RUN: llvm-readelf --dyn-syms %t3.so | FileCheck --check-prefix=DSO2 %s
17 ## Also check that both "global:" and "global :" forms are accepted
18 # RUN: echo "VERSION_1.0 { global : foo1; local : *; };" > %t4.script
19 # RUN: echo "VERSION_2.0 { global: foo3; local: *; };" >> %t4.script
20 # RUN: ld.lld --version-script %t4.script -shared %t.o %t2.so -o %t4.so --fatal-warnings
21 # RUN: llvm-readelf --dyn-syms %t4.so | FileCheck --check-prefix=VERDSO %s
23 # RUN: echo "VERSION_1.0 { global: foo1; local: *; };" > %t5.script
24 # RUN: echo "{ global: foo3; local: *; };" >> %t5.script
25 # RUN: not ld.lld --version-script %t5.script -shared %t.o %t2.so -o /dev/null 2>&1 | \
26 # RUN: FileCheck -check-prefix=ERR1 %s
27 # ERR1: anonymous version definition is used in combination with other version definitions
29 # RUN: echo "{ global: foo1; local: *; };" > %t5.script
30 # RUN: echo "VERSION_2.0 { global: foo3; local: *; };" >> %t5.script
31 # RUN: not ld.lld --version-script %t5.script -shared %t.o %t2.so -o /dev/null 2>&1 | \
32 # RUN: FileCheck -check-prefix=ERR2 %s
33 # ERR2: EOF expected, but got VERSION_2.0
35 # RUN: echo "{ foo1; foo2; };" > %t.list
36 # RUN: ld.lld --version-script %t.script --dynamic-list %t.list %t.o %t2.so -o %t2
37 # RUN: llvm-readobj %t2 > /dev/null
39 ## Check that we can handle multiple "--version-script" options.
40 # RUN: echo "VERSION_1.0 { global : foo1; local : *; };" > %t7a.script
41 # RUN: echo "VERSION_2.0 { global: foo3; local: *; };" > %t7b.script
42 # RUN: ld.lld --version-script %t7a.script --version-script %t7b.script -shared %t.o %t2.so -o %t7.so
43 # RUN: llvm-readelf --dyn-syms %t7.so | FileCheck --check-prefix=VERDSO %s
54 # VERDSO-NEXT: foo1@@VERSION_1.0
55 # VERDSO-NEXT: foo3@@VERSION_2.0
58 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
59 # RUN: ld.lld --hash-style=sysv -shared %t.o %t2.so -o %t.so
60 # RUN: llvm-readelf --dyn-syms %t.so | FileCheck --check-prefix=ALL %s
62 # RUN: echo "{ global: foo1; foo3; };" > %t2.script
63 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
64 # RUN: ld.lld --hash-style=sysv --version-script %t2.script -shared %t.o %t2.so -o %t.so
65 # RUN: llvm-readelf --dyn-syms %t.so | FileCheck --check-prefix=ALL %s
71 # ALL-NEXT: _start{{$}}
74 # RUN: echo "VERSION_1.0 { global: foo1; foo1; local: *; };" > %t8.script
75 # RUN: ld.lld --version-script %t8.script -shared %t.o -o /dev/null --fatal-warnings