1# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
3# RUN: echo '{ global: foo; };' > %tg.ver
4# RUN: echo '{ local: foo; };' > %tl.ver
5# RUN: echo '{ global: foo; local: *; };' > %tgl.ver
6# RUN: echo 'V1 { global: foo; };' > %t1.ver
7# RUN: echo 'V2 { global: foo; };' > %t2.ver
8# RUN: echo 'V2 { global: notexist; local: f*; };' > %t2w.ver
9
10## Note, ld.bfd errors on these cases.
11# RUN: ld.lld -shared %t.o --version-script %tl.ver --version-script %t1.ver \
12# RUN:   -o %t.so 2>&1 | FileCheck --check-prefix=LOCAL %s
13# RUN: llvm-readelf --dyn-syms %t.so | FileCheck --check-prefix=LOCAL-SYM %s
14# RUN: ld.lld -shared %t.o --version-script %tg.ver --version-script %t1.ver \
15# RUN:   -o %t.so 2>&1 | FileCheck --check-prefix=GLOBAL %s
16# RUN: llvm-readelf --dyn-syms %t.so | FileCheck --check-prefix=GLOBAL-SYM %s
17# RUN: ld.lld -shared %t.o --version-script %tgl.ver --version-script %t1.ver \
18# RUN:   -o %t.so 2>&1 | FileCheck --check-prefix=GLOBAL %s
19# RUN: llvm-readelf --dyn-syms %t.so | FileCheck --check-prefix=GLOBAL-SYM %s
20
21## Note, ld.bfd silently accepts this case.
22# RUN: ld.lld -shared %t.o --version-script %t1.ver --version-script %t2.ver \
23# RUN:   -o %t.so 2>&1 | FileCheck --check-prefix=V1-WARN %s
24# RUN: llvm-readelf --dyn-syms %t.so | FileCheck --check-prefix=V1-SYM %s
25
26# RUN: ld.lld -shared %t.o --version-script %t1.ver --version-script %t2w.ver \
27# RUN:   -o %t.so --fatal-warnings
28# RUN: llvm-readelf --dyn-syms %t.so | FileCheck --check-prefix=V1-SYM %s
29
30# LOCAL: warning: attempt to reassign symbol 'foo' of VER_NDX_LOCAL to version 'V1'
31# LOCAL-SYM-NOT: foo
32
33# GLOBAL: warning: attempt to reassign symbol 'foo' of VER_NDX_GLOBAL to version 'V1'
34# GLOBAL-SYM: foo{{$}}
35
36# V1-WARN: warning: attempt to reassign symbol 'foo' of version 'V1' to version 'V2'
37# V1-SYM: foo@@V1
38
39.globl foo
40foo:
41