[llvm] Do not replace dead constant references in metadata with undef
[llvm-project.git] / lld / test / ELF / i386-retpoline-pic.s
blob293506d74628497c46550c990b79999a4096aa40
1 // REQUIRES: x86
2 // RUN: llvm-mc -filetype=obj -triple=i386-unknown-linux -position-independent %s -o %t1.o
3 // RUN: llvm-mc -filetype=obj -triple=i386-unknown-linux -position-independent %p/Inputs/shared.s -o %t2.o
4 // RUN: ld.lld -shared -soname=t2.so %t2.o -o %t2.so
6 // RUN: ld.lld %t1.o %t2.so -o %t.exe -z retpolineplt -pie
7 // RUN: llvm-objdump -d -s --no-show-raw-insn %t.exe | FileCheck %s
9 // CHECK: Contents of section .got.plt:
10 // CHECK-NEXT: 32b0 40220000 00000000 00000000 11120000
11 // CHECK-NEXT: 32c0 31120000
13 // CHECK: Disassembly of section .plt:
14 // CHECK-EMPTY:
15 // CHECK-NEXT: <.plt>:
16 // CHECK-NEXT: 11d0: pushl 4(%ebx)
17 // CHECK-NEXT: 11d6: pushl %eax
18 // CHECK-NEXT: 11d7: movl 8(%ebx), %eax
19 // CHECK-NEXT: 11dd: calll 0x11f0 <.plt+0x20>
20 // CHECK-NEXT: 11e2: pause
21 // CHECK-NEXT: 11e4: lfence
22 // CHECK-NEXT: 11e7: jmp 0x11e2 <.plt+0x12>
23 // CHECK-NEXT: 11e9: int3
24 // CHECK-NEXT: 11ea: int3
25 // CHECK-NEXT: 11eb: int3
26 // CHECK-NEXT: 11ec: int3
27 // CHECK-NEXT: 11ed: int3
28 // CHECK-NEXT: 11ee: int3
29 // CHECK-NEXT: 11ef: int3
30 // CHECK-NEXT: 11f0: movl %ecx, (%esp)
31 // CHECK-NEXT: 11f3: movl 4(%esp), %ecx
32 // CHECK-NEXT: 11f7: movl %eax, 4(%esp)
33 // CHECK-NEXT: 11fb: movl %ecx, %eax
34 // CHECK-NEXT: 11fd: popl %ecx
35 // CHECK-NEXT: 11fe: retl
36 // CHECK-NEXT: 11ff: int3
37 // CHECK-NEXT: 1200: pushl %eax
38 // CHECK-NEXT: 1201: movl 12(%ebx), %eax
39 // CHECK-NEXT: 1207: calll 0x11f0 <.plt+0x20>
40 // CHECK-NEXT: 120c: jmp 0x11e2 <.plt+0x12>
41 // CHECK-NEXT: 1211: pushl $0
42 // CHECK-NEXT: 1216: jmp 0x11d0 <.plt>
43 // CHECK-NEXT: 121b: int3
44 // CHECK-NEXT: 121c: int3
45 // CHECK-NEXT: 121d: int3
46 // CHECK-NEXT: 121e: int3
47 // CHECK-NEXT: 121f: int3
48 // CHECK-NEXT: 1220: pushl %eax
49 // CHECK-NEXT: 1221: movl 16(%ebx), %eax
50 // CHECK-NEXT: 1227: calll 0x11f0 <.plt+0x20>
51 // CHECK-NEXT: 122c: jmp 0x11e2 <.plt+0x12>
52 // CHECK-NEXT: 1231: pushl $8
53 // CHECK-NEXT: 1236: jmp 0x11d0 <.plt>
54 // CHECK-NEXT: 123b: int3
55 // CHECK-NEXT: 123c: int3
56 // CHECK-NEXT: 123d: int3
57 // CHECK-NEXT: 123e: int3
58 // CHECK-NEXT: 123f: int3
60 .global _start
61 _start:
62 jmp bar@PLT
63 jmp zed@PLT