[ELF] Make SyntheticSection parameter order match InputSection
[llvm-project.git] / lld / test / ELF / arm-gnu-ifunc.s
blobd49ca18e991e1c149002c82f3c92dd329c90a4a8
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: ]
34 // CHECK-NEXT: Address: 0x100F4
35 // CHECK-NEXT: Offset: 0xF4
36 // CHECK-NEXT: Size: 16
37 // CHECK-NEXT: Link:
38 // CHECK-NEXT: Info: 0
39 // CHECK: Name: .iplt
40 // CHECK-NEXT: Type: SHT_PROGBITS
41 // CHECK-NEXT: Flags [
42 // CHECK-NEXT: SHF_ALLOC
43 // CHECK-NEXT: SHF_EXECINSTR
44 // CHECK-NEXT: ]
45 // CHECK-NEXT: Address: 0x20130
46 // CHECK-NEXT: Offset: 0x130
47 // CHECK-NEXT: Size: 32
48 // CHECK: Index: 4
49 // CHECK-NEXT: Name: .got
50 // CHECK-NEXT: Type: SHT_PROGBITS
51 // CHECK-NEXT: Flags [
52 // CHECK-NEXT: SHF_ALLOC
53 // CHECK-NEXT: SHF_WRITE
54 // CHECK-NEXT: ]
55 // CHECK-NEXT: Address: 0x30150
56 // CHECK-NEXT: Offset: 0x150
57 // CHECK-NEXT: Size: 8
58 // CHECK: Relocations [
59 // CHECK-NEXT: Section (1) .rel.dyn {
60 // CHECK-NEXT: 0x30150 R_ARM_IRELATIVE
61 // CHECK-NEXT: 0x30154 R_ARM_IRELATIVE
62 // CHECK-NEXT: }
63 // CHECK-NEXT: ]
64 // CHECK: Name: __rel_iplt_start
65 // CHECK-NEXT: Value: 0x100F4
66 // CHECK-NEXT: Size: 0
67 // CHECK-NEXT: Binding: Local
68 // CHECK-NEXT: Type: None
69 // CHECK-NEXT: Other [
70 // CHECK-NEXT: STV_HIDDEN
71 // CHECK-NEXT: ]
72 // CHECK-NEXT: Section: .rel.dyn
73 // CHECK-NEXT: }
74 // CHECK-NEXT: Symbol {
75 // CHECK-NEXT: Name: __rel_iplt_end
76 // CHECK-NEXT: Value: 0x10104
77 // CHECK-NEXT: Size: 0
78 // CHECK-NEXT: Binding: Local
79 // CHECK-NEXT: Type: None
80 // CHECK-NEXT: Other [
81 // CHECK-NEXT: STV_HIDDEN
82 // CHECK-NEXT: ]
83 // CHECK-NEXT: Section: .rel.dyn
84 // CHECK-NEXT: }
85 // CHECK-NEXT: Symbol {
86 // CHECK-NEXT: Name: bar
87 // CHECK-NEXT: Value: 0x20108
88 // CHECK-NEXT: Size: 0
89 // CHECK-NEXT: Binding: Global
90 // CHECK-NEXT: Type: GNU_IFunc
91 // CHECK-NEXT: Other: 0
92 // CHECK-NEXT: Section: .text
93 // CHECK-NEXT: }
94 // CHECK-NEXT: Symbol {
95 // CHECK-NEXT: Name: foo
96 // CHECK-NEXT: Value: 0x20104
97 // CHECK-NEXT: Size: 0
98 // CHECK-NEXT: Binding: Global
99 // CHECK-NEXT: Type: GNU_IFunc
100 // CHECK-NEXT: Other: 0
101 // CHECK-NEXT: Section: .text
102 // CHECK-NEXT: }
103 // CHECK-NEXT: Symbol {
104 // CHECK-NEXT: Name: _start
105 // CHECK-NEXT: Value: 0x2010C
106 // CHECK-NEXT: Size: 0
107 // CHECK-NEXT: Binding: Global
108 // CHECK-NEXT: Type: None
109 // CHECK-NEXT: Other:
110 // CHECK-NEXT: Section: .text
111 // CHECK-NEXT: }
113 // DISASM: Disassembly of section .text:
114 // DISASM-EMPTY:
115 // DISASM-NEXT: <foo>:
116 // DISASM-NEXT: 20104: bx lr
117 // DISASM: <bar>:
118 // DISASM-NEXT: 20108: bx lr
119 // DISASM: <_start>:
120 // DISASM-NEXT: 2010c: bl 0x20140
121 // DISASM-NEXT: 20110: bl 0x20130
122 // 1 * 65536 + 244 = 0x100f4 __rel_iplt_start
123 // DISASM-NEXT: 20114: movw r0, #244
124 // DISASM-NEXT: 20118: movt r0, #1
125 // 1 * 65536 + 260 = 0x10104 __rel_iplt_end
126 // DISASM-NEXT: 2011c: movw r0, #260
127 // DISASM-NEXT: 20120: movt r0, #1
128 // DISASM-EMPTY:
129 // DISASM-NEXT: Disassembly of section .iplt:
130 // DISASM-EMPTY:
131 // DISASM-NEXT: <.iplt>:
132 // DISASM-NEXT: 20130: add r12, pc, #0, #12
133 // DISASM-NEXT: 20134: add r12, r12, #16
134 // DISASM-NEXT: 20138: ldr pc, [r12, #24]!
135 // DISASM-NEXT: 2013c: d4 d4 d4 d4 .word 0xd4d4d4d4
136 // DISASM-NEXT: 20140: add r12, pc, #0, #12
137 // DISASM-NEXT: 20144: add r12, r12, #16
138 // DISASM-NEXT: 20148: ldr pc, [r12, #12]!
139 // DISASM-NEXT: 2014c: d4 d4 d4 d4 .word 0xd4d4d4d4