version-script.s
1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
# RUN: echo "bar = foo; VERSION { V { global: foo; bar; local: *; }; }" > %t.script
# RUN: ld.lld -T %t.script -shared --no-undefined-version %t.o -o %t.so
# RUN: llvm-readobj -V %t.so | FileCheck %s
# RUN: echo "SECTIONS { .text : { bar = foo; *(.text) } }" > %t.script
# RUN: echo "VERSION { V { global: foo; bar; local: *; }; }" >> %t.script
# RUN: ld.lld -T %t.script -shared --no-undefined-version %t.o -o %t.so
# RUN: llvm-readobj -V %t.so | FileCheck %s
## Check that we are able to version symbols defined in script.
# CHECK: VersionSymbols [
# CHECK-NEXT: Symbol {
# CHECK-NEXT: Version: 0
# CHECK-NEXT: Name:
# CHECK-NEXT: }
# CHECK-NEXT: Symbol {
# CHECK-NEXT: Version: 1
# CHECK-NEXT: Name: und
# CHECK-NEXT: }
# CHECK-NEXT: Symbol {
# CHECK-NEXT: Version: 2
# CHECK-NEXT: Name: foo@@V
# CHECK-NEXT: }
# CHECK-NEXT: Symbol {
# CHECK-NEXT: Version: 2
# CHECK-NEXT: Name: bar@@V
# CHECK-NEXT: }
# CHECK-NEXT: ]
# RUN: echo "bar = und; VERSION { V { global: foo; bar; local: *; }; }" > %t.script
# RUN: not ld.lld -T %t.script -shared --no-undefined-version %t.o -o %t.so \
# RUN: 2>&1 | FileCheck --check-prefix=ERR %s
# ERR: symbol not found: und
# RUN: echo "und = 0x1; VERSION { V { global: und; local: *; }; }" > %t.script
# RUN: ld.lld -T %t.script -shared --no-undefined-version %t.o -o %t.so
# RUN: llvm-readobj -V %t.so | FileCheck %s --check-prefix=UNDEF
# UNDEF: VersionSymbols [
# UNDEF-NEXT: Symbol {
# UNDEF-NEXT: Version: 0
# UNDEF-NEXT: Name:
# UNDEF-NEXT: }
# UNDEF-NEXT: Symbol {
# UNDEF-NEXT: Version: 2
# UNDEF-NEXT: Name: und@@V
# UNDEF-NEXT: }
# UNDEF-NEXT: ]
.global und
.text
.globl foo
.type foo,@function
foo: