1// REQUIRES: x86
2// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
3// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/relocation-copy.s -o %t2.o
4// RUN: ld.lld -shared %t2.o -soname=so -o %t.so
5// RUN: ld.lld %t.o %t.so -o %t3
6// RUN: llvm-readobj -S -r --expand-relocs %t3 | FileCheck %s
7// RUN: llvm-objdump -d --no-show-raw-insn --print-imm-hex %t3 | FileCheck --check-prefix=CODE %s
8
9.text
10.global _start
11_start:
12movl $5, x
13movl $7, y
14movl $9, z
15movl $x, %edx
16movl $y, %edx
17movl $z, %edx
18
19// CHECK:      Name: .bss
20// CHECK-NEXT:  Type: SHT_NOBITS (0x8)
21// CHECK-NEXT:  Flags [ (0x3)
22// CHECK-NEXT:   SHF_ALLOC (0x2)
23// CHECK-NEXT:   SHF_WRITE (0x1)
24// CHECK-NEXT:  ]
25// CHECK-NEXT:  Address: 0x203400
26// CHECK-NEXT:  Offset:
27// CHECK-NEXT:  Size: 24
28// CHECK-NEXT:  Link: 0
29// CHECK-NEXT:  Info: 0
30// CHECK-NEXT:  AddressAlignment: 16
31// CHECK-NEXT:  EntrySize: 0
32
33// CHECK:      Relocations [
34// CHECK-NEXT:   Section ({{.*}}) .rela.dyn {
35// CHECK-NEXT:     Relocation {
36// CHECK-NEXT:       Offset:
37// CHECK-NEXT:       Type: R_X86_64_COPY
38// CHECK-NEXT:       Symbol: x
39// CHECK-NEXT:       Addend: 0x0
40// CHECK-NEXT:     }
41// CHECK-NEXT:     Relocation {
42// CHECK-NEXT:       Offset:
43// CHECK-NEXT:       Type: R_X86_64_COPY
44// CHECK-NEXT:       Symbol: y
45// CHECK-NEXT:       Addend: 0x0
46// CHECK-NEXT:     }
47// CHECK-NEXT:     Relocation {
48// CHECK-NEXT:       Offset:
49// CHECK-NEXT:       Type: R_X86_64_COPY
50// CHECK-NEXT:       Symbol: z
51// CHECK-NEXT:       Addend: 0x0
52// CHECK-NEXT:     }
53// CHECK-NEXT:   }
54// CHECK-NEXT: ]
55
56// 16 is alignment here
57// CODE: Disassembly of section .text:
58// CODE-EMPTY:
59// CODE-NEXT: <_start>:
60// CODE-NEXT:   movl $0x5, 0x203400
61// CODE-NEXT:   movl $0x7, 0x203410
62// CODE-NEXT:   movl $0x9, 0x203414
63// CODE-NEXT:   movl $0x203400, %edx
64// CODE-NEXT:   movl $0x203410, %edx
65// CODE-NEXT:   movl $0x203414, %edx
66