1// REQUIRES: x86
2// RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %s -o %t.o
3// RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %p/Inputs/relocation-copy.s -o %t2.o
4// RUN: ld.lld -shared %t2.o -soname=t.so -o %t.so
5// RUN: ld.lld -e main %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.globl main
11.align 16, 0x90
12.type main,@function
13main:
14movl $5, x
15movl $7, y
16movl $9, z
17
18// CHECK:      Name: .bss
19// CHECK-NEXT:  Type: SHT_NOBITS
20// CHECK-NEXT:  Flags [
21// CHECK-NEXT:   SHF_ALLOC
22// CHECK-NEXT:   SHF_WRITE
23// CHECK-NEXT:  ]
24// CHECK-NEXT:  Address:  0x403270
25// CHECK-NEXT:  Offset:
26// CHECK-NEXT:  Size: 24
27// CHECK-NEXT:  Link: 0
28// CHECK-NEXT:  Info: 0
29// CHECK-NEXT:  AddressAlignment: 16
30// CHECK-NEXT:  EntrySize: 0
31
32// CHECK:      Relocations [
33// CHECK-NEXT:   Section ({{.*}}) .rel.dyn {
34// CHECK-NEXT:     Relocation {
35// CHECK-NEXT:       Offset:
36// CHECK-NEXT:       Type: R_386_COPY
37// CHECK-NEXT:       Symbol: x
38// CHECK-NEXT:       Addend: 0x0
39// CHECK-NEXT:     }
40// CHECK-NEXT:     Relocation {
41// CHECK-NEXT:       Offset:
42// CHECK-NEXT:       Type: R_386_COPY
43// CHECK-NEXT:       Symbol: y
44// CHECK-NEXT:       Addend: 0x0
45// CHECK-NEXT:     }
46// CHECK-NEXT:     Relocation {
47// CHECK-NEXT:       Offset:
48// CHECK-NEXT:       Type: R_386_COPY
49// CHECK-NEXT:       Symbol: z
50// CHECK-NEXT:       Addend: 0x0
51// CHECK-NEXT:     }
52// CHECK-NEXT:   }
53// CHECK-NEXT: ]
54
55// 16 is alignment here
56// CODE: Disassembly of section .text:
57// CODE-EMPTY:
58// CODE-NEXT: <main>:
59/// .bss + 0 = 0x403270
60// CODE-NEXT: 4011f0:       movl $0x5, 0x403270
61/// .bss + 16 = 0x403270 + 16 = 0x403280
62// CODE-NEXT: 4011fa:       movl $0x7, 0x403280
63/// .bss + 20 = 0x403270 + 20 = 0x403284
64// CODE-NEXT: 401204:       movl $0x9, 0x403284
65