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/relocation-size-shared.s -o %tso.o
4// RUN: ld.lld -shared %tso.o -soname=so -o %t1.so
5// RUN: ld.lld %t.o %t1.so -o %t
6// RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOCSHARED %s
7// RUN: llvm-readelf -x .data %t | FileCheck --check-prefix=DATA %s
8// RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=DISASM %s
9
10// RELOCSHARED:       Relocations [
11// RELOCSHARED-NEXT:  Section ({{.*}}) .rela.dyn {
12// RELOCSHARED-NEXT:    R_X86_64_SIZE32 fooshared 0xFFFFFFFFFFFFFFFF
13// RELOCSHARED-NEXT:    R_X86_64_SIZE32 fooshared 0x0
14// RELOCSHARED-NEXT:    R_X86_64_SIZE32 fooshared 0x1
15// RELOCSHARED-NEXT:    R_X86_64_SIZE64 fooshared 0xFFFFFFFFFFFFFFFF
16// RELOCSHARED-NEXT:    R_X86_64_SIZE64 fooshared 0x0
17// RELOCSHARED-NEXT:    R_X86_64_SIZE64 fooshared 0x1
18// RELOCSHARED-NEXT:  }
19// RELOCSHARED-NEXT:]
20
21// DATA:      section '.data':
22// DATA-NEXT:   00000000 00000000 00000000 00000000
23// DATA-NEXT:   00000000 00000000 00001900 00000000
24// DATA-NEXT:   00001a00 00000000 00001b00 00000000
25// DATA-NEXT:   00000000 00000000 00000000 00000000
26// DATA-NEXT:   00000000 00000000 0000
27
28// DISASM:      <_start>:
29// DISASM-NEXT:   movl 25, %eax
30// DISASM-NEXT:   movl 26, %eax
31// DISASM-NEXT:   movl 27, %eax
32// DISASM-NEXT:   movl 0, %eax
33// DISASM-NEXT:   movl 0, %eax
34// DISASM-NEXT:   movl 0, %eax
35
36.data
37.global foo
38.type foo,%object
39.size foo,26
40foo:
41.zero 26
42
43  // R_X86_64_SIZE64:
44  .quad foo@SIZE-1
45  .quad foo@SIZE
46  .quad foo@SIZE+1
47  .quad fooshared@SIZE-1
48  .quad fooshared@SIZE
49  .quad fooshared@SIZE+1
50
51.section test, "awx"
52.globl _start
53_start:
54  // R_X86_64_SIZE32:
55  movl foo@SIZE-1,%eax
56  movl foo@SIZE,%eax
57  movl foo@SIZE+1,%eax
58  movl fooshared@SIZE-1,%eax
59  movl fooshared@SIZE,%eax
60  movl fooshared@SIZE+1,%eax
61