1// REQUIRES: x86
2// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
3// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/shared.s -o %t2.o
4// RUN: ld.lld -shared %t2.o -soname=so -o %t2.so
5// RUN: ld.lld %t.o %t2.so -o %t
6// RUN: llvm-readobj -S -r --section-data %t | FileCheck %s
7// RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=DISASM %s
8
9        .globl _start
10_start:
11	call bar@gotpcrel
12	call foo@gotpcrel
13
14        .global foo
15foo:
16        nop
17
18// 0x202320 - 0x201250 - 5 =  4299
19// 0x202328 - 0x201255 - 5 =  4302
20// DISASM:      <_start>:
21// DISASM-NEXT:   201250:       callq 0x202320
22// DISASM-NEXT:   201255:       callq 0x202328
23
24// DISASM:      <foo>:
25// DISASM-NEXT:   20125a:       nop
26
27// CHECK:      Name: .got
28// CHECK-NEXT: Type: SHT_PROGBITS
29// CHECK-NEXT: Flags [
30// CHECK-NEXT:   SHF_ALLOC
31// CHECK-NEXT:   SHF_WRITE
32// CHECK-NEXT: ]
33// CHECK-NEXT: Address: 0x202320
34// CHECK-NEXT: Offset:
35// CHECK-NEXT: Size: 16
36// CHECK-NEXT: Link: 0
37// CHECK-NEXT: Info: 0
38// CHECK-NEXT: AddressAlignment: 8
39// CHECK-NEXT: EntrySize: 0
40// CHECK-NEXT: SectionData (
41// CHECK-NEXT:   0000:  00000000 00000000 5A122000 00000000
42// CHECK-NEXT: )
43
44// CHECK:      Relocations [
45// CHECK-NEXT:   Section ({{.*}}) .rela.dyn {
46// CHECK-NEXT:     0x202320 R_X86_64_GLOB_DAT bar 0x0
47// CHECK-NEXT:   }
48// CHECK-NEXT: ]
49