1# REQUIRES: x86
2
3# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
4# RUN: echo "LIBSAMPLE_1.0 { global:" > %t.script
5# RUN: echo '  extern "C++" { "foo(int)"; "zed(int)"; "abc::abc()"; };' >> %t.script
6# RUN: echo "};" >> %t.script
7# RUN: echo "LIBSAMPLE_2.0 { global:" >> %t.script
8# RUN: echo '  extern "C" { _Z3bari; };' >> %t.script
9# RUN: echo "};" >> %t.script
10# RUN: ld.lld --hash-style=sysv --version-script %t.script -soname fixed-length-string -shared %t.o -o %t.so
11# RUN: llvm-readobj -V --dyn-syms %t.so | FileCheck --check-prefix=DSO %s
12
13# DSO:      DynamicSymbols [
14# DSO-NEXT:    Symbol {
15# DSO-NEXT:      Name:
16# DSO-NEXT:      Value: 0x0
17# DSO-NEXT:      Size: 0
18# DSO-NEXT:      Binding: Local
19# DSO-NEXT:      Type: None
20# DSO-NEXT:      Other: 0
21# DSO-NEXT:      Section: Undefined
22# DSO-NEXT:    }
23# DSO-NEXT:    Symbol {
24# DSO-NEXT:      Name: _Z3bari@@LIBSAMPLE_2.0
25# DSO-NEXT:      Value:
26# DSO-NEXT:      Size: 0
27# DSO-NEXT:      Binding: Global
28# DSO-NEXT:      Type: Function
29# DSO-NEXT:      Other: 0
30# DSO-NEXT:      Section: .text
31# DSO-NEXT:    }
32# DSO-NEXT:    Symbol {
33# DSO-NEXT:      Name: _Z3fooi@@LIBSAMPLE_1.0
34# DSO-NEXT:      Value:
35# DSO-NEXT:      Size: 0
36# DSO-NEXT:      Binding: Global
37# DSO-NEXT:      Type: Function
38# DSO-NEXT:      Other: 0
39# DSO-NEXT:      Section: .text
40# DSO-NEXT:    }
41# DSO-NEXT:    Symbol {
42# DSO-NEXT:      Name: _Z3zedi@@LIBSAMPLE_1.0
43# DSO-NEXT:      Value:
44# DSO-NEXT:      Size: 0
45# DSO-NEXT:      Binding: Global (0x1)
46# DSO-NEXT:      Type: Function (0x2)
47# DSO-NEXT:      Other: 0
48# DSO-NEXT:      Section: .text (0x6)
49# DSO-NEXT:    }
50# DSO-NEXT:    Symbol {
51# DSO-NEXT:      Name: _ZN3abcC1Ev@@LIBSAMPLE_1.0
52# DSO-NEXT:      Value:
53# DSO-NEXT:      Size: 0
54# DSO-NEXT:      Binding: Global (0x1)
55# DSO-NEXT:      Type: Function (0x2)
56# DSO-NEXT:      Other: 0
57# DSO-NEXT:      Section: .text (0x6)
58# DSO-NEXT:    }
59# DSO-NEXT:    Symbol {
60# DSO-NEXT:      Name: _ZN3abcC2Ev@@LIBSAMPLE_1.0
61# DSO-NEXT:      Value:
62# DSO-NEXT:      Size: 0
63# DSO-NEXT:      Binding: Global (0x1)
64# DSO-NEXT:      Type: Function (0x2)
65# DSO-NEXT:      Other: 0
66# DSO-NEXT:      Section: .text (0x6)
67# DSO-NEXT:    }
68# DSO-NEXT:  ]
69# DSO-NEXT:  VersionSymbols [
70# DSO-NEXT:    Symbol {
71# DSO-NEXT:      Version: 0
72# DSO-NEXT:      Name:
73# DSO-NEXT:    }
74# DSO-NEXT:    Symbol {
75# DSO-NEXT:      Version: 3
76# DSO-NEXT:      Name: _Z3bari@@LIBSAMPLE_2.0
77# DSO-NEXT:    }
78# DSO-NEXT:    Symbol {
79# DSO-NEXT:      Version: 2
80# DSO-NEXT:      Name: _Z3fooi@@LIBSAMPLE_1.0
81# DSO-NEXT:    }
82# DSO-NEXT:    Symbol {
83# DSO-NEXT:      Version: 2
84# DSO-NEXT:      Name: _Z3zedi@@LIBSAMPLE_1.0
85# DSO-NEXT:    }
86# DSO-NEXT:    Symbol {
87# DSO-NEXT:      Version: 2
88# DSO-NEXT:      Name: _ZN3abcC1Ev@@LIBSAMPLE_1.0
89# DSO-NEXT:    }
90# DSO-NEXT:    Symbol {
91# DSO-NEXT:      Version: 2
92# DSO-NEXT:      Name: _ZN3abcC2Ev@@LIBSAMPLE_1.0
93# DSO-NEXT:    }
94# DSO-NEXT:  ]
95
96.text
97.globl _Z3fooi
98.type _Z3fooi,@function
99_Z3fooi:
100retq
101
102.globl _Z3bari
103.type _Z3bari,@function
104_Z3bari:
105retq
106
107.globl _Z3zedi
108.type _Z3zedi,@function
109_Z3zedi:
110retq
111
112.globl _ZN3abcC1Ev
113.type _ZN3abcC1Ev,@function
114_ZN3abcC1Ev:
115retq
116
117.globl _ZN3abcC2Ev
118.type _ZN3abcC2Ev,@function
119_ZN3abcC2Ev:
120retq
121