[memprof] Remove an unused using directive (#117004)
[llvm-project.git] / lld / test / ELF / arm-gnu-ifunc-plt.s
blob55592c0843d6a3f9601afc48f3528f2629e17346
1 // REQUIRES: arm
2 // RUN: llvm-mc -filetype=obj -triple=armv7a-linux-gnueabihf %S/Inputs/arm-shared.s -o %t1.o
3 // RUN: ld.lld %t1.o --shared -soname=t.so -o %t.so
4 // RUN: llvm-mc -filetype=obj -triple=armv7a-linux-gnueabihf %s -o %t.o
5 // RUN: ld.lld %t.so %t.o -o %tout
6 // RUN: llvm-objdump --no-print-imm-hex --triple=armv7a-linux-gnueabihf -d --no-show-raw-insn %tout | FileCheck %s --check-prefix=DISASM
7 // RUN: llvm-objdump -s %tout | FileCheck %s --check-prefix=GOTPLT
8 // RUN: llvm-readobj -r --dynamic-table %tout | FileCheck %s
10 // Check that the IRELATIVE relocations are last in the .got
11 // CHECK: Relocations [
12 // CHECK-NEXT: Section (5) .rel.dyn {
13 // CHECK-NEXT: 0x302E0 R_ARM_GLOB_DAT bar2
14 // CHECK-NEXT: 0x302E4 R_ARM_GLOB_DAT zed2
15 // CHECK-NEXT: 0x302E8 R_ARM_IRELATIVE -
16 // CHECK-NEXT: 0x302EC R_ARM_IRELATIVE -
17 // CHECK-NEXT: }
18 // CHECK-NEXT: Section (6) .rel.plt {
19 // CHECK-NEXT: 0x402FC R_ARM_JUMP_SLOT bar2
20 // CHECK-NEXT: 0x40300 R_ARM_JUMP_SLOT zed2
21 // CHECK-NEXT: }
22 // CHECK-NEXT: ]
24 // Check that the GOT entries refer back to the ifunc resolver
25 // GOTPLT: Contents of section .got:
26 // GOTPLT-NEXT: 302e0 00000000 00000000 dc010200 e0010200
27 // GOTPLT: Contents of section .got.plt:
28 // GOTPLT-NEXT: 402f0 00000000 00000000 00000000 00020200
29 // GOTPLT-NEXT: 40300 00020200
31 // DISASM: Disassembly of section .text:
32 // DISASM-EMPTY:
33 // DISASM-NEXT: <foo>:
34 // DISASM-NEXT: 201dc: bx lr
35 // DISASM: <bar>:
36 // DISASM-NEXT: 201e0: bx lr
37 // DISASM: <_start>:
38 // DISASM-NEXT: 201e4: bl 0x20240
39 // DISASM-NEXT: 201e8: bl 0x20250
40 // DISASM-NEXT: 201ec: 00 00 00 00 .word 0x00000000
41 // DISASM-NEXT: 201f0: 04 00 00 00 .word 0x00000004
42 // DISASM: 201f4: bl 0x20220
43 // DISASM-NEXT: 201f8: bl 0x20230
44 // DISASM-EMPTY:
45 // DISASM-NEXT: Disassembly of section .plt:
46 // DISASM-EMPTY:
47 // DISASM-NEXT: <.plt>:
48 // DISASM-NEXT: 20200: str lr, [sp, #-4]!
49 // DISASM-NEXT: 20204: add lr, pc, #0, #12
50 // DISASM-NEXT: 20208: add lr, lr, #32
51 // DISASM-NEXT: 2020c: ldr pc, [lr, #236]!
52 // DISASM-NEXT: 20210: d4 d4 d4 d4 .word 0xd4d4d4d4
53 // DISASM-NEXT: 20214: d4 d4 d4 d4 .word 0xd4d4d4d4
54 // DISASM-NEXT: 20218: d4 d4 d4 d4 .word 0xd4d4d4d4
55 // DISASM-NEXT: 2021c: d4 d4 d4 d4 .word 0xd4d4d4d4
56 // DISASM-NEXT: 20220: add r12, pc, #0, #12
57 // DISASM-NEXT: 20224: add r12, r12, #32
58 // DISASM-NEXT: 20228: ldr pc, [r12, #212]!
59 // DISASM-NEXT: 2022c: d4 d4 d4 d4 .word 0xd4d4d4d4
60 // DISASM-NEXT: 20230: add r12, pc, #0, #12
61 // DISASM-NEXT: 20234: add r12, r12, #32
62 // DISASM-NEXT: 20238: ldr pc, [r12, #200]!
63 // DISASM-NEXT: 2023c: d4 d4 d4 d4 .word 0xd4d4d4d4
64 // DISASM: <.iplt>:
65 // DISASM-NEXT: 20240: add r12, pc, #0, #12
66 // DISASM-NEXT: 20244: add r12, r12, #16
67 // DISASM-NEXT: 20248: ldr pc, [r12, #160]!
68 // DISASM-NEXT: 2024c: d4 d4 d4 d4 .word 0xd4d4d4d4
69 // DISASM-NEXT: 20250: add r12, pc, #0, #12
70 // DISASM-NEXT: 20254: add r12, r12, #16
71 // DISASM-NEXT: 20258: ldr pc, [r12, #148]!
72 // DISASM-NEXT: 2025c: d4 d4 d4 d4 .word 0xd4d4d4d4
74 .syntax unified
75 .text
76 .type foo STT_GNU_IFUNC
77 .globl foo
78 foo:
79 bx lr
81 .type bar STT_GNU_IFUNC
82 .globl bar
83 bar:
84 bx lr
86 .globl _start
87 _start:
88 bl foo
89 bl bar
90 // Create entries in the .got and .rel.dyn so that we don't just have
91 // IRELATIVE
92 .word bar2(got)
93 .word zed2(got)
94 bl bar2
95 bl zed2