1// REQUIRES: x86
2// RUN: echo ".data; \
3// RUN:       .quad \"basename\"; \
4// RUN:       .quad \"basename@FBSD_1.0\"; \
5// RUN:       .quad \"basename@FBSD_1.1\" " > %t.s
6// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %t.s -o %t.o
7// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t2.o
8// RUN: echo "FBSD_1.0 { local: *; }; FBSD_1.1 { };" > %t2.ver
9// RUN: ld.lld --shared --version-script %t2.ver %t2.o -o %t2.so
10// RUN: echo "LIBPKG_1.3 { };" > %t.ver
11// RUN: ld.lld --shared %t.o --version-script %t.ver %t2.so -o %t.so
12// RUN: llvm-readobj --dyn-symbols -r %t.so | FileCheck %s
13
14// Test that each relocation points to the correct version.
15
16// CHECK:      Section ({{.*}}) .rela.dyn {
17// CHECK-NEXT:   R_X86_64_64 basename@FBSD_1.1 0x0
18// CHECK-NEXT:   R_X86_64_64 basename@FBSD_1.0 0x0
19// CHECK-NEXT:   R_X86_64_64 basename@FBSD_1.1 0x0
20// CHECK-NEXT: }
21
22
23// CHECK:      DynamicSymbols [
24// CHECK-NEXT:   Symbol {
25// CHECK-NEXT:     Name:
26// CHECK-NEXT:     Value:
27// CHECK-NEXT:     Size:
28// CHECK-NEXT:     Binding:
29// CHECK-NEXT:     Type:
30// CHECK-NEXT:     Other:
31// CHECK-NEXT:     Section:
32// CHECK-NEXT:   }
33// CHECK-NEXT:   Symbol {
34// CHECK-NEXT:     Name: basename@FBSD_1.1
35// CHECK-NEXT:     Value:
36// CHECK-NEXT:     Size:
37// CHECK-NEXT:     Binding:
38// CHECK-NEXT:     Type:
39// CHECK-NEXT:     Other:
40// CHECK-NEXT:     Section:
41// CHECK-NEXT:   }
42// CHECK-NEXT:   Symbol {
43// CHECK-NEXT:     Name: basename@FBSD_1.0
44// CHECK-NEXT:     Value:
45// CHECK-NEXT:     Size:
46// CHECK-NEXT:     Binding:
47// CHECK-NEXT:     Type:
48// CHECK-NEXT:     Other:
49// CHECK-NEXT:     Section:
50// CHECK-NEXT:   }
51// CHECK-NEXT:   Symbol {
52// CHECK-NEXT:     Name: basename@FBSD_1.1
53
54
55.global "basename@FBSD_1.0"
56"basename@FBSD_1.0":
57
58.global "basename@@FBSD_1.1"
59"basename@@FBSD_1.1":
60