[memprof] Remove an unused using directive (#117004)
[llvm-project.git] / lld / test / ELF / relocation-i686.s
blob6f424e342c8a937727b514dd8bc42c0aa1bd7552
1 // REQUIRES: x86
2 // RUN: llvm-mc -filetype=obj -triple=i686 %s -o %t.o
3 // RUN: llvm-mc -filetype=obj -triple=i686 %p/Inputs/shared.s -o %t2.o
4 // RUN: ld.lld -shared %t2.o -soname=t2.so -o %t2.so
5 // RUN: ld.lld --hash-style=sysv %t.o %t2.so -o %t
6 // RUN: llvm-readobj -S %t | FileCheck --check-prefix=ADDR %s
7 // RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t | FileCheck %s
9 .global _start
10 _start:
12 .section .R_386_32,"ax",@progbits
13 .global R_386_32
14 R_386_32:
15 movl $R_386_32 + 1, %edx
18 .section .R_386_PC32,"ax",@progbits,unique,1
19 .global R_386_PC32
20 R_386_PC32:
21 call R_386_PC32_2
23 .section .R_386_PC32,"ax",@progbits,unique,2
24 .zero 4
25 R_386_PC32_2:
26 nop
28 // CHECK: Disassembly of section .R_386_32:
29 // CHECK-EMPTY:
30 // CHECK-NEXT: <R_386_32>:
31 // CHECK-NEXT: movl $4198829, %edx
33 // CHECK: Disassembly of section .R_386_PC32:
34 // CHECK-EMPTY:
35 // CHECK-NEXT: <R_386_PC32>:
36 // CHECK-NEXT: calll 0x4011ba
38 // CHECK: <R_386_PC32_2>:
39 // CHECK-NEXT: nop
41 // Create a .got
42 movl bar@GOT, %eax
44 // ADDR: Name: .plt
45 // ADDR-NEXT: Type: SHT_PROGBITS
46 // ADDR-NEXT: Flags [
47 // ADDR-NEXT: SHF_ALLOC
48 // ADDR-NEXT: SHF_EXECINSTR
49 // ADDR-NEXT: ]
50 // ADDR-NEXT: Address: 0x4011E0
51 // ADDR-NEXT: Offset: 0x1E0
52 // ADDR-NEXT: Size: 32
54 // ADDR: Name: .got.plt (
55 // ADDR-NEXT: Type: SHT_PROGBITS
56 // ADDR-NEXT: Flags [
57 // ADDR-NEXT: SHF_ALLOC
58 // ADDR-NEXT: SHF_WRITE
59 // ADDR-NEXT: ]
60 // ADDR-NEXT: Address: 0x403280
61 // ADDR-NEXT: Offset:
62 // ADDR-NEXT: Size:
64 .section .R_386_GOTPC,"ax",@progbits
65 R_386_GOTPC:
66 movl $_GLOBAL_OFFSET_TABLE_, %eax
68 // .got.plt - 0x4011c0 = 0x403280 - 0x4011c0 = 8384
69 // CHECK: Disassembly of section .R_386_GOTPC:
70 // CHECK-EMPTY:
71 // CHECK-NEXT: <R_386_GOTPC>:
72 // CHECK-NEXT: 4011c0: movl $8384, %eax
74 .section .dynamic_reloc, "ax",@progbits
75 call bar
76 // .plt + 16 - (0x4011c5 + 5) = 0x4011e0 + 16 - 0x4011ca = 38
77 // CHECK: Disassembly of section .dynamic_reloc:
78 // CHECK-EMPTY:
79 // CHECK-NEXT: <.dynamic_reloc>:
80 // CHECK-NEXT: 4011c5: calll 0x4011f0 <bar@plt>
82 .section .R_386_GOT32,"ax",@progbits
83 .global R_386_GOT32
84 R_386_GOT32:
85 movl bar@GOT, %eax
86 movl zed@GOT, %eax
87 movl bar+8@GOT, %eax
88 movl zed+4@GOT, %eax
90 // &.got[0] - .got.plt = 0x402278 - 0x403280 = 4294963192
91 // &.got[1] - .got.plt = 0x402278 + 4 - 0x403280 = 4294963196
92 // &.got[2] - .got.plt = 0x402278 + 8 - 0x403280 = 4294963200
93 // CHECK: Disassembly of section .R_386_GOT32:
94 // CHECK-EMPTY:
95 // CHECK-NEXT: <R_386_GOT32>:
96 // CHECK-NEXT: 4011ca: movl 4294963192, %eax
97 // CHECK-NEXT: movl 4294963196, %eax
98 // CHECK-NEXT: movl 4294963200, %eax
99 // CHECK-NEXT: movl 4294963200, %eax