Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / ELF / gnu-ifunc-nonpreemptible.s
blobb209b0cf3346886a597eeefa8e013c5f5413277f
1 # REQUIRES: x86
2 # RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
3 # RUN: ld.lld %t.o -o %t
4 # RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t | FileCheck %s --check-prefix=DISASM
5 # RUN: llvm-readelf -r -s %t | FileCheck %s
7 # RUN: ld.lld --export-dynamic %t.o -o %t
8 # RUN: llvm-readelf -r -s %t | FileCheck %s
10 # CHECK: Relocation section '.rela.dyn' at offset {{.*}} contains 2 entries:
11 # CHECK-NEXT: Type
12 # CHECK-NEXT: R_X86_64_IRELATIVE
13 # CHECK-NEXT: R_X86_64_IRELATIVE
15 # CHECK: 0 NOTYPE LOCAL HIDDEN [[#]] __rela_iplt_start
16 # CHECK-NEXT: 0 NOTYPE LOCAL HIDDEN [[#]] __rela_iplt_end
18 # RUN: ld.lld -pie %t.o -o %t1
19 # RUN: llvm-readelf -s %t1 | FileCheck %s --check-prefix=PIC
20 # RUN: ld.lld -shared %t.o -o %t2
21 # RUN: llvm-readelf -s %t2 | FileCheck %s --check-prefix=PIC
23 # PIC: 0 NOTYPE WEAK DEFAULT UND __rela_iplt_start
24 # PIC-NEXT: 0 NOTYPE WEAK DEFAULT UND __rela_iplt_end
26 # DISASM: Disassembly of section .text:
27 # DISASM-EMPTY:
28 # DISASM-NEXT: <foo>:
29 # DISASM: <bar>:
30 # DISASM: <unused>:
31 # DISASM: <_start>:
32 # DISASM-NEXT: callq 0x[[#%x,foo:]]
33 # DISASM-NEXT: callq 0x[[#%x,bar:]]
34 # DISASM-EMPTY:
35 # DISASM-NEXT: Disassembly of section .iplt:
36 # DISASM-EMPTY:
37 # DISASM-NEXT: <.iplt>:
38 # DISASM-NEXT: [[#foo]]: jmpq *{{.*}}(%rip)
39 # DISASM-NEXT: pushq $0
40 # DISASM-NEXT: jmp 0x0
41 # DISASM-NEXT: [[#bar]]: jmpq *{{.*}}(%rip)
42 # DISASM-NEXT: pushq $1
43 # DISASM-NEXT: jmp 0x0
45 .text
46 .type foo STT_GNU_IFUNC
47 .globl foo
48 foo:
49 ret
51 .type bar STT_GNU_IFUNC
52 .globl bar
53 bar:
54 ret
56 .type unused, @gnu_indirect_function
57 .globl unused
58 unused:
59 ret
61 .weak __rela_iplt_start
62 .weak __rela_iplt_end
64 .globl _start
65 _start:
66 call foo
67 call bar
69 .data
70 .quad __rela_iplt_start
71 .quad __rela_iplt_end