[clang-tidy][modernize-use-starts-ends-with] Fix operator rewriting false negative...
[llvm-project.git] / lld / test / ELF / gnu-ifunc-shared.s
blob15e812e16b6f3d95953f3279fe1c8c24e6c20a35
1 // REQUIRES: x86
3 /// For non-preemptable ifunc, place ifunc PLT entries after regular PLT entries.
5 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
6 // RUN: ld.lld --shared -o %t.so %t.o
7 // RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t.so | FileCheck %s --check-prefix=DISASM
8 // RUN: llvm-readobj -r %t.so | FileCheck %s
10 // Check that an IRELATIVE relocation is used for a non-preemptible ifunc
11 // handler and a JUMP_SLOT is used for a preemptible ifunc
12 // DISASM: Disassembly of section .text:
13 // DISASM-EMPTY:
14 // DISASM-NEXT: <fct>:
15 // DISASM-NEXT: 1308: retq
16 // DISASM: <fct2>:
17 // DISASM-NEXT: 1309: retq
18 // DISASM: <f1>:
19 // DISASM-NEXT: 130a: callq 0x1350
20 // DISASM-NEXT: 130f: callq 0x1330
21 // DISASM-NEXT: 1314: callq 0x1340
22 // DISASM-NEXT: 1319: retq
23 // DISASM: <f2>:
24 // DISASM-NEXT: 131a: retq
25 // DISASM-EMPTY:
26 // DISASM-NEXT: Disassembly of section .plt:
27 // DISASM-EMPTY:
28 // DISASM-NEXT: <.plt>:
29 // DISASM-NEXT: 1320: pushq 8482(%rip)
30 // DISASM-NEXT: 1326: jmpq *8484(%rip)
31 // DISASM-NEXT: 132c: nopl (%rax)
32 // DISASM-EMPTY:
33 // DISASM-NEXT: <fct2@plt>:
34 // DISASM-NEXT: 1330: jmpq *8482(%rip)
35 // DISASM-NEXT: 1336: pushq $0
36 // DISASM-NEXT: 133b: jmp 0x1320 <.plt>
37 // DISASM-EMPTY:
38 // DISASM-NEXT: <f2@plt>:
39 // DISASM-NEXT: 1340: jmpq *8474(%rip)
40 // DISASM-NEXT: 1346: pushq $1
41 // DISASM-NEXT: 134b: jmp 0x1320 <.plt>
42 // DISASM: Disassembly of section .iplt:
43 // DISASM-EMPTY:
44 // DISASM: <.iplt>:
45 // DISASM-NEXT: 1350: jmpq *8466(%rip)
46 // DISASM-NEXT: 1356: pushq $0
47 // DISASM-NEXT: 135b: jmp 0x1320 <.plt>
49 // CHECK: Relocations [
50 // CHECK-NEXT: Section (5) .rela.dyn {
51 // CHECK-NEXT: 0x3468 R_X86_64_IRELATIVE - 0x1308
52 // CHECK-NEXT: }
53 // CHECK-NEXT: Section (6) .rela.plt {
54 // CHECK-NEXT: 0x3458 R_X86_64_JUMP_SLOT fct2 0x0
55 // CHECK-NEXT: 0x3460 R_X86_64_JUMP_SLOT f2 0x0
56 // CHECK-NEXT: }
58 // Hidden expect IRELATIVE
59 .globl fct
60 .hidden fct
61 .type fct, STT_GNU_IFUNC
62 fct:
63 ret
65 // Not hidden expect JUMP_SLOT
66 .globl fct2
67 .type fct2, STT_GNU_IFUNC
68 fct2:
69 ret
71 .globl f1
72 .type f1, @function
73 f1:
74 call fct
75 call fct2
76 call f2@PLT
77 ret
79 .globl f2
80 .type f2, @function
81 f2:
82 ret