• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %S/Inputs/verneed1.s -o %t1.o
3# RUN: echo "v1 {}; v2 {}; v3 { local: *; };" > %t.script
4# RUN: ld.lld -shared %t1.o --version-script %t.script -o %t1.so -soname verneed1.so.0
5# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %S/Inputs/verneed2.s -o %t2.o
6# RUN: ld.lld -shared %t2.o --version-script %t.script -o %t2.so -soname verneed2.so.0
7
8# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
9# RUN: ld.lld --hash-style=sysv %t.o %t1.so %t2.so -o %t
10# RUN: llvm-readobj -S -d --section-data --dyn-syms -V %t | FileCheck %s
11
12# CHECK:        Section {
13# CHECK:          Index: 1
14# CHECK-NEXT:     Name: .dynsym
15# CHECK-NEXT:     Type: SHT_DYNSYM (0xB)
16# CHECK-NEXT:     Flags [ (0x2)
17# CHECK-NEXT:       SHF_ALLOC (0x2)
18# CHECK-NEXT:     ]
19# CHECK-NEXT:     Address: 0x200200
20# CHECK-NEXT:     Offset: 0x200
21# CHECK-NEXT:     Size: 96
22# CHECK-NEXT:     Link: [[DYNSTR:.*]]
23# CHECK-NEXT:     Info: 1
24# CHECK-NEXT:     AddressAlignment: 8
25# CHECK-NEXT:     EntrySize: 24
26
27# CHECK:       Section {
28# CHECK-NEXT:    Index: 2
29# CHECK-NEXT:    Name: .gnu.version
30# CHECK-NEXT:    Type: SHT_GNU_versym (0x6FFFFFFF)
31# CHECK-NEXT:    Flags [ (0x2)
32# CHECK-NEXT:      SHF_ALLOC (0x2)
33# CHECK-NEXT:    ]
34# CHECK-NEXT:    Address: [[VERSYM:.*]]
35# CHECK-NEXT:    Offset: [[VERSYM_OFFSET:.*]]
36# CHECK-NEXT:    Size: 8
37# CHECK-NEXT:    Link: 1
38# CHECK-NEXT:    Info: 0
39# CHECK-NEXT:    AddressAlignment: 2
40# CHECK-NEXT:    EntrySize: 2
41
42# CHECK:       Section {
43# CHECK-NEXT:    Index: 3
44# CHECK-NEXT:    Name: .gnu.version_r
45# CHECK-NEXT:    Type: SHT_GNU_verneed (0x6FFFFFFE)
46# CHECK-NEXT:    Flags [ (0x2)
47# CHECK-NEXT:      SHF_ALLOC (0x2)
48# CHECK-NEXT:    ]
49# CHECK-NEXT:    Address: [[VERNEED:.*]]
50# CHECK-NEXT:    Offset: 0x268
51# CHECK-NEXT:    Size: 80
52# CHECK-NEXT:    Link: 5
53# CHECK-NEXT:    Info: 2
54# CHECK-NEXT:    AddressAlignment: 4
55# CHECK-NEXT:    EntrySize: 0
56
57# CHECK:          Index: [[DYNSTR]]
58# CHECK-NEXT:     Name: .dynstr
59# CHECK-NEXT:     Type: SHT_STRTAB (0x3)
60# CHECK-NEXT:     Flags [ (0x2)
61# CHECK-NEXT:       SHF_ALLOC (0x2)
62# CHECK-NEXT:     ]
63# CHECK-NEXT:     Address: 0x2002E0
64# CHECK-NEXT:     Offset: 0x2E0
65# CHECK-NEXT:     Size: 47
66# CHECK-NEXT:     Link: 0
67# CHECK-NEXT:     Info: 0
68# CHECK-NEXT:     AddressAlignment: 1
69# CHECK-NEXT:     EntrySize: 0
70# CHECK-NEXT:     SectionData (
71# CHECK-NEXT:       0000: 00663100 66320067 31007665 726E6565  |.f1.f2.g1.vernee|
72# CHECK-NEXT:       0010: 64312E73 6F2E3000 76320076 33007665  |d1.so.0.v2.v3.ve|
73# CHECK-NEXT:       0020: 726E6565 64322E73 6F2E3000 763100    |rneed2.so.0.v1.|
74# CHECK-NEXT:     )
75# CHECK-NEXT:   }
76
77# CHECK:      0x000000006FFFFFF0 VERSYM               [[VERSYM]]
78# CHECK-NEXT: 0x000000006FFFFFFE VERNEED              [[VERNEED]]
79# CHECK-NEXT: 0x000000006FFFFFFF VERNEEDNUM           2
80
81# CHECK:      DynamicSymbols [
82# CHECK-NEXT:   Symbol {
83# CHECK-NEXT:     Name:
84# CHECK-NEXT:     Value: 0x0
85# CHECK-NEXT:     Size: 0
86# CHECK-NEXT:     Binding: Local (0x0)
87# CHECK-NEXT:     Type: None (0x0)
88# CHECK-NEXT:     Other: 0
89# CHECK-NEXT:     Section: Undefined (0x0)
90# CHECK-NEXT:   }
91# CHECK-NEXT:   Symbol {
92# CHECK-NEXT:     Name: f1@v3
93# CHECK-NEXT:     Value: 0x0
94# CHECK-NEXT:     Size: 0
95# CHECK-NEXT:     Binding: Global (0x1)
96# CHECK-NEXT:     Type: None (0x0)
97# CHECK-NEXT:     Other: 0
98# CHECK-NEXT:     Section: Undefined (0x0)
99# CHECK-NEXT:   }
100# CHECK-NEXT:   Symbol {
101# CHECK-NEXT:     Name: f2@v2
102# CHECK-NEXT:     Value: 0x0
103# CHECK-NEXT:     Size: 0
104# CHECK-NEXT:     Binding: Global (0x1)
105# CHECK-NEXT:     Type: None (0x0)
106# CHECK-NEXT:     Other: 0
107# CHECK-NEXT:     Section: Undefined (0x0)
108# CHECK-NEXT:   }
109# CHECK-NEXT:   Symbol {
110# CHECK-NEXT:     Name: g1@v1
111# CHECK-NEXT:     Value: 0x0
112# CHECK-NEXT:     Size: 0
113# CHECK-NEXT:     Binding: Global (0x1)
114# CHECK-NEXT:     Type: None (0x0)
115# CHECK-NEXT:     Other: 0
116# CHECK-NEXT:     Section: Undefined (0x0)
117# CHECK-NEXT:   }
118# CHECK-NEXT: ]
119
120# CHECK:      VersionSymbols [
121# CHECK-NEXT:    Symbol {
122# CHECK-NEXT:      Version: 0
123# CHECK-NEXT:      Name:
124# CHECK-NEXT:    }
125# CHECK-NEXT:    Symbol {
126# CHECK-NEXT:      Version: 2
127# CHECK-NEXT:      Name: f1@v3
128# CHECK-NEXT:    }
129# CHECK-NEXT:    Symbol {
130# CHECK-NEXT:      Version: 3
131# CHECK-NEXT:      Name: f2@v2
132# CHECK-NEXT:    }
133# CHECK-NEXT:    Symbol {
134# CHECK-NEXT:      Version: 4
135# CHECK-NEXT:      Name: g1@v1
136# CHECK-NEXT:    }
137# CHECK-NEXT:  ]
138# CHECK-NEXT:  VersionDefinitions [
139# CHECK-NEXT:  ]
140# CHECK-NEXT:  VersionRequirements [
141# CHECK-NEXT:    Dependency {
142# CHECK-NEXT:      Version: 1
143# CHECK-NEXT:      Count: 2
144# CHECK-NEXT:      FileName: verneed1.so.0
145# CHECK-NEXT:      Entries [
146# CHECK-NEXT:        Entry {
147# CHECK-NEXT:          Hash: 1938
148# CHECK-NEXT:          Flags [ (0x0)
149# CHECK-NEXT:          ]
150# CHECK-NEXT:          Index: 3
151# CHECK-NEXT:          Name: v2
152# CHECK-NEXT:        }
153# CHECK-NEXT:        Entry {
154# CHECK-NEXT:          Hash: 1939
155# CHECK-NEXT:          Flags [ (0x0)
156# CHECK-NEXT:          ]
157# CHECK-NEXT:          Index: 2
158# CHECK-NEXT:          Name: v3
159# CHECK-NEXT:        }
160# CHECK-NEXT:      ]
161# CHECK-NEXT:    }
162# CHECK-NEXT:    Dependency {
163# CHECK-NEXT:      Version: 1
164# CHECK-NEXT:      Count: 1
165# CHECK-NEXT:      FileName: verneed2.so.0
166# CHECK-NEXT:      Entries [
167# CHECK-NEXT:        Entry {
168# CHECK-NEXT:          Hash: 1937
169# CHECK-NEXT:          Flags [ (0x0)
170# CHECK-NEXT:          ]
171# CHECK-NEXT:          Index: 4
172# CHECK-NEXT:          Name: v1
173# CHECK-NEXT:        }
174# CHECK-NEXT:      ]
175# CHECK-NEXT:    }
176# CHECK-NEXT:  ]
177
178.globl _start
179_start:
180call f1@plt
181call f2@plt
182call g1@plt
183