blob: 16f40035435685b689084994fde13319335f350a [file] [log] [blame]
George Rimar8825a5c2016-09-07 09:59:29 +00001# REQUIRES: x86
George Rimar50dcece2016-07-16 12:26:39 +00002
3# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
Rui Ueyamad14743e2016-11-23 05:14:01 +00004# 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
Rafael Espindola7e714152016-12-08 17:26:53 +00008# RUN: echo ' extern "C" { _Z3bari; };' >> %t.script
Rui Ueyamad14743e2016-11-23 05:14:01 +00009# RUN: echo "};" >> %t.script
Han Shenb56030e2018-05-15 17:02:35 +000010# RUN: ld.lld --hash-style=sysv --version-script %t.script -soname fixed-length-string -shared %t.o -o %t.so
George Rimar50dcece2016-07-16 12:26:39 +000011# RUN: llvm-readobj -V -dyn-symbols %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: 0x1001
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: 0x1000
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: 0x1002
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: }
Ed Maste5ad1cbe2016-09-07 17:51:00 +000050# DSO-NEXT: Symbol {
51# DSO-NEXT: Name: _ZN3abcC1Ev@@LIBSAMPLE_1.0
52# DSO-NEXT: Value: 0x1003
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: }
George Rimar31c25ae2016-09-15 12:44:38 +000059# DSO-NEXT: Symbol {
60# DSO-NEXT: Name: _ZN3abcC2Ev@@LIBSAMPLE_1.0
61# DSO-NEXT: Value: 0x1004
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: }
George Rimar50dcece2016-07-16 12:26:39 +000068# DSO-NEXT: ]
69# DSO-NEXT: Version symbols {
70# DSO-NEXT: Section Name: .gnu.version
Fangrui Song3d873232018-06-26 22:13:32 +000071# DSO-NEXT: Address: 0x258
72# DSO-NEXT: Offset: 0x258
George Rimar50dcece2016-07-16 12:26:39 +000073# DSO-NEXT: Link: 1
74# DSO-NEXT: Symbols [
75# DSO-NEXT: Symbol {
76# DSO-NEXT: Version: 0
77# DSO-NEXT: Name: @
78# DSO-NEXT: }
79# DSO-NEXT: Symbol {
80# DSO-NEXT: Version: 3
81# DSO-NEXT: Name: _Z3bari@@LIBSAMPLE_2.0
82# DSO-NEXT: }
83# DSO-NEXT: Symbol {
84# DSO-NEXT: Version: 2
85# DSO-NEXT: Name: _Z3fooi@@LIBSAMPLE_1.0
86# DSO-NEXT: }
87# DSO-NEXT: Symbol {
88# DSO-NEXT: Version: 2
89# DSO-NEXT: Name: _Z3zedi@@LIBSAMPLE_1.0
90# DSO-NEXT: }
Ed Maste5ad1cbe2016-09-07 17:51:00 +000091# DSO-NEXT: Symbol {
92# DSO-NEXT: Version: 2
93# DSO-NEXT: Name: _ZN3abcC1Ev@@LIBSAMPLE_1.0
94# DSO-NEXT: }
George Rimar31c25ae2016-09-15 12:44:38 +000095# DSO-NEXT: Symbol {
96# DSO-NEXT: Version: 2
97# DSO-NEXT: Name: _ZN3abcC2Ev@@LIBSAMPLE_1.0
98# DSO-NEXT: }
George Rimar50dcece2016-07-16 12:26:39 +000099# DSO-NEXT: ]
100# DSO-NEXT: }
101
102.text
103.globl _Z3fooi
104.type _Z3fooi,@function
105_Z3fooi:
106retq
107
108.globl _Z3bari
109.type _Z3bari,@function
110_Z3bari:
111retq
112
113.globl _Z3zedi
114.type _Z3zedi,@function
115_Z3zedi:
116retq
Ed Maste5ad1cbe2016-09-07 17:51:00 +0000117
118.globl _ZN3abcC1Ev
119.type _ZN3abcC1Ev,@function
120_ZN3abcC1Ev:
121retq
George Rimar31c25ae2016-09-15 12:44:38 +0000122
123.globl _ZN3abcC2Ev
124.type _ZN3abcC2Ev,@function
125_ZN3abcC2Ev:
126retq