Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / ELF / arm-gnu-ifunc.s
blob562478256fd8e070ae08665403448d1905692964
1 // REQUIRES: arm
2 // RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t.o
3 // RUN: ld.lld %t.o -o %t
4 // RUN: llvm-objdump --no-print-imm-hex --triple=armv7a-none-linux-gnueabi -d --no-show-raw-insn %t | FileCheck %s --check-prefix=DISASM
5 // RUN: llvm-readobj -r --symbols --sections %t | FileCheck %s
6 .syntax unified
7 .text
8 .globl bar, foo
9 .type foo STT_GNU_IFUNC
10 foo:
11 bx lr
13 .type bar STT_GNU_IFUNC
14 bar:
15 bx lr
17 .globl _start
18 _start:
19 bl foo
20 bl bar
21 movw r0,:lower16:__rel_iplt_start
22 movt r0,:upper16:__rel_iplt_start
23 movw r0,:lower16:__rel_iplt_end
24 movt r0,:upper16:__rel_iplt_end
26 // CHECK: Sections [
27 // CHECK: Section {
28 // CHECK: Section {
29 // CHECK: Name: .rel.dyn
30 // CHECK-NEXT: Type: SHT_REL
31 // CHECK-NEXT: Flags [
32 // CHECK-NEXT: SHF_ALLOC
33 // CHECK-NEXT: SHF_INFO_LINK
34 // CHECK-NEXT: ]
35 // CHECK-NEXT: Address: 0x100F4
36 // CHECK-NEXT: Offset: 0xF4
37 // CHECK-NEXT: Size: 16
38 // CHECK-NEXT: Link:
39 // CHECK-NEXT: Info: 4
40 // CHECK: Name: .iplt
41 // CHECK-NEXT: Type: SHT_PROGBITS
42 // CHECK-NEXT: Flags [
43 // CHECK-NEXT: SHF_ALLOC
44 // CHECK-NEXT: SHF_EXECINSTR
45 // CHECK-NEXT: ]
46 // CHECK-NEXT: Address: 0x20130
47 // CHECK-NEXT: Offset: 0x130
48 // CHECK-NEXT: Size: 32
49 // CHECK: Index: 4
50 // CHECK-NEXT: Name: .got
51 // CHECK-NEXT: Type: SHT_PROGBITS
52 // CHECK-NEXT: Flags [
53 // CHECK-NEXT: SHF_ALLOC
54 // CHECK-NEXT: SHF_WRITE
55 // CHECK-NEXT: ]
56 // CHECK-NEXT: Address: 0x30150
57 // CHECK-NEXT: Offset: 0x150
58 // CHECK-NEXT: Size: 8
59 // CHECK: Relocations [
60 // CHECK-NEXT: Section (1) .rel.dyn {
61 // CHECK-NEXT: 0x30150 R_ARM_IRELATIVE
62 // CHECK-NEXT: 0x30154 R_ARM_IRELATIVE
63 // CHECK-NEXT: }
64 // CHECK-NEXT: ]
65 // CHECK: Name: __rel_iplt_start
66 // CHECK-NEXT: Value: 0x100F4
67 // CHECK-NEXT: Size: 0
68 // CHECK-NEXT: Binding: Local
69 // CHECK-NEXT: Type: None
70 // CHECK-NEXT: Other [
71 // CHECK-NEXT: STV_HIDDEN
72 // CHECK-NEXT: ]
73 // CHECK-NEXT: Section: .rel.dyn
74 // CHECK-NEXT: }
75 // CHECK-NEXT: Symbol {
76 // CHECK-NEXT: Name: __rel_iplt_end
77 // CHECK-NEXT: Value: 0x10104
78 // CHECK-NEXT: Size: 0
79 // CHECK-NEXT: Binding: Local
80 // CHECK-NEXT: Type: None
81 // CHECK-NEXT: Other [
82 // CHECK-NEXT: STV_HIDDEN
83 // CHECK-NEXT: ]
84 // CHECK-NEXT: Section: .rel.dyn
85 // CHECK-NEXT: }
86 // CHECK-NEXT: Symbol {
87 // CHECK-NEXT: Name: bar
88 // CHECK-NEXT: Value: 0x20108
89 // CHECK-NEXT: Size: 0
90 // CHECK-NEXT: Binding: Global
91 // CHECK-NEXT: Type: GNU_IFunc
92 // CHECK-NEXT: Other: 0
93 // CHECK-NEXT: Section: .text
94 // CHECK-NEXT: }
95 // CHECK-NEXT: Symbol {
96 // CHECK-NEXT: Name: foo
97 // CHECK-NEXT: Value: 0x20104
98 // CHECK-NEXT: Size: 0
99 // CHECK-NEXT: Binding: Global
100 // CHECK-NEXT: Type: GNU_IFunc
101 // CHECK-NEXT: Other: 0
102 // CHECK-NEXT: Section: .text
103 // CHECK-NEXT: }
104 // CHECK-NEXT: Symbol {
105 // CHECK-NEXT: Name: _start
106 // CHECK-NEXT: Value: 0x2010C
107 // CHECK-NEXT: Size: 0
108 // CHECK-NEXT: Binding: Global
109 // CHECK-NEXT: Type: None
110 // CHECK-NEXT: Other:
111 // CHECK-NEXT: Section: .text
112 // CHECK-NEXT: }
114 // DISASM: Disassembly of section .text:
115 // DISASM-EMPTY:
116 // DISASM-NEXT: <foo>:
117 // DISASM-NEXT: 20104: bx lr
118 // DISASM: <bar>:
119 // DISASM-NEXT: 20108: bx lr
120 // DISASM: <_start>:
121 // DISASM-NEXT: 2010c: bl 0x20140
122 // DISASM-NEXT: 20110: bl 0x20130
123 // 1 * 65536 + 244 = 0x100f4 __rel_iplt_start
124 // DISASM-NEXT: 20114: movw r0, #244
125 // DISASM-NEXT: 20118: movt r0, #1
126 // 1 * 65536 + 260 = 0x10104 __rel_iplt_end
127 // DISASM-NEXT: 2011c: movw r0, #260
128 // DISASM-NEXT: 20120: movt r0, #1
129 // DISASM-EMPTY:
130 // DISASM-NEXT: Disassembly of section .iplt:
131 // DISASM-EMPTY:
132 // DISASM-NEXT: <.iplt>:
133 // DISASM-NEXT: 20130: add r12, pc, #0, #12
134 // DISASM-NEXT: 20134: add r12, r12, #16
135 // DISASM-NEXT: 20138: ldr pc, [r12, #24]!
136 // DISASM-NEXT: 2013c: d4 d4 d4 d4 .word 0xd4d4d4d4
137 // DISASM-NEXT: 20140: add r12, pc, #0, #12
138 // DISASM-NEXT: 20144: add r12, r12, #16
139 // DISASM-NEXT: 20148: ldr pc, [r12, #12]!
140 // DISASM-NEXT: 2014c: d4 d4 d4 d4 .word 0xd4d4d4d4